Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkLibSVMClassifier_h
18 #define mitkLibSVMClassifier_h
19 
20 #include <MitkCLLibSVMExports.h>
21 
22 #include <mitkAbstractClassifier.h>
23 
24 namespace LibSVM
25 {
26  struct svm_parameter;
27  struct svm_problem;
28  struct svm_node;
29  struct svm_model;
30 }
31 
32 namespace mitk
33 {
35  {
36  public:
37 
39  itkFactorylessNewMacro(Self)
40  itkCloneMacro(Self)
41 
44 
45  void Train(const Eigen::MatrixXd &X, const Eigen::MatrixXi &Y) override;
46  Eigen::MatrixXi Predict(const Eigen::MatrixXd &X) override;
47 
48  bool SupportsPointWiseWeight(){return true;}
49  bool SupportsPointWiseProbability(){return false;}
50 
51  void PrintParameter(std::ostream & str);
52  void ConvertParameter();
53 
54  void SetSvmType(int val);
55  void SetProbability(int val);
56  void SetShrinking(int val);
57  void SetNrWeight(int val);
58  void SetNu(double val);
59  void SetP(double val);
60  void SetEps(double val);
61  void SetC(double val);
62  void SetCacheSize(double val);
63  void SetKernelType(int val);
64  void SetDegree(int val);
65  void SetGamma(double val);
66  void SetCoef0(double val);
67 
68  private:
69 
70  void ReadXValues(LibSVM::svm_problem * problem, LibSVM::svm_node** xSpace, const Eigen::MatrixXd &X);
71  void ReadYValues(LibSVM::svm_problem * problem, const Eigen::MatrixXi &Y);
72  void ReadWValues(LibSVM::svm_problem * problem);
73 
74  LibSVM::svm_model* m_Model;
75  LibSVM::svm_parameter * m_Parameter;
76 
77  };
78 }
79 
80 #endif //mitkLibSVMClassifier_h
Base of all data objects.
Definition: mitkBaseData.h:39
DataCollection - Class to facilitate loading/accessing structured data.
bool SupportsPointWiseWeight()
SupportsPointWiseWeight.
Definition: svm.h:104
#define MITKCLLIBSVM_EXPORT
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
bool SupportsPointWiseProbability()
SupportsPointWiseProbability.
Definition: svm.h:63