Medical Imaging Interaction Toolkit  2023.04.00
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
MitkCLLibSVMExports.h
svm_node
Definition: svm.h:59
MITKCLLIBSVM_EXPORT
#define MITKCLLIBSVM_EXPORT
Definition: MitkCLLibSVMExports.h:15
svm_problem
Definition: svm.h:65
svm_parameter
Definition: svm.h:76
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitk::LibSVMClassifier
Definition: mitkLibSVMClassifier.h:27
mitk::BaseData
Base of all data objects.
Definition: mitkBaseData.h:42
mitk::AbstractClassifier
Definition: mitkAbstractClassifier.h:32
svm_model
Definition: svm.h:100
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
mitkAbstractClassifier.h
mitk::LibSVMClassifier::SupportsPointWiseWeight
bool SupportsPointWiseWeight() override
SupportsPointWiseWeight.
Definition: mitkLibSVMClassifier.h:43
mitk::LibSVMClassifier::SupportsPointWiseProbability
bool SupportsPointWiseProbability() override
SupportsPointWiseProbability.
Definition: mitkLibSVMClassifier.h:44