Medical Imaging Interaction Toolkit  2018.4.99-c4b6bb11
Medical Imaging Interaction Toolkit
mitkLibSVMClassifier.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkLibSVMClassifier_h
14 #define mitkLibSVMClassifier_h
15 
16 #include <MitkCLLibSVMExports.h>
17 
18 #include <mitkAbstractClassifier.h>
19 
20 struct svm_parameter;
21 struct svm_problem;
22 struct svm_node;
23 struct svm_model;
24 
25 namespace mitk
26 {
28  {
29  public:
30 
32 
33  itkFactorylessNewMacro(Self);
34 
35  itkCloneMacro(Self);
36 
38  ~LibSVMClassifier() override;
39 
40  void Train(const Eigen::MatrixXd &X, const Eigen::MatrixXi &Y) override;
41  Eigen::MatrixXi Predict(const Eigen::MatrixXd &X) override;
42 
43  bool SupportsPointWiseWeight() override{return true;}
44  bool SupportsPointWiseProbability() override{return false;}
45 
46  void PrintParameter(std::ostream & str);
47  void ConvertParameter();
48 
49  void SetSvmType(int val);
50  void SetProbability(int val);
51  void SetShrinking(int val);
52  void SetNrWeight(int val);
53  void SetNu(double val);
54  void SetP(double val);
55  void SetEps(double val);
56  void SetC(double val);
57  void SetCacheSize(double val);
58  void SetKernelType(int val);
59  void SetDegree(int val);
60  void SetGamma(double val);
61  void SetCoef0(double val);
62 
63  private:
64 
65  void ReadXValues(svm_problem * problem, svm_node** xSpace, const Eigen::MatrixXd &X);
66  void ReadYValues(svm_problem * problem, const Eigen::MatrixXi &Y);
67  void ReadWValues(svm_problem * problem);
68 
69  svm_model* m_Model;
70  svm_parameter * m_Parameter;
71 
72  };
73 }
74 
75 #endif //mitkLibSVMClassifier_h
bool SupportsPointWiseWeight() override
SupportsPointWiseWeight.
Base of all data objects.
Definition: mitkBaseData.h:42
DataCollection - Class to facilitate loading/accessing structured data.
Definition: svm.h:100
#define MITKCLLIBSVM_EXPORT
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
bool SupportsPointWiseProbability() override
SupportsPointWiseProbability.
Definition: svm.h:59