Changeset 1122
- Timestamp:
- Feb 22, 2008, 6:01:15 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/Makefile.am
r1119 r1122 33 33 ensemble_test feature_selection_test fileutil_test \ 34 34 index_test inputranker_test \ 35 iterator_test kernel_ test kernel_lookup_test \36 knn_test matrix_ test matrix_lookup_test\35 iterator_test kernel_lookup_test kernel_test \ 36 knn_test matrix_lookup_test matrix_test \ 37 37 nbc_test \ 38 38 ncc_test nni_test pca_test regression_test rnd_test roc_test \ -
trunk/yat/statistics/Averager.cc
r1000 r1122 26 26 27 27 #include <cassert> 28 #include <limits> 28 29 29 30 namespace theplu { … … 56 57 double Averager::cv(void) const 57 58 { 58 return x_ ? std()/mean() : 0;59 return std()/mean(); 59 60 } 60 61 61 62 double Averager::mean(void) const 62 63 { 63 return n_ ? x_/n_ : 0;64 return x_/n_; 64 65 } 65 66 … … 113 114 double Averager::variance(double m) const 114 115 { 115 return n_ ? (xx_ - 2*m*x_ + m*m*n()) /n_ : 0;116 return (xx_ - 2*m*x_ + m*m*n()) /n_; 116 117 } 117 118 118 119 double Averager::variance(void) const 119 120 { 120 return n_>1 ? sum_xx_centered()/n_ : 0;121 return sum_xx_centered()/n_; 121 122 } 122 123 123 124 double Averager::variance_unbiased(void) const 124 125 { 125 return (n_>1) ? sum_xx_centered()/(n_-1) : 0; 126 return (n_>1) ? sum_xx_centered()/(n_-1) : 127 std::numeric_limits<double>::quiet_NaN(); 126 128 } 127 129 -
trunk/yat/statistics/Averager.h
r1000 r1122 143 143 double variance(double m) const; 144 144 145 / //146 /// @brief The estimated variance147 ///148 ///The variance is calculated as \f$ \frac{1}{N}\sum_i149 ///(x_i-m)^2 \f$, where \f$ m \f$ is the mean.150 ///151 /// @return Estimation of variance152 ///145 /** 146 \brief The estimated variance 147 148 The variance is calculated as \f$ \frac{1}{N}\sum_i 149 (x_i-m)^2 \f$, where \f$ m \f$ is the mean. 150 151 \return Estimation of variance 152 */ 153 153 double variance(void) const; 154 154 -
trunk/yat/statistics/AveragerPair.cc
r1000 r1122 51 51 double AveragerPair::ccc(void) const 52 52 { 53 return ( (x_.variance() && y_.variance() && (x_.mean()-y_.mean()) ) ? 54 ((2*covariance()) / 55 ((x_.variance()+y_.variance()) + 56 (x_.mean()-y_.mean())*(x_.mean()-y_.mean()))) : 0); 53 return ((2*covariance()) / 54 ((x_.variance()+y_.variance()) + 55 (x_.mean()-y_.mean())*(x_.mean()-y_.mean()))); 57 56 } 58 57 59 58 double AveragerPair::correlation(void) const 60 { return ((x_.std()>0 && y_.std()>0) ? 61 (covariance() / (x_.std()*y_.std()) ) : 0); 59 { return covariance() / std::sqrt(x_.variance()*y_.variance()); 62 60 } 63 61 64 62 double AveragerPair::covariance(void) const 65 63 { 66 return ( n()>1) ? (xy_ - x_.sum_x()*y_.mean()) / n(): 0;64 return (xy_ - x_.sum_x()*y_.mean()) / n(); 67 65 } 68 66 -
trunk/yat/statistics/AveragerPair.h
r1043 r1122 73 73 \f$ \frac{\sum_i (x_i-m_x)(y_i-m_y)}{\sum_i 74 74 (x_i-m_x)^2+\sum_i (y_i-m_y)^2 + n(m_x-m_y)^2} \f$ 75 76 In case of a zero denominator - zero is returned.77 75 78 76 @return Concordence correlation coefficient. -
trunk/yat/statistics/AveragerPairWeighted.cc
r1043 r1122 27 27 #include "AveragerPair.h" 28 28 #include "Averager.h" 29 #include "yat/classifier/DataLookup1D.h"30 #include "yat/classifier/DataLookupWeighted1D.h"31 29 32 30 #include <cassert> … … 63 61 double AveragerPairWeighted::correlation(void) const 64 62 { 65 return ( x_.variance()>0 && y_.variance()>0 ? 66 covariance() / sqrt(x_.variance()*y_.variance()) : 0 ); 63 return covariance() / sqrt(x_.variance()*y_.variance()); 67 64 } 68 65 -
trunk/yat/statistics/AveragerPairWeighted.h
r1088 r1122 37 37 namespace theplu{ 38 38 namespace yat{ 39 namespace classifier{40 class DataLookup1D;41 class DataLookupWeighted1D;42 }43 39 namespace statistics{ 44 40 /// -
trunk/yat/statistics/AveragerWeighted.cc
r1000 r1122 52 52 double AveragerWeighted::mean(void) const 53 53 { 54 return sum_w () ? sum_wx()/sum_w() : 0;54 return sum_wx()/sum_w(); 55 55 } 56 56
Note: See TracChangeset
for help on using the changeset viewer.