Changeset 964 for trunk/yat/classifier
- Timestamp:
- Oct 10, 2007, 11:14:17 PM (16 years ago)
- Location:
- trunk/yat/classifier
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/classifier/SVM.cc
r959 r964 37 37 #include <cmath> 38 38 #include <limits> 39 #include <stdexcept> 39 40 #include <utility> 40 41 #include <vector> … … 122 123 sc = new SVM(kernel,target); 123 124 //Copy those variables possible to modify from outside 124 // Peter, in particular C 125 sc->set_C(this->C()); 126 sc->max_epochs(max_epochs()); 125 127 } 126 128 catch (std::bad_cast& e) { … … 137 139 return max_epochs_; 138 140 } 141 142 143 void SVM::max_epochs(long int n) 144 { 145 max_epochs_=n; 146 } 147 139 148 140 149 const theplu::yat::utility::vector& SVM::output(void) const … … 275 284 epochs++; 276 285 if (epochs>max_epochs_){ 277 std::cerr << "WARNING: SVM: maximal number of epochs reached.\n"; 278 calculate_bias(); 279 calculate_margin(); 280 return false; 286 throw std::runtime_error("SVM: maximal number of epochs reached."); 281 287 } 282 288 } -
trunk/yat/classifier/SVM.h
r963 r964 105 105 /// 106 106 long int max_epochs(void) const; 107 108 /* 109 \brief set maximal number of epochs in training 110 */ 111 void max_epochs(long int); 107 112 108 113 /**
Note: See TracChangeset
for help on using the changeset viewer.