00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef STATISTICS
00027 #define STATISTICS
00028
00029 #include <vector>
00030 #include <iostream>
00031 #include <BALL/MATHS/LINALG/matrix.h>
00032 #include <cmath>
00033 #include <BALL/MATHS/parsedFunction.h>
00034
00035 #include <set>
00036
00037 namespace BALL
00038 {
00039 namespace QSAR
00040 {
00042 class BALL_EXPORT Statistics
00043 {
00044 public:
00049 Statistics(){};
00050
00052 ~Statistics(){};
00054
00055
00056
00061 static void scaling(std::vector<double>& v);
00062
00064 static void scaling(std::vector<std::vector<double> >& m);
00065
00067 static void centering(std::vector<std::vector<double> >& m);
00068
00070 static void centering(std::vector<double>& v);
00071
00075 static void centering(vector<double>& v, double& mean, double& std);
00076
00078 static double getVariance(const std::vector<double>& v, double mean=-1);
00079
00081 static double getStddev(const vector<double>& v, double mean=-1);
00082
00084 static double getCovariance(const vector<double>& v1, const vector<double>& v2, double mean1, double mean2);
00085
00087 static double getMean(const std::vector<double>& v);
00088
00089
00090
00091
00094 static double getRowCovariance(const vector<vector<double> >& v, int row1, int row2, double mean1=-1, double mean2=-1, std::multiset<int>* features_to_use=0);
00095
00098 static double getRowMean(const vector<vector<double> >& v, int row, std::multiset<int>* features_to_use=0);
00099
00102 static double getRowVariance(const vector<vector<double> >& v, int row, double mean=-1, std::multiset<int>* features_to_use=0);
00103
00106 static double getRowStddev(const vector<vector<double> >& v, int row, double mean=-1, std::multiset<int>* features_to_use=0);
00107
00108
00109
00110
00112 static void centering(BALL::Matrix<double>& m);
00113
00115 static void centering(BALL::Matrix<double>& m, int col);
00116
00118 static double getMean(const BALL::Matrix<double>& m, int col);
00119
00121 static double getVariance(const BALL::Matrix<double>& m, int col, double mean=-1);
00122
00124 static double getStddev(const BALL::Matrix<double>& m, int col, double mean=-1);
00125
00127 static double getCovariance(const BALL::Matrix<double>& m, int col1, int col2, double mean1=-1, double mean2=-1);
00128
00130 static double sq(const BALL::Matrix<double>& m, int col, double mean=-1);
00131
00133 static double distance(const BALL::Matrix<double>& m, int& row1, int& row2, double& p);
00134
00137 static double distance(const BALL::Matrix<double>& m1, const BALL::Matrix<double>& m2, int& row1, int& row2, double& p);
00138
00139
00143 static double distance(const BALL::Matrix<double>& m1, const BALL::Matrix<double>& m2, int& row1, int& row2, String& f, String& g);
00144
00145
00148 static double euclDistance(const BALL::Matrix<double>& m1, const BALL::Matrix<double>& m2, int row1, int row2);
00149
00151 static double euclNorm(const Vector<double>& cv);
00152
00154 static double euclDistance(const Vector<double>& c1, const Vector<double>& c2);
00155
00157 static double scalarProduct(const Vector<double>& cv);
00159
00160 };
00161 }
00162 }
00163
00164
00165 #endif // STATISTICS