Changeset 196
- Timestamp:
- Oct 27, 2004, 7:45:04 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ConsensusInputRanker.cc
r152 r196 31 31 } 32 32 // Sorting with respect to median rank 33 theplu::cpptools::Statistics stat;34 33 std::vector<std::pair<size_t,double> > median(data.rows()); 35 34 for (size_t i=0; i<data.rows(); i++){ … … 39 38 40 39 median[i].first = i; 41 median[i].second = stat .median(ranks);40 median[i].second = statistics::median(ranks); 42 41 } 43 42 … … 70 69 71 70 // Sorting with respect to median rank 72 theplu::cpptools::Statistics stat;73 71 std::vector<std::pair<size_t,double> > median(data.rows()); 74 72 for (size_t i=0; i<data.rows(); i++){ … … 77 75 ranks[j]=input_rankers_[j].rank(i); 78 76 median[i].first = i; 79 median[i].second = stat .median(ranks);77 median[i].second = statistics::median(ranks); 80 78 } 81 79 -
trunk/src/Fisher.cc
r187 r196 45 45 // the matrix. 46 46 if (a_<b_ && a_<c_ && a_<d_) 47 return Statistics().cdf_hypergeometric_P(a_,a_+b_,c_+d_,a_+c_);47 return statistics::cdf_hypergeometric_P(a_,a_+b_,c_+d_,a_+c_); 48 48 else if (b_<a_ && b_<c_ && b_<d_) 49 return Statistics().cdf_hypergeometric_P(b_,a_+b_,c_+d_,b_+d_);49 return statistics::cdf_hypergeometric_P(b_,a_+b_,c_+d_,b_+d_); 50 50 else if (c_<a_ && c_<b_ && c_<d_) 51 return Statistics().cdf_hypergeometric_P(c_,c_+d_,a_+b_,a_+c_);51 return statistics::cdf_hypergeometric_P(c_,c_+d_,a_+b_,a_+c_); 52 52 else 53 return Statistics().cdf_hypergeometric_P(d_,c_+d_,a_+b_,b_+d_);53 return statistics::cdf_hypergeometric_P(d_,c_+d_,a_+b_,b_+d_); 54 54 } 55 55 -
trunk/src/Makefile.am
r195 r196 13 13 InputRanker.cc \ 14 14 Kernel.cc kNNI.cc matrix.cc Merge.cc NNI.cc PCA.cc \ 15 PolynomialKernelFunction.cc random_singleton.cc 15 PolynomialKernelFunction.cc random_singleton.cc \ 16 16 RegressionLinear.cc ROC.cc Score.cc Statistics.cc \ 17 17 SVD.cc SVM.cc tScore.cc vector.cc WeightedAverager.cc WeNNI.cc -
trunk/src/RegressionLinear.cc
r193 r196 9 9 10 10 namespace theplu { 11 namespace cpptools {11 namespace statistics { 12 12 13 13 … … 17 17 } 18 18 19 RegressionLinear::fit(gslapi::vector x_vec, gslapi::vector y_vec)20 {21 int tmp gsl_fit_linear(x, 1, y, 1, n, &k_, &m_,22 &cov00_, &cov01_, &cov11_, &sumsq_)23 \24 19 25 } 26 27 RegressionLinear::fit_weighted(gslapi::vector x, gslapi::vector y, 28 gslapi::vector w) 29 { 30 31 } 32 33 34 }} // of namespace cpptools and namespace theplu 20 }} // of namespace statistics and namespace theplu -
trunk/src/RegressionLinear.h
r193 r196 40 40 /// \f$. 41 41 /// 42 inline void fit(const gslapi::vector& x, const gslapi::vector& y) 43 {int tmp = gsl_fit_linear_vector(&x, &y, &m_, &k_, 44 &cov00_, &cov01_, &cov11, &sumsq);} 42 inline int fit(const gslapi::vector& x, const gslapi::vector& y) 43 { return gsl_fit_linear_vector(x.gsl_vector_pointer(), 44 y.gsl_vector_pointer(), &m_, &k_, 45 &cov00_, &cov01_, &cov11_, &sumsq_); } 45 46 46 47 /// … … 51 52 /// \f$ y_i \f$ 52 53 /// 53 void fit_weigted(gslapi::vector x, gslapi::vector y, gslapi::vector w); 54 {int tmp = gsl_fit_wlinear_vector(&x, &w, &y, &m_, &k_, 55 &cov00_, &cov01_, &cov11, &sumsq);} 54 inline int fit_weigted(gslapi::vector x, gslapi::vector y, gslapi::vector w) 55 { return gsl_fit_wlinear_vector(x.gsl_vector_pointer(), 56 w.gsl_vector_pointer(), 57 y.gsl_vector_pointer(), &m_, &k_, 58 &cov00_, &cov01_, &cov11_, &sumsq_); } 56 59 57 60 private: -
trunk/src/Statistics.cc
r186 r196 15 15 16 16 namespace theplu { 17 namespace cpptools { 18 19 Statistics::Statistics(void) 20 21 { 22 } 17 namespace statistics { 23 18 24 19 double cdf_hypergeometric_P(u_int k, u_int n1, u_int n2, u_int t) … … 31 26 32 27 33 double Statistics::median(std::vector<double>& vec)28 double median(std::vector<double>& vec) 34 29 { 35 30 return percentile(vec, 50.0); 36 31 } 37 32 38 double Statistics::median(std::vector<size_t>& vec)33 double median(std::vector<size_t>& vec) 39 34 { 40 35 return percentile(vec, 50.0); 41 36 } 42 37 43 double Statistics::percentile(std::vector<double>& vec, double percentile)38 double percentile(std::vector<double>& vec, double percentile) 44 39 { 45 40 if (percentile==100) … … 53 48 } 54 49 55 double Statistics::percentile(std::vector<size_t>& vec, double percentile)50 double percentile(std::vector<size_t>& vec, double percentile) 56 51 { 57 52 if (percentile==100) … … 67 62 68 63 69 }} // of namespace cpptools and namespace theplu64 }} // of namespace statistics and namespace theplu -
trunk/src/Statistics.h
r186 r196 12 12 13 13 namespace theplu { 14 namespace cpptools { 15 16 /// 17 /// Class for basic statistics 18 /// 19 class Statistics 20 { 21 22 public: 23 /// 24 /// Constructor 25 /// 26 Statistics(); 14 // Jari, this should probably go somewhere else for doxygen to process. 15 /// 16 /// Statistics functions should go into the statistics namespace 17 /// 18 /// \brief Container for statistics functions 19 /// 20 namespace statistics { 27 21 28 22 /// … … 81 75 double percentile(std::vector<size_t>&, double i); 82 76 83 private: 84 85 86 }; 87 88 }} // of namespace cpptools and namespace theplu 77 }} // of namespace statistics and namespace theplu 89 78 90 79 #endif -
trunk/test/test_kernel.cc
r164 r196 1 1 // $Id$ 2 2 3 4 #ifndef _THEP_CPPTOOLS_SVM_5 #define _THEP_CPPTOOLS_SVM_6 3 7 4 // C++ tools include … … 14 11 // Standard includes 15 12 //////////////////// 13 #include <cmath> 16 14 #include <fstream> 17 15 #include <iostream> … … 65 63 return -1; 66 64 } 67 68 69 70 #endif71 72 73 74 75 -
trunk/test/test_nni.cc
r175 r196 1 1 // $Id$ 2 2 3 #include <cmath> 3 4 #include <iostream> 4 5 #include <fstream> -
trunk/test/test_roc.cc
r156 r196 11 11 //////////////////// 12 12 #include <gsl/gsl_cdf.h> 13 #include <cmath> 13 14 #include <fstream> 14 15 #include <iostream> -
trunk/test/test_statistics.cc
r116 r196 17 17 { 18 18 std::vector<double> data; 19 theplu::cpptools::Statistics stat;20 19 for (unsigned int i=0; i<10; i++) 21 20 data.push_back(static_cast<double>(i)); 22 double m= stat.median(data);21 double m=theplu::statistics::median(data); 23 22 if (m!=4.5) 24 23 return -1;
Note: See TracChangeset
for help on using the changeset viewer.