Changeset 1049
- Timestamp:
- Feb 7, 2008, 3:50:38 PM (16 years ago)
- Location:
- trunk/yat
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/classifier/SVM.cc
r1042 r1049 37 37 #include <cmath> 38 38 #include <limits> 39 #include <sstream> 39 40 #include <stdexcept> 40 41 #include <utility> … … 288 289 } 289 290 calculate_margin(); 290 trained_ = calculate_bias(); 291 calculate_bias(); 292 trained_ = true; 291 293 } 292 294 … … 391 393 } 392 394 393 boolSVM::calculate_bias(void)395 void SVM::calculate_bias(void) 394 396 { 395 397 … … 402 404 403 405 if (!sample_.nof_sv()){ 404 std:: cerr << "SVM::train() error: "405 << "Cannot calculate bias because there is no support vector"406 << std::endl;407 return false;406 std::stringstream ss; 407 ss << "yat::classifier::SVM::train() error: " 408 << "Cannot calculate bias because there is no support vector"; 409 throw std::runtime_error(ss.str()); 408 410 } 409 411 … … 416 418 for (size_t i=0; i<output_.size(); i++) 417 419 output_(i) += bias_; 418 419 return true;420 420 } 421 421 -
trunk/yat/classifier/SVM.h
r1042 r1049 208 208 /// @return true if successful 209 209 /// 210 boolcalculate_bias(void);210 void calculate_bias(void); 211 211 212 212 /// -
trunk/yat/regression/Local.cc
r1015 r1049 32 32 #include <cassert> 33 33 #include <iostream> 34 #include <sstream> 35 #include <stdexcept> 34 36 35 37 namespace theplu { … … 53 55 void Local::fit(const size_t step_size, const size_t nof_points) 54 56 { 55 if (step_size==0 || nof_points<3){ 56 std::cerr << "yat::regression::Local " 57 << "Parameters invalid. Fitting ignored." << std::endl; 58 return; 57 if (step_size==0){ 58 std::stringstream ss; 59 ss << "yat::regression::local: step_size must be larger than zero."; 60 throw std::runtime_error(ss.str()); 61 } 62 if (nof_points<3){ 63 std::stringstream ss; 64 ss << "yat::regression::local: too few data points. " 65 << "At least 3 data points are needed to perform fitting."; 66 throw std::runtime_error(ss.str()); 59 67 } 60 68 -
trunk/yat/statistics/PearsonCorrelation.cc
r1024 r1049 50 50 double PearsonCorrelation::p_value_one_sided() const 51 51 { 52 if(nof_samples_<2){ 53 std::cerr << "Warning: Only " << nof_samples_ << "samples. " 54 << "Need at lest 3.\n"; 52 if(nof_samples_<=2) 55 53 return 1; 56 }57 54 58 55 double t = sqrt(nof_samples_ - 2)*fabs(r_) /sqrt(1-r_*r_);
Note: See TracChangeset
for help on using the changeset viewer.