Changeset 102 for trunk/src/ROC.cc
- Timestamp:
- Jun 15, 2004, 11:40:52 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ROC.cc
r98 r102 17 17 18 18 : Score(), value_(), nof_pos_(0), minimum_size_(10), area_(-1) 19 20 19 21 20 { 22 21 for (unsigned int i=0; i<target.size(); i++){ … … 32 31 } 33 32 33 ROC::ROC() 34 : Score(), value_(), nof_pos_(0), minimum_size_(10), area_(-1) 35 36 { 37 } 38 39 40 double ROC::score(const gslapi::vector& target, const gslapi::vector& value) 41 { 42 for (unsigned int i=0; i<target.size(); i++){ 43 int targ=static_cast<int>(target(i)); 44 std::pair<int, double> tmp(targ, value(i)); 45 value_.push_back(tmp); 46 if (targ==1) 47 nof_pos_++; 48 } 49 sort(value_.begin(),value_.end(), 50 pair_value_compare<int,double>()); 51 double area_=0; 52 for (unsigned int i=0; i<value_.size(); i++) 53 if (value_[i].first==1) 54 area_+=i; 55 // Normalizing the area to 0-1 56 area_ = (area_/nof_pos_ - (nof_pos_ - 1)/2 )/(value_.size() - nof_pos_); 57 58 return area_; 59 } 34 60 35 61 double ROC::score() 36 62 { 37 using namespace std;38 63 if (area_==-1){ 39 64 double area_=0; … … 62 87 63 88 64 double ROC::get_p_approx(const double area) 89 double ROC::get_p_approx(const double area) const 65 90 { 66 91 double x = area - 0.5;
Note: See TracChangeset
for help on using the changeset viewer.