SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Machine.cpp
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) 1999-2009 Soeren Sonnenburg
8  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  */
10 
11 #include <shogun/machine/Machine.h>
12 #include <shogun/base/Parameter.h>
14 
15 using namespace shogun;
16 
17 CMachine::CMachine() : CSGObject(), max_train_time(0), labels(NULL),
18  solver_type(ST_AUTO)
19 {
20  m_parameters->add(&max_train_time, "max_train_time",
21  "Maximum training time.");
22  m_parameters->add((machine_int_t*) &solver_type, "solver_type");
23  m_parameters->add((CSGObject**) &labels, "labels");
24  m_parameters->add(&m_store_model_features, "store_model_features",
25  "Should feature data of model be stored after training?");
26 
28 }
29 
31 {
33 }
34 
36 {
37  bool result = train_machine(data);
38 
41 
42  return result;
43 }
44 
46 {
48  return CMath::INFTY;
49 }
50 
51 bool CMachine::load(FILE* srcfile)
52 {
53  ASSERT(srcfile);
54  return false;
55 }
56 
57 bool CMachine::save(FILE* dstfile)
58 {
59  ASSERT(dstfile);
60  return false;
61 }
62 
64 {
66  SG_REF(lab);
67  labels = lab;
68 }
69 
71 {
72  SG_REF(labels);
73  return labels;
74 }
75 
77 {
78  if (!labels)
79  SG_ERROR("No Labels assigned\n");
80 
81  return labels->get_label(i);
82 }
83 
85 {
86  max_train_time = t;
87 }
88 
90 {
91  return max_train_time;
92 }
93 
95 {
96  return CT_NONE;
97 }
98 
100 {
101  solver_type = st;
102 }
103 
105 {
106  return solver_type;
107 }
108 
110 {
111  m_store_model_features = store_model;
112 }
113 
114 

SHOGUN Machine Learning Toolbox - Documentation