26 TrainNodeCvRFParams(
int _max_depth,
int _min_sample_count,
float _regression_accuracy,
bool _use_surrogates,
int _max_categories,
bool _calc_var_importance,
int _nactive_vars,
int _maxCount,
double _epsilon,
int _term_criteria_type,
int _maxSamples) : max_depth(_max_depth), min_sample_count(_min_sample_count), regression_accuracy(_regression_accuracy), use_surrogates(_use_surrogates), max_categories(_max_categories), calc_var_importance(_calc_var_importance), nactive_vars(_nactive_vars), maxCount(_maxCount), epsilon(_epsilon), term_criteria_type(_term_criteria_type), maxSamples(_maxSamples) {}
39 TermCriteria::MAX_ITER | TermCriteria::EPS,
67 DllExport
CTrainNodeCvRF(byte nStates, word nFeatures,
int maxSamples);
70 DllExport
void reset(
void);
71 DllExport
void save(
const std::string &path,
const std::string &name = std::string(),
short idx = -1)
const;
72 DllExport
void load(
const std::string &path,
const std::string &name = std::string(),
short idx = -1);
74 DllExport
void addFeatureVec(
const Mat &featureVector, byte gt);
75 DllExport
void train(
bool doClean =
false);
101 vec_mat_t m_vSamplesAcc;
102 vec_int_t m_vNumInputSamples;
void reset(void)
Resets class variables.
void calculateNodePotentials(const Mat &featureVector, Mat &potential, Mat &mask) const
Calculates the node potential, based on the feature vector.
TrainNodeCvRFParams(int _max_depth, int _min_sample_count, float _regression_accuracy, bool _use_surrogates, int _max_categories, bool _calc_var_importance, int _nactive_vars, int _maxCount, double _epsilon, int _term_criteria_type, int _maxSamples)
void load(const std::string &path, const std::string &name=std::string(), short idx=-1)
Loads the training data.
int term_criteria_type
Termination cirteria type (according the the two previous parameters)
bool use_surrogates
Compute surrogate split, no missing data.
struct DirectGraphicalModels::TrainNodeCvRFParams TrainNodeCvRFParams
OpenCV Random Forest parameters.
double epsilon
Forest accuracy.
CTrainNodeCvRF(byte nStates, word nFeatures, TrainNodeCvRFParams params=TRAIN_NODE_CV_RF_PARAMS_DEFAULT)
Constructor.
int min_sample_count
Min sample count (1% of all data)
OpenCV Random Forest parameters.
int maxCount
Max number of trees in the forest (time / accuracy)
void train(bool doClean=false)
Random model training.
void save(const std::string &path, const std::string &name=std::string(), short idx=-1) const
Saves the training data.
void addFeatureVec(const Mat &featureVector, byte gt)
Adds new feature vector.
int maxSamples
Maximum number of samples to be used in training. 0 means using all the samples.
void loadFile(FILE *pFile)
Loads the random model from the file.
const TrainNodeCvRFParams TRAIN_NODE_CV_RF_PARAMS_DEFAULT
Mat getFeatureImportance(void) const
Returns the feature importance vector.
Ptr< CRForest > m_pRF
Random Forest.
Base abstract class for node potentials training.
int max_categories
Max number of categories (use sub-optimal algorithm for larger numbers)
float regression_accuracy
Regression accuracy (0 means N/A here)
OpenCV Random Forest training class.
void saveFile(FILE *pFile) const
Saves the random model into the file.
bool calc_var_importance
Calculate variable importance (must be true in order to use CTrainNodeCvRF::getFeatureImportance func...
int nactive_vars
Number of variables randomly selected at node and used to find the best split(s). (0 means the ) ...