Home | History | Annotate | Download | only in src

Lines Matching refs:fs

1002 void CvDTreeTrainData::write_params( CvFileStorage* fs )
1010 cvWriteInt( fs, "is_classifier", is_classifier ? 1 : 0 );
1011 cvWriteInt( fs, "var_all", var_all );
1012 cvWriteInt( fs, "var_count", var_count );
1013 cvWriteInt( fs, "ord_var_count", ord_var_count );
1014 cvWriteInt( fs, "cat_var_count", cat_var_count );
1016 cvStartWriteStruct( fs, "training_params", CV_NODE_MAP );
1017 cvWriteInt( fs, "use_surrogates", params.use_surrogates ? 1 : 0 );
1021 cvWriteInt( fs, "max_categories", params.max_categories );
1025 cvWriteReal( fs, "regression_accuracy", params.regression_accuracy );
1028 cvWriteInt( fs, "max_depth", params.max_depth );
1029 cvWriteInt( fs, "min_sample_count", params.min_sample_count );
1030 cvWriteInt( fs, "cross_validation_folds", params.cv_folds );
1034 cvWriteInt( fs
1035 cvWriteInt( fs, "truncate_pruned_tree", params.truncate_pruned_tree ? 1 : 0 );
1039 cvWrite( fs, "priors", priors );
1041 cvEndWriteStruct( fs );
1044 cvWrite( fs, "var_idx", var_idx );
1046 cvStartWriteStruct( fs, "var_type", CV_NODE_SEQ+CV_NODE_FLOW );
1049 cvWriteInt( fs, 0, var_type->data.i[vi] >= 0 );
1051 cvEndWriteStruct( fs );
1056 cvWrite( fs, "cat_count", cat_count );
1057 cvWrite( fs, "cat_map", cat_map );
1064 void CvDTreeTrainData::read_params( CvFileStorage* fs, CvFileNode* node )
1074 is_classifier = (cvReadIntByName( fs, node, "is_classifier" ) != 0);
1075 var_all = cvReadIntByName( fs, node, "var_all" );
1076 var_count = cvReadIntByName( fs, node, "var_count", var_all );
1077 cat_var_count = cvReadIntByName( fs, node, "cat_var_count" );
1078 ord_var_count = cvReadIntByName( fs, node, "ord_var_count" );
1080 tparams_node = cvGetFileNodeByName( fs, node, "training_params" );
1084 params.use_surrogates = cvReadIntByName( fs, tparams_node, "use_surrogates", 1 ) != 0;
1088 params.max_categories = cvReadIntByName( fs, tparams_node, "max_categories" );
1093 (float)cvReadRealByName( fs, tparams_node, "regression_accuracy" );
1096 params.max_depth = cvReadIntByName( fs, tparams_node, "max_depth" );
1097 params.min_sample_count = cvReadIntByName( fs, tparams_node, "min_sample_count" );
1098 params.cv_folds = cvReadIntByName( fs, tparams_node, "cross_validation_folds" );
1102 params.use_1se_rule = cvReadIntByName( fs, tparams_node, "use_1se_rule" ) != 0;
1104 cvReadIntByName( fs, tparams_node, "truncate_pruned_tree" ) != 0;
1107 priors = (CvMat*)cvReadByName( fs, tparams_node, "priors" );
1116 CV_CALL( var_idx = (CvMat*)cvReadByName( fs, node, "var_idx" ));
1136 vartype_node = cvGetFileNodeByName( fs, node, "var_type" );
1167 CV_CALL( cat_count = (CvMat*)cvReadByName( fs, node, "cat_count" ));
1168 CV_CALL( cat_map = (CvMat*)cvReadByName( fs, node, "cat_map" ));
3051 void CvDTree::write_split( CvFileStorage* fs, CvDTreeSplit* split )
3055 cvStartWriteStruct( fs, 0, CV_NODE_MAP + CV_NODE_FLOW );
3056 cvWriteInt( fs, "var", split->var_idx );
3057 cvWriteReal( fs, "quality", split->quality );
3070 cvStartWriteStruct( fs, default_dir*(split->inversed ? -1 : 1) > 0 ?
3077 cvWriteInt( fs, 0, i );
3079 cvEndWriteStruct( fs );
3082 cvWriteReal( fs, !split->inversed ? "le" : "gt", split->ord.c );
3084 cvEndWriteStruct( fs );
3088 void CvDTree::write_node( CvFileStorage* fs, CvDTreeNode* node )
3092 cvStartWriteStruct( fs, 0, CV_NODE_MAP );
3094 cvWriteInt( fs, "depth", node->depth );
3095 cvWriteInt( fs, "sample_count", node->sample_count );
3096 cvWriteReal( fs, "value", node->value );
3099 cvWriteInt( fs, "norm_class_idx", node->class_idx );
3101 cvWriteInt( fs, "Tn", node->Tn );
3102 cvWriteInt( fs, "complexity", node->complexity );
3103 cvWriteReal( fs, "alpha", node->alpha );
3104 cvWriteReal( fs, "node_risk", node->node_risk );
3105 cvWriteReal( fs, "tree_risk", node->tree_risk );
3106 cvWriteReal( fs, "tree_error", node->tree_error );
3110 cvStartWriteStruct( fs, "splits", CV_NODE_SEQ );
3113 write_split( fs, split );
3115 cvEndWriteStruct( fs );
3118 cvEndWriteStruct( fs );
3122 void CvDTree::write_tree_nodes( CvFileStorage* fs )
3136 write_node( fs, node );
3156 void CvDTree::write( CvFileStorage* fs, const char* name )
3162 cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_ML_TREE );
3165 data->write_params( fs );
3167 cvWrite( fs, "var_importance", var_importance );
3168 write( fs );
3170 cvEndWriteStruct( fs );
3176 void CvDTree::write( CvFileStorage* fs )
3182 cvWriteInt( fs, "best_tree_idx", pruned_tree_idx );
3184 cvStartWriteStruct( fs, "nodes", CV_NODE_SEQ );
3185 write_tree_nodes( fs );
3186 cvEndWriteStruct( fs );
3192 CvDTreeSplit* CvDTree::read_split( CvFileStorage* fs, CvFileNode* fnode )
3205 vi = cvReadIntByName( fs, fnode, "var", -1 );
3216 inseq = cvGetFileNodeByName( fs, fnode, "in" );
3219 inseq = cvGetFileNodeByName( fs, fnode, "not_in" );
3262 cmp_node = cvGetFileNodeByName( fs, fnode, "le" );
3265 cmp_node = cvGetFileNodeByName( fs, fnode, "gt" );
3272 split->quality = (float)cvReadRealByName( fs, fnode, "quality" );
3280 CvDTreeNode* CvDTree::read_node( CvFileStorage* fs, CvFileNode* fnode, CvDTreeNode* parent )
3295 depth = cvReadIntByName( fs, fnode, "depth", -1 );
3299 node->sample_count = cvReadIntByName( fs, fnode, "sample_count" );
3300 node->value = cvReadRealByName( fs, fnode, "value" );
3302 node->class_idx = cvReadIntByName( fs, fnode, "norm_class_idx" );
3304 node->Tn = cvReadIntByName( fs, fnode, "Tn" );
3305 node->complexity = cvReadIntByName( fs, fnode, "complexity" );
3306 node->alpha = cvReadRealByName( fs, fnode, "alpha" );
3307 node->node_risk = cvReadRealByName( fs, fnode, "node_risk" );
3308 node->tree_risk = cvReadRealByName( fs, fnode, "tree_risk" );
3309 node->tree_error = cvReadRealByName( fs, fnode, "tree_error" );
3311 splits = cvGetFileNodeByName( fs, fnode, "splits" );
3324 CV_CALL( split = read_split( fs, (CvFileNode*)reader.ptr ));
3340 void CvDTree::read_tree_nodes( CvFileStorage* fs, CvFileNode* fnode )
3358 CV_CALL( node = read_node( fs, (CvFileNode*)reader.ptr, parent != &_root ? parent : 0 ));
3380 void CvDTree::read( CvFileStorage* fs, CvFileNode* fnode )
3383 _data->read_params( fs, fnode );
3385 read( fs, fnode, _data );
3391 void CvDTree::read( CvFileStorage* fs, CvFileNode* node, CvDTreeTrainData* _data )
3402 tree_nodes = cvGetFileNodeByName( fs, node, "nodes" );
3406 pruned_tree_idx = cvReadIntByName( fs, node, "best_tree_idx", -1 );
3407 read_tree_nodes( fs, tree_nodes );