OTB  5.0.0
Orfeo Toolbox
otbSVMCrossValidationCostFunction.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef __otbSVMCrossValidationCostFunction_h
19 #define __otbSVMCrossValidationCostFunction_h
20 
21 #include "otbSVMModel.h"
23 
24 namespace otb
25 {
26 
50 template <class TModel>
53 {
54 public:
60 
62  itkNewMacro(Self);
63 
65  typedef TModel SVMModelType;
66  typedef typename SVMModelType::Pointer SVMModelPointer;
67 
69  typedef typename Superclass::MeasureType MeasurementType;
70  typedef typename Superclass::ParametersType ParametersType;
72  typedef typename Superclass::DerivativeType DerivativeType;
73 
75  itkSetObjectMacro(Model, SVMModelType);
76  itkGetObjectMacro(Model, SVMModelType);
78 
80  itkSetMacro(NumberOfCrossValidationFolders, unsigned int);
81  itkGetMacro(NumberOfCrossValidationFolders, unsigned int);
83 
85  itkSetMacro(DerivativeStep, ParametersValueType);
86  itkGetMacro(DerivativeStep, ParametersValueType);
88 
90  virtual MeasureType GetValue(const ParametersType& parameters) const;
91 
93  virtual void GetDerivative(const ParametersType& parameters, DerivativeType& derivative) const;
94 
96  virtual unsigned int GetNumberOfParameters(void) const;
97 
98 protected:
103 
106  virtual void UpdateParameters(struct svm_parameter& svm_parameters, const ParametersType& parameters) const;
107 
108 private:
109  SVMCrossValidationCostFunction(const Self &); //purposely not implemented
110  void operator =(const Self&); //purposely not implemented
111 
114 
117 
120 
121 }; // class SVMCrossValidationCostFunction
122 
123 } // namespace otb
124 
125 #ifndef OTB_MANUAL_INSTANTIATION
127 #endif
128 
129 #endif
Superclass::ParametersValueType ParametersValueType
This function returns the cross validation accuracy of a SVM model.
TInternalComputationValueType ParametersValueType
Superclass::ParametersValueType ParametersValueType