SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CrossValidation.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2011 Heiko Strathmann
8  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
9  */
10 
11 #ifndef __CROSSVALIDATION_H_
12 #define __CROSSVALIDATION_H_
13 
14 #include <shogun/base/SGObject.h>
16 
17 namespace shogun
18 {
19 
20 class CMachine;
21 class CFeatures;
22 class CLabels;
23 class CSplittingStrategy;
24 class CEvaluation;
25 
33 {
34  public:
36  void print_result()
37  {
38  if (has_conf_int)
39  {
40  SG_SPRINT("[%f,%f] with alpha=%f, mean=%f\n", conf_int_low,
42  }
43  else
44  SG_SPRINT("%f\n", mean);
45  }
46 
47  public:
58 
59 };
60 
82 {
83 public:
86 
94  CCrossValidation(CMachine* machine, CFeatures* features, CLabels* labels,
95  CSplittingStrategy* splitting_strategy,
96  CEvaluation* evaluation_criterium);
97 
99  virtual ~CCrossValidation();
100 
103 
112 
114  CMachine* get_machine() const;
115 
117  void set_num_runs(int32_t num_runs);
118 
120  void set_conf_int_alpha(float64_t m_conf_int_alpha);
121 
123  inline virtual const char* get_name() const
124  {
125  return "CrossValidation";
126  }
127 
128 private:
129  void init();
130 
131 protected:
140  virtual float64_t evaluate_one_run();
141 
142 private:
143  int32_t m_num_runs;
144  float64_t m_conf_int_alpha;
145 
146  CMachine* m_machine;
147  CFeatures* m_features;
148  CLabels* m_labels;
149  CSplittingStrategy* m_splitting_strategy;
150  CEvaluation* m_evaluation_criterium;
151 };
152 
153 }
154 
155 #endif /* __CROSSVALIDATION_H_ */

SHOGUN Machine Learning Toolbox - Documentation