OTB  6.1.0
Orfeo Toolbox
otbSVMCrossValidationCostFunction.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2017 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 
25 
26 namespace otb
27 {
28 
52 template <class TModel>
55 {
56 public:
62 
64  itkNewMacro(Self);
65 
67  typedef TModel SVMModelType;
68  typedef typename SVMModelType::Pointer SVMModelPointer;
69 
71  typedef typename Superclass::MeasureType MeasurementType;
73  typedef typename Superclass::ParametersValueType ParametersValueType;
74  typedef typename Superclass::DerivativeType DerivativeType;
75 
77  itkSetObjectMacro(Model, SVMModelType);
78  itkGetObjectMacro(Model, SVMModelType);
80 
82  itkSetMacro(DerivativeStep, ParametersValueType);
83  itkGetMacro(DerivativeStep, ParametersValueType);
85 
87  MeasureType GetValue(const ParametersType& parameters) const ITK_OVERRIDE;
88 
90  void GetDerivative(const ParametersType& parameters, DerivativeType& derivative) const ITK_OVERRIDE;
91 
93  unsigned int GetNumberOfParameters(void) const ITK_OVERRIDE;
94 
95 protected:
99  ~SVMCrossValidationCostFunction() ITK_OVERRIDE;
100 
103  void UpdateParameters(const ParametersType& parameters) const;
104 
105 private:
106  SVMCrossValidationCostFunction(const Self &); //purposely not implemented
107  void operator =(const Self&); //purposely not implemented
108 
111 
113  ParametersValueType m_DerivativeStep;
114 
115 }; // class SVMCrossValidationCostFunction
116 
117 } // namespace otb
118 
119 #ifndef OTB_MANUAL_INSTANTIATION
121 #endif
122 
123 #endif
Superclass::ParametersValueType ParametersValueType
This function returns the cross validation accuracy of a SVM model.
itk::Array< double > ParametersType
Definition: mvdTypes.h:131
TInternalComputationValueType ParametersValueType