Changeset 856 for trunk/yat/statistics/SNRScore.cc
 Timestamp:
 Sep 5, 2007, 2:50:49 PM (15 years ago)
 File:

 1 moved
Legend:
 Unmodified
 Added
 Removed

trunk/yat/statistics/SNRScore.cc
r855 r856 23 23 */ 24 24 25 #include "SNR .h"25 #include "SNRScore.h" 26 26 #include "Averager.h" 27 27 #include "AveragerWeighted.h" … … 36 36 namespace statistics { 37 37 38 SNR ::SNR(bool b)39 : Score(b) , score_(0)38 SNRScore::SNRScore(bool b) 39 : Score(b) 40 40 { 41 41 } 42 42 43 double SNR::score(const classifier::Target& target, 44 const utility::vector& value) 43 SNRScore::~SNRScore(void) 44 { 45 } 46 47 double SNRScore::score(const classifier::Target& target, 48 const utility::vector& value) const 45 49 { 46 50 statistics::Averager positive; … … 54 58 double diff = positive.mean()  negative.mean(); 55 59 double denom=positive.std()+negative.std(); 56 score_=diff/denom;60 double snr=diff/denom; 57 61 if(positive.n()==0  negative.n()==0) 58 s core_=0;59 if (s core_<0 && absolute_)60 s core_=score_;61 return s core_;62 snr=0; 63 if (snr<0 && absolute_) 64 snr=snr; 65 return snr; 62 66 } 63 67 64 double SNR ::score(const classifier::Target& target,65 const classifier::DataLookupWeighted1D& value)68 double SNRScore::score(const classifier::Target& target, 69 const classifier::DataLookupWeighted1D& value) const 66 70 { 67 71 statistics::AveragerWeighted positive; … … 76 80 double denom=positive.std()+negative.std(); 77 81 assert(denom); 78 score_=diff/denom;82 double snr=diff/denom; 79 83 if(positive.sum_w()==0  negative.sum_w()==0) 80 s core_=0;81 if (s core_<0 && absolute_)82 s core_=score_;83 return s core_;84 snr=0; 85 if (snr<0 && absolute_) 86 snr=snr; 87 return snr; 84 88 } 85 89 86 90 87 91 88 double SNR ::score(const classifier::Target& target,92 double SNRScore::score(const classifier::Target& target, 89 93 const utility::vector& value, 90 const utility::vector& weight) 94 const utility::vector& weight) const 91 95 { 92 96 statistics::AveragerWeighted positive; … … 101 105 double denom=positive.std()+negative.std(); 102 106 assert(denom); 103 score_=diff/denom;107 double snr=diff/denom; 104 108 if(positive.sum_w()==0  negative.sum_w()==0) 105 s core_=0;106 if (s core_<0 && absolute_)107 s core_=score_;108 return s core_;109 snr=0; 110 if (snr<0 && absolute_) 111 snr=snr; 112 return snr; 109 113 } 110 114
Note: See TracChangeset
for help on using the changeset viewer.