iRoCS Toolbox  1.1.0
BasicCVAdapter.hh
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * Copyright (C) 2004-2015 Olaf Ronneberger, Florian Pigorsch, Jörg Mechnich,
4  * Thorsten Falk
5  *
6  * Image Analysis Lab, University of Freiburg, Germany
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  **************************************************************************/
23 
24 /**************************************************************************
25 ** Title:
26 ** $RCSfile$
27 ** $Revision: 752 $$Name$
28 ** $Date: 2005-10-25 14:09:55 +0200 (Tue, 25 Oct 2005) $
29 ** Copyright: GPL $Author: ronneber $
30 ** Description:
31 **
32 **
33 **
34 **-------------------------------------------------------------------------
35 **
36 ** $Log$
37 ** Revision 1.4 2005/10/25 12:09:34 ronneber
38 ** - added classificationDetailsByUID() and
39 ** get/setStoreClassificationDetailsFlag()
40 **
41 ** Revision 1.3 2005/03/29 17:49:26 ronneber
42 ** - added updateKernelCache() and clearKernelCache()
43 **
44 ** Revision 1.2 2004/09/08 14:11:21 ronneber
45 ** - added saveOnlyKernelParameters()
46 **
47 ** Revision 1.1 2004/08/26 08:36:58 ronneber
48 ** initital import
49 **
50 **
51 **
52 **************************************************************************/
53 
54 
55 #ifndef BASICCVADAPTER_HH
56 #define BASICCVADAPTER_HH
57 
58 #ifdef HAVE_CONFIG_H
59 #include <config.hh>
60 #endif
61 
62 #include <vector>
63 
64 #include "GroupedTrainingData.hh"
65 #include "StDataASCII.hh"
66 #include "ProgressReporter.hh"
67 #include "StDataCmdLine.hh"
68 
69 
70 namespace svt
71 {
72 
73  template<typename FV,
74  typename PROBLEM = GroupedTrainingData<FV>,
75  typename STDATA = StDataASCII>
77  {
78  public:
79  typedef FV FV_TYPE;
80  typedef PROBLEM PROBLEM_TYPE;
81 
82  virtual ~BasicCVAdapter()
83  {}
84 
85  /*======================================================================*/
95  /*======================================================================*/
96  virtual void setProgressReporter( ProgressReporter* pr) = 0;
97 
98  /*======================================================================*/
112  /*======================================================================*/
113  virtual void loadParameters( STDATA& stData) = 0;
114  virtual void loadParameters( StDataASCII& stData) = 0;
115 
116 
117  /*======================================================================*/
128  /*======================================================================*/
129  virtual void loadParameters( StDataCmdLine& stData) = 0;
130 
131 
132  /*======================================================================*/
141  /*======================================================================*/
142  virtual void saveParameters( STDATA& stData) = 0;
143 
144  virtual void saveParameters( StDataASCII& stData) = 0;
145 
146 
147  /*======================================================================*/
152  /*======================================================================*/
153  virtual void saveOnlyKernelParameters( StDataASCII& stData) = 0;
154 
155 
156  /*======================================================================*/
166  /*======================================================================*/
167  virtual void setTrainingData( const PROBLEM* problem) = 0;
168 
169  /*======================================================================*/
176  /*======================================================================*/
177  virtual const PROBLEM* trainingData() const = 0;
178 
179 
180  /*======================================================================*/
194  /*======================================================================*/
195  virtual void updateKernelCache() = 0;
196 
197 
198  /*======================================================================*/
208  /*======================================================================*/
209  virtual void clearKernelCache() = 0;
210 
211  /*======================================================================*/
218  /*======================================================================*/
219  virtual void preprocessTrainingData() = 0;
220 
221 
222  /*======================================================================*/
245  /*======================================================================*/
246  virtual int doFullCV( const std::vector<int>& subsetIndexByUID,
247  std::vector<double>& predictedClassLabelByUID) = 0;
248 
249 
250 
251  virtual void setClassificationDelta( double d) = 0;
252 
253  virtual double classificationDelta() const = 0;
254 
255  virtual void setStoreClassificationDetailsFlag( bool f) = 0;
256 
257  virtual bool getStoreClassificationDetailsFlag() const = 0;
258 
259 
260  /*======================================================================*/
270  /*======================================================================*/
271  virtual void saveStatistics( STDATA& statistics,
272  int detailLevel = 1) = 0;
273 
274  virtual void saveStatistics( StDataASCII& statistics,
275  int detailLevel = 1) = 0;
276 
277 
278  /*======================================================================*/
288  /*======================================================================*/
289  virtual const std::vector< StDataASCII>& classificationDetailsByUID() const
290  = 0;
291 
292  };
293 
294 }
295 
296 #endif
virtual double classificationDelta() const =0
virtual void setProgressReporter(ProgressReporter *pr)=0
set progress reporter object.
virtual void updateKernelCache()=0
call updateKernelCache() of selected svm with given problem.
virtual void saveParameters(STDATA &stData)=0
store all parameters of the SVM to given mapstructured data
virtual void setStoreClassificationDetailsFlag(bool f)=0
virtual const std::vector< StDataASCII > & classificationDetailsByUID() const =0
get classification details for each uid from last full CV or parital CV.
virtual const PROBLEM * trainingData() const =0
get pointer to training data, that was set with setTrainingData().
virtual void loadParameters(STDATA &stData)=0
Read all parameters (e.g.
virtual bool getStoreClassificationDetailsFlag() const =0
virtual void clearKernelCache()=0
call clearKernelCache() of selected svm.
virtual void setTrainingData(const PROBLEM *problem)=0
set the training data.
virtual void saveStatistics(STDATA &statistics, int detailLevel=1)=0
save cross validation statistics.
virtual void preprocessTrainingData()=0
trains all two-class SVM&#39;s with the whole data set.
virtual int doFullCV(const std::vector< int > &subsetIndexByUID, std::vector< double > &predictedClassLabelByUID)=0
do a full cross validation.
virtual void saveOnlyKernelParameters(StDataASCII &stData)=0
save only Kernel Parameters (this is used for user information and to detect in grid search...
virtual void setClassificationDelta(double d)=0
The StDataASCII class is a container for "structured data", that is kept completly in memory...
Definition: StDataASCII.hh:83