Changeset 465 for trunk/lib/statistics/WilcoxonFoldChange.cc
- Timestamp:
- Dec 17, 2005, 12:19:24 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/statistics/WilcoxonFoldChange.cc
r461 r465 1 1 // $Id$ 2 2 3 #include "WilcoxonFoldChange.h" 3 #include <c++_tools/statistics/WilcoxonFoldChange.h> 4 #include <c++_tools/statistics/utility.h> 4 5 5 #include "Score.h" 6 #include "Averager.h" 7 #include "AveragerWeighted.h" 6 #include <cmath> 8 7 9 8 namespace theplu { … … 28 27 train_set_=train_set; 29 28 29 std::vector<double> distance; 30 //Peter, should reserve the vector to avoid reallocations 30 31 weighted_=false; 31 32 for (size_t i=0; i<train_set_.size(); i++) { 33 for (size_t j=0; i<j; j++) { 34 if (target(train_set_[i])==target(train_set_[j])) continue; 35 distance.push_back(value(train_set_[i])-value(train_set_[j])); 36 } 37 } 38 if (absolute_) 39 return fabs(median(distance)); 40 return median(distance); 32 41 } 33 42 … … 37 46 const std::vector<size_t>& train_set) 38 47 { 39 if (!train_set_.size()) 40 for (size_t i=0; i<target_.size(); i++) 41 train_set_.push_back(i); 42 else 43 train_set_=train_set; 44 45 weighted_=true; 48 return 0; 46 49 } 47 50
Note: See TracChangeset
for help on using the changeset viewer.