OTB  9.0.0
Orfeo Toolbox
otbSVMCrossValidationCostFunction.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbSVMCrossValidationCostFunction_h
22 #define otbSVMCrossValidationCostFunction_h
23 
24 #include "itkSingleValuedCostFunction.h"
25 
26 namespace otb
27 {
28 
52 template <class TModel>
53 class ITK_EXPORT SVMCrossValidationCostFunction : public itk::SingleValuedCostFunction
54 {
55 public:
58  typedef itk::SingleValuedCostFunction Superclass;
59  typedef itk::SmartPointer<Self> Pointer;
60  typedef itk::SmartPointer<const Self> ConstPointer;
61 
63  itkNewMacro(Self);
64 
66  typedef TModel SVMModelType;
67  typedef typename SVMModelType::Pointer SVMModelPointer;
68 
70  typedef typename Superclass::MeasureType MeasurementType;
71  typedef typename Superclass::ParametersType ParametersType;
72  typedef typename Superclass::ParametersValueType ParametersValueType;
73  typedef typename Superclass::DerivativeType DerivativeType;
74 
76  itkSetObjectMacro(Model, SVMModelType);
77  itkGetObjectMacro(Model, SVMModelType);
79 
81  itkSetMacro(DerivativeStep, ParametersValueType);
82  itkGetMacro(DerivativeStep, ParametersValueType);
84 
86  MeasureType GetValue(const ParametersType& parameters) const override;
87 
89  void GetDerivative(const ParametersType& parameters, DerivativeType& derivative) const override;
90 
92  unsigned int GetNumberOfParameters(void) const override;
93 
94 protected:
99 
102  void UpdateParameters(const ParametersType& parameters) const;
103 
104 private:
105  SVMCrossValidationCostFunction(const Self&) = delete;
106  void operator=(const Self&) = delete;
107 
110 
113 
114 }; // class SVMCrossValidationCostFunction
115 
116 } // namespace otb
117 
118 #ifndef OTB_MANUAL_INSTANTIATION
120 #endif
121 
122 #endif
otb::SVMCrossValidationCostFunction::m_DerivativeStep
ParametersValueType m_DerivativeStep
Definition: otbSVMCrossValidationCostFunction.h:112
otb::SVMCrossValidationCostFunction::SVMModelType
TModel SVMModelType
Definition: otbSVMCrossValidationCostFunction.h:63
otb::SVMCrossValidationCostFunction::ParametersType
Superclass::ParametersType ParametersType
Definition: otbSVMCrossValidationCostFunction.h:71
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::SVMCrossValidationCostFunction
This function returns the cross validation accuracy of a SVM model.
Definition: otbSVMCrossValidationCostFunction.h:53
otb::SVMCrossValidationCostFunction::DerivativeType
Superclass::DerivativeType DerivativeType
Definition: otbSVMCrossValidationCostFunction.h:73
otb::SVMCrossValidationCostFunction::Self
SVMCrossValidationCostFunction Self
Definition: otbSVMCrossValidationCostFunction.h:57
otb::SVMCrossValidationCostFunction::Superclass
itk::SingleValuedCostFunction Superclass
Definition: otbSVMCrossValidationCostFunction.h:58
otb::SVMCrossValidationCostFunction::SVMModelPointer
SVMModelType::Pointer SVMModelPointer
Definition: otbSVMCrossValidationCostFunction.h:67
otb::SVMCrossValidationCostFunction::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbSVMCrossValidationCostFunction.h:59
otbSVMCrossValidationCostFunction.hxx
otb::SVMCrossValidationCostFunction::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbSVMCrossValidationCostFunction.h:60
otb::SVMCrossValidationCostFunction::ParametersValueType
Superclass::ParametersValueType ParametersValueType
Definition: otbSVMCrossValidationCostFunction.h:72
otb::SVMCrossValidationCostFunction::MeasurementType
Superclass::MeasureType MeasurementType
Definition: otbSVMCrossValidationCostFunction.h:70
otb::SVMCrossValidationCostFunction::m_Model
SVMModelPointer m_Model
Definition: otbSVMCrossValidationCostFunction.h:109