Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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 namespace LibSVM
21 {
22  struct svm_parameter;
23  struct svm_problem;
24  struct svm_node;
25  struct svm_model;
26 }
27 
28 namespace mitk
29 {
31  {
32  public:
33 
35  itkFactorylessNewMacro(Self)
36  itkCloneMacro(Self)
37 
39  ~LibSVMClassifier() override;
40 
41  void Train(const Eigen::MatrixXd &X, const Eigen::MatrixXi &Y) override;
42  Eigen::MatrixXi Predict(const Eigen::MatrixXd &X) override;
43 
44  bool SupportsPointWiseWeight() override{return true;}
45  bool SupportsPointWiseProbability() override{return false;}
46 
47  void PrintParameter(std::ostream & str);
48  void ConvertParameter();
49 
50  void SetSvmType(int val);
51  void SetProbability(int val);
52  void SetShrinking(int val);
53  void SetNrWeight(int val);
54  void SetNu(double val);
55  void SetP(double val);
56  void SetEps(double val);
57  void SetC(double val);
58  void SetCacheSize(double val);
59  void SetKernelType(int val);
60  void SetDegree(int val);
61  void SetGamma(double val);
62  void SetCoef0(double val);
63 
64  private:
65 
66  void ReadXValues(LibSVM::svm_problem * problem, LibSVM::svm_node** xSpace, const Eigen::MatrixXd &X);
67  void ReadYValues(LibSVM::svm_problem * problem, const Eigen::MatrixXi &Y);
68  void ReadWValues(LibSVM::svm_problem * problem);
69 
70  LibSVM::svm_model* m_Model;
71  LibSVM::svm_parameter * m_Parameter;
72 
73  };
74 }
75 
76 #endif //mitkLibSVMClassifier_h
bool SupportsPointWiseWeight() override
SupportsPointWiseWeight.
Base of all data objects.
Definition: mitkBaseData.h:37
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