Changeset 98 for trunk/src/ROC.cc
- Timestamp:
- Jun 10, 2004, 5:24:05 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ROC.cc
r78 r98 2 2 3 3 // System includes 4 #include <algorithm>5 #include <utility>6 #include <vector>4 //#include <algorithm> 5 //#include <utility> 6 //#include <vector> 7 7 8 8 // Thep C++ Tools … … 16 16 ROC::ROC(const gslapi::vector& target, const gslapi::vector& value) 17 17 18 : value_(), nof_pos_(0), minimum_size_(10)18 : Score(), value_(), nof_pos_(0), minimum_size_(10), area_(-1) 19 19 20 20 … … 33 33 34 34 35 double ROC:: area()35 double ROC::score() 36 36 { 37 37 using namespace std; 38 double area=0; 39 for (unsigned int i=0; i<value_.size(); i++) 40 if (value_[i].first==1) 41 area+=i; 42 // Normalizing the area to 0-1 43 area = (area/nof_pos_ - (nof_pos_ - 1)/2 )/(value_.size() - nof_pos_); 44 45 return area; 38 if (area_==-1){ 39 double area_=0; 40 for (unsigned int i=0; i<value_.size(); i++) 41 if (value_[i].first==1) 42 area_+=i; 43 // Normalizing the area to 0-1 44 area_ = (area_/nof_pos_ - (nof_pos_ - 1)/2 )/(value_.size() - nof_pos_); 45 } 46 return area_; 46 47 } 47 48 48 49 49 double ROC:: get_p(const double area)50 double ROC::p_value(void) 50 51 { 52 if (area_==-1) 53 area_ = score(); 51 54 double p; 52 55 if (nof_pos_ < minimum_size_ & value_.size()-nof_pos_ < minimum_size_) 53 p = get_p_exact(area *nof_pos_*(value_.size()-nof_pos_),56 p = get_p_exact(area_*nof_pos_*(value_.size()-nof_pos_), 54 57 nof_pos_, value_.size()-nof_pos_); 55 58 else 56 p = get_p_approx(area );59 p = get_p_approx(area_); 57 60 return p; 58 61 }
Note: See TracChangeset
for help on using the changeset viewer.