13 #ifndef mitkPURFClassifier_h
14 #define mitkPURFClassifier_h
16 #include <MitkCLVigraRandomForestExports.h>
20 #include <vigra/random_forest.hxx>
32 itkFactorylessNewMacro(
Self);
40 void Train(
const Eigen::MatrixXd &X,
const Eigen::MatrixXi &Y)
override;
42 Eigen::MatrixXi Predict(
const Eigen::MatrixXd &X)
override;
43 Eigen::MatrixXi PredictWeighted(
const Eigen::MatrixXd &X);
46 bool SupportsPointWiseWeight()
override;
47 bool SupportsPointWiseProbability()
override;
48 void ConvertParameter();
49 vigra::ArrayVector<double> CalculateKappa(
const Eigen::MatrixXd & X_in,
const Eigen::MatrixXi &Y_in);
51 void SetRandomForest(
const vigra::RandomForest<int> & rf);
52 const vigra::RandomForest<int> & GetRandomForest()
const;
54 void UsePointWiseWeight(
bool)
override;
55 void SetMaximumTreeDepth(
int);
56 void SetMinimumSplitNodeSize(
int);
57 void SetPrecision(
double);
58 void SetSamplesPerTree(
double);
59 void UseSampleWithReplacement(
bool);
60 void SetTreeCount(
int);
61 void SetWeightLambda(
double);
63 void PrintParameter(std::ostream &str = std::cout);
65 void SetClassProbabilities(Eigen::VectorXd probabilities);
66 Eigen::VectorXd GetClassProbabilites();
75 struct PredictionData;
76 struct EigenToVigraTransform;
79 vigra::MultiArrayView<2, double> m_Probabilities;
80 Eigen::MatrixXd m_TreeWeights;
81 Eigen::VectorXd m_ClassProbabilities;
83 Parameter * m_Parameter;
84 vigra::RandomForest<int> m_RandomForest;
86 static itk::ITK_THREAD_RETURN_TYPE TrainTreesCallback(
void *);
87 static itk::ITK_THREAD_RETURN_TYPE PredictCallback(
void *);
88 static itk::ITK_THREAD_RETURN_TYPE PredictWeightedCallback(
void *);
89 static void VigraPredictWeighted(PredictionData *data, vigra::MultiArrayView<2, double> & X, vigra::MultiArrayView<2, int> & Y, vigra::MultiArrayView<2, double> & P);