24 #include "MAClassifierTypes.hpp" 26 #include "core/MACoreTypes.hpp" 28 #include <MCTypes.hpp> 30 #include <boost/serialization/access.hpp> 31 #include <boost/serialization/split_member.hpp> 32 #include <boost/tuple/tuple.hpp> 33 #include <boost/scoped_ptr.hpp> 34 #include <boost/shared_ptr.hpp> 38 class CvNormalBayesClassifier;
64 typedef boost::shared_ptr<MAClassifier> ClassifierSPtr;
75 typedef boost::tuple<MA::FloatTableList, MA::FloatTableList, MC::FloatList> CvResultsType;
83 friend class boost::serialization::access;
111 MAClassifier(MA::CRMethodType method,
int label_count,
bool regression =
false);
121 bool IsValid()
const;
130 MA::CRMethodType GetMethodType()
const;
139 bool IsRegression()
const;
148 unsigned int GetFeatureVectorSize()
const;
157 MC::FloatTable& GetFeatureVectors();
166 MC::FloatList& GetLabels();
175 MC::FloatList GetModelLabels()
const;
184 void PrioritizeClasses(
const MC::FloatList& labels);
204 void SetParameter(MA::CRMethodParamType method_parameter,
float value);
215 float GetParameter(MA::CRMethodParamType method_parameter);
226 void SetPreprocessingMode(MA::FeaturePreprocessingType preprocessing_mode);
239 void AddSamples(
const MC::FloatTable& input_vectors,
const MC::FloatList& labels);
253 MC::FloatList Predict(
const MC::FloatTable& input_vectors, MC::FloatList& confidences);
267 float Predict(
const MC::FloatList& input_vector, MC::FloatList& confidence);
269 float PredictReal(
const MC::FloatList& input_vector, MC::FloatList& confidence);
294 MA::CvResultsType CrossValidate(
int iterations, MA::ClassifierCrossValidationType cv_type,
295 float cv_parameter,
const MC::FloatTable& samples,
296 const MC::FloatList& labels,
297 const MC::FloatTable& validation_samples = MC::FloatTable(),
298 const MC::FloatList& validation_labels = MC::FloatList(),
346 void CreateClassifier();
348 template<
class Archive>
349 void load(Archive& archive,
const unsigned int version);
350 template<
class Archive>
351 void save(Archive& archive,
const unsigned int version)
const;
352 BOOST_SERIALIZATION_SPLIT_MEMBER();
404 int TreeNodeSampleLimit;
432 boost::scoped_ptr<LWPR_Object>
Lwpr;
434 boost::scoped_ptr<PLS_Model>
Plsr;
436 boost::scoped_ptr<GpWrapper>
Gpr;
float MeL1
L1 regularization parameter (maximum entropy)
float SvmC
C parameter (support vector machine)
boost::scoped_ptr< CvGBTrees > GradientBoostedTrees
Gradient boosted trees classifier.
MC::FloatTable CachedSamples
Cached training samples.
boost::scoped_ptr< CvSVMParams > SvmClassifierParams
Support vector machines classifier.
boost::scoped_ptr< CvANN_MLP > NeuralNetwork
Neural network classifier.
float SvmGamma
γ parameter (support vector machine)
boost::scoped_ptr< LWPR_Object > Lwpr
Locally weighted projection regression.
boost::scoped_ptr< GpWrapper > Gpr
Gaussian process regression.
boost::scoped_ptr< PLS_Model > Plsr
Partial least squares regression.
float KrrGamma
Gamma parameter (kernel ridge regression/rbf kernel)
MA::FeaturePreprocessingType Preprocessing
Preprocessing type.
Classifier model based on OpenCV classifiers.
float KrlsGamma
Gamma parameter (kernel recursive least squares/rbf kernel)
int RtMaxForestSize
Maximum number of trees in a forest (random/extremely randomized/gradient boosted trees) ...
boost::scoped_ptr< CvNormalBayesClassifier > BayesClassifier
Naive Bayes classifier.
#define MC_DISABLE_COPY(class_name)
Helper macro to disable the copy constructor and assignment operator of a class (object copying) ...
float RvmRbfGamma
Gamma parameter (relevance vector machine/rbf kernel)
unsigned int LabelCount
Label count.
boost::scoped_ptr< CvSVM > SvmClassifier
Support vector machines classifier.
MC::FloatList PrioritizedClasses
Prioritized classes for OpenCV classifiers.
MA::CRMethodType Classifier
Classifier type.
boost::scoped_ptr< ME_Model > MaxEntropy
Maximum entropy classifier.
boost::scoped_ptr< CvERTrees > ExtremeRandomTrees
Extremely randomized trees classifier.
unsigned int FeatureCount
Feature count.
boost::scoped_ptr< CvEmWrapper > EmClassifier
Expectation maximization classifier.
boost::scoped_ptr< CvKNearest > KNearestClassifier
K-nearest neighbor classifier.
float KrlsTolerance
Tolerance parameter (kernel recursive least squares)
MA::FloatSet CachedUniqueLabels
Cached unique labels.
float SvmNu
ν parameter (support vector machine)
bool Regression
Whether the instance is a normal classifier or regression is used.
float DlibEpsilon
Epsilon parameter (support/relevance vector machine in dlib)
boost::scoped_ptr< MARandomTrees > RandomTrees
Random trees classifier.
boost::scoped_ptr< DlibWrapper > DlibFunctions
Wrapper for Dlib classifier/regression functions.
boost::scoped_ptr< CvDTree > DecisionTree
Decision tree classifier.
float SvmP
P parameter (support vector machine)
bool SvmAutoTrain
Auto-train parameter (support vector machine)
int TreeMaxDepth
Maximum depth (decision/random/extremely randomized/gradient boosted trees)
float MCFloatInfinity()
Get float infinity.
float LwprAlpha
α parameter (locally weighted projection regression)
MC::FloatList PriorityLabels
Priors for OpenCV classifiers.
MC::FloatTable PreprocessedData
Cached preprocessed data.
float MeL2
L2 regularization parameter (maximum entropy)
bool Trained
Whether the classifier is already trained.
Common inferface for multiple classifiers and regression algorithms.
float KrrLambda
Lambda parameter (kernel ridge regression)
float RvmSigmoidGamma
Gamma parameter (relevance vector machine/sigmoid kernel)
MC::FloatList CachedLabels
Cached training labels.