BALL  1.4.79
statistics.h
Go to the documentation of this file.
1 /* statistics.h
2  *
3  * Copyright (C) 2009 Marcel Schumann
4  *
5  * This file is part of QuEasy -- A Toolbox for Automated QSAR Model
6  * Construction and Validation.
7  * QuEasy is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or (at
10  * your option) any later version.
11  *
12  * QuEasy is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 // -*- Mode: C++; tab-width: 2; -*-
22 // vi: set ts=2:
23 //
24 //
25 
26 #ifndef STATISTICS
27 #define STATISTICS
28 
29 #include <vector>
30 #include <iostream>
31 #include <cmath>
33 
34 #include <set>
35 #include <Eigen/Core>
36 
37 namespace BALL
38 {
39  namespace QSAR
40  {
43  {
44  public:
50 
54 
55 
56 
61  static void scaling(std::vector<double>& v);
62 
64  static void scaling(std::vector<std::vector<double> >& m);
65 
67  static void centering(std::vector<std::vector<double> >& m);
68 
70  static void centering(std::vector<double>& v);
71 
75  static void centering(vector<double>& v, double& mean, double& std);
76 
78  static double getVariance(const std::vector<double>& v, double mean=-1);
79 
81  static double getStddev(const vector<double>& v, double mean=-1);
82 
84  static double getCovariance(const vector<double>& v1, const vector<double>& v2, double mean1, double mean2);
85 
87  static double getMean(const std::vector<double>& v);
88 
90  static double calculateRankCorrelation(vector<double>& observed_values, vector<double>& expected_values);
91  //--- methods for calculating mean, covar, var of matrix-ROWS ---
92 
95  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);
96 
99  static double getRowMean(const vector<vector<double> >& v, int row, std::multiset<int>* features_to_use=0);
100 
103  static double getRowVariance(const vector<vector<double> >& v, int row, double mean=-1, std::multiset<int>* features_to_use=0);
104 
107  static double getRowStddev(const vector<vector<double> >& v, int row, double mean=-1, std::multiset<int>* features_to_use=0);
108 
109  // ------------------------
110 
111 
113  static void centering(Eigen::MatrixXd& m);
114 
116  static void centering(Eigen::MatrixXd& m, int col);
117 
119  static double getMean(const Eigen::MatrixXd& m, int col);
120 
122  static double getVariance(const Eigen::MatrixXd& m, int col, double mean=-1);
123 
125  static double getStddev(const Eigen::MatrixXd& m, int col, double mean=-1);
126 
128  static double getCovariance(const Eigen::MatrixXd& m, int col1, int col2, double mean1=-1, double mean2=-1);
129 
131  static double sq(const Eigen::MatrixXd& m, int col, double mean=-1);
132 
134  static double distance(const Eigen::MatrixXd& m, int& row1, int& row2, double& p);
135 
138  static double distance(const Eigen::MatrixXd& m1, const Eigen::MatrixXd& m2, int& row1, int& row2, double& p);
139 
140 
144  static double distance(const Eigen::MatrixXd& m1, const Eigen::MatrixXd& m2, int& row1, int& row2, String& f, String& g);
145 
146 
149  static double euclDistance(const Eigen::MatrixXd& m1, const Eigen::MatrixXd& m2, int row1, int row2);
150 
152  static double euclNorm(const Eigen::VectorXd& cv);
153 
155  static double euclDistance(const Eigen::VectorXd& c1, const Eigen::VectorXd& c2);
156 
158  static double scalarProduct(const Eigen::VectorXd& cv);
160 
161  };
162  }
163 }
164 
165 
166 #endif // STATISTICS
static double getCovariance(const list< double > &v1, const list< double > &v2, double mean1, double mean2)
STL namespace.
static double getMean(const list< double > &v)
static double getStddev(const list< double > &m, double mean)
-*- Mode: C++; tab-width: 2; -*-
Definition: constants.h:12
#define BALL_EXPORT
Definition: COMMON/global.h:50