 Timestamp:
 Sep 5, 2007, 2:50:49 PM (15 years ago)
 Location:
 trunk/yat/statistics
 Files:

 1 edited
 2 moved
Legend:
 Unmodified
 Added
 Removed

trunk/yat/statistics/Makefile.am
r833 r856 31 31 Euclidean.cc Fisher.cc FoldChange.cc Histogram.cc Pearson.cc \ 32 32 PearsonCorrelation.cc PearsonDistance.cc ROC.cc \ 33 SAMScore.cc Score.cc SNR .cc tScore.cc tTest.cc \33 SAMScore.cc Score.cc SNRScore.cc tScore.cc tTest.cc \ 34 34 utility.cc VectorFunction.cc WilcoxonFoldChange.cc 35 35 … … 41 41 FoldChange.h Histogram.h Pearson.h PearsonCorrelation.h \ 42 42 PearsonDistance.h ROC.h \ 43 SAMScore.h Score.h SNR .h tScore.h tTest.h \43 SAMScore.h Score.h SNRScore.h tScore.h tTest.h \ 44 44 utility.h VectorFunction.h WilcoxonFoldChange.h 
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 
trunk/yat/statistics/SNRScore.h
r855 r856 31 31 32 32 namespace theplu { 33 namespace yat {34 namespace utility {35 class vector;36 }37 namespace classifier {38 class DataLookWeighted1D;39 }40 namespace statistics {33 namespace yat { 34 namespace utility { 35 class vector; 36 } 37 namespace classifier { 38 class DataLookWeighted1D; 39 } 40 namespace statistics { 41 41 42 /** 43 @brief Class for score based on signaltonoise ratio (SNR). 44 45 Also 46 sometimes referred to as Golub score. The score is the ratio 47 between difference in mean and the sum of standard deviations 48 for two groups: \f$ \frac{ m_xm_y}{ s_x + s_y} \f$ where \f$ 49 s \f$ is standard deviation. 50 */ 51 class SNR : public Score 52 { 53 54 public: 55 /// 56 /// @brief Default Constructor. 57 /// 58 SNR(bool absolute=true); 59 60 /** 61 SNR is defined as \f$ \frac{m_xm_y}{s_x+s_y} \f$ where \f$ m 62 \f$ and \f$ s \f$ are mean and standard deviation, 63 respectively. @see Averager 64 65 @return SNR score. If absolute=true absolute value of SNR is 66 returned 67 */ 68 double score(const classifier::Target& target, 69 const utility::vector& value); 70 71 /** 72 SNR is defined as \f$ \frac{m_xm_y}{s_x+s_y} \f$ where \f$ m 73 \f$ and \f$ s \f$ are weighted versions of mean and standard 74 deviation, respectively. @see AveragerWeighted 75 76 @return SNR score. If absolute=true absolute value of SNR is 77 returned 78 */ 79 double score(const classifier::Target& target, 80 const classifier::DataLookupWeighted1D& value); 81 82 /** 83 SNR is defined as \f$ \frac{m_xm_y}{s_x+s_y} \f$ where \f$ m 84 \f$ and \f$ s \f$ are weighted versions of mean and standard 85 deviation, respectively. @see AveragerWeighted 86 87 @return SNR score. If absolute=true absolute value of SNR is 88 returned 89 */ 90 double score(const classifier::Target& target, 91 const utility::vector& value, 92 const utility::vector& weight); 93 private: 94 double score_; 95 }; 96 97 }}} // of namespace statistics, yat, and theplu 42 /** 43 @brief Class for score based on signaltonoise ratio (SNRScore). 44 45 Also 46 sometimes referred to as Golub score. The score is the ratio 47 between difference in mean and the sum of standard deviations 48 for two groups: \f$ \frac{ m_xm_y}{ s_x + s_y} \f$ where \f$ 49 s \f$ is standard deviation. 50 */ 51 class SNRScore : public Score 52 { 53 54 public: 55 /// 56 /// @brief Default Constructor. 57 /// 58 SNRScore(bool absolute=true); 59 60 /// 61 /// @brief The destructor. 62 /// 63 virtual ~SNRScore(void); 64 65 /** 66 SNRScore is defined as \f$ \frac{m_xm_y}{s_x+s_y} \f$ where \f$ m 67 \f$ and \f$ s \f$ are mean and standard deviation, 68 respectively. @see Averager 69 70 @return SNRScore score. If absolute=true absolute value of SNRScore is 71 returned 72 */ 73 double score(const classifier::Target& target, 74 const utility::vector& value) const; 75 76 /** 77 SNRScore is defined as \f$ \frac{m_xm_y}{s_x+s_y} \f$ where \f$ m 78 \f$ and \f$ s \f$ are weighted versions of mean and standard 79 deviation, respectively. @see AveragerWeighted 80 81 @return SNRScore score. If absolute=true absolute value of SNRScore is 82 returned 83 */ 84 double score(const classifier::Target& target, 85 const classifier::DataLookupWeighted1D& value) const; 86 87 /** 88 SNRScore is defined as \f$ \frac{m_xm_y}{s_x+s_y} \f$ where \f$ m 89 \f$ and \f$ s \f$ are weighted versions of mean and standard 90 deviation, respectively. @see AveragerWeighted 91 92 @return SNRScore score. If absolute=true absolute value of SNRScore is 93 returned 94 */ 95 double score(const classifier::Target& target, 96 const utility::vector& value, 97 const utility::vector& weight) const; 98 99 }; 100 101 102 }}} // of namespace statistics, yat, and theplu 98 103 99 104 #endif
Note: See TracChangeset
for help on using the changeset viewer.