iRoCS Toolbox  1.1.0
RequireSVMForCrossValidation.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: 674 $$Name$
28 ** $Date: 2005-03-29 20:04:36 +0200 (Tue, 29 Mar 2005) $
29 ** Copyright: GPL $Author: ronneber $
30 ** Description:
31 **
32 **
33 **
34 **-------------------------------------------------------------------------
35 **
36 ** $Log$
37 ** Revision 1.2 2005/03/29 18:04:36 ronneber
38 ** - added requirement for updateKernelCache() and clearKernelCache()
39 **
40 ** Revision 1.1 2004/08/26 08:36:59 ronneber
41 ** initital import
42 **
43 **
44 **
45 **************************************************************************/
46 #ifndef REQUIRESVMFORCROSSVALIDATION_HH
47 #define REQUIRESVMFORCROSSVALIDATION_HH
48 
49 #ifdef HAVE_CONFIG_H
50 #include <config.hh>
51 #endif
52 
53 #include <vector>
54 #include "RequireHelpers.hh"
55 
56 namespace svt_check
57 {
58 
59  /*======================================================================*/
64  /*======================================================================*/
65  template<typename FV, typename SVM, typename PROBLEM>
67  {
68  public:
70  {
71  if( false)
72  {
73  SVM s;
74  PROBLEM p;
75  s.updateKernelCache(p.FV_begin(), p.FV_end(), svt::DereferencingAccessor());
76  s.clearKernelCache();
77 
78  std::vector<char> leaveOutFlagsByUID;
79 
80  typename SVM::template Traits<FV>::ModelType model;
81  s.train( p, model);
82  s.retrainWithLeftOutVectors( p, model, leaveOutFlagsByUID, model);
83 
84  FV fv;
85  s.classify( fv, model);
86 
87 
88  }
89  }
90  };
91 }
92 
93 
94 #endif
Ensure that SVM provides a typedef for a ModelType, a train( SVM_Problem, ModelType) ...