BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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>
32 #include <cmath>
34 
35 #include <set>
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 
89 
90  //--- methods for calculating mean, covar, var of matrix-ROWS ---
91 
94  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);
95 
98  static double getRowMean(const vector<vector<double> >& v, int row, std::multiset<int>* features_to_use=0);
99 
102  static double getRowVariance(const vector<vector<double> >& v, int row, double mean=-1, std::multiset<int>* features_to_use=0);
103 
106  static double getRowStddev(const vector<vector<double> >& v, int row, double mean=-1, std::multiset<int>* features_to_use=0);
107 
108  // ------------------------
109 
110 
112  static void centering(BALL::Matrix<double>& m);
113 
115  static void centering(BALL::Matrix<double>& m, int col);
116 
118  static double getMean(const BALL::Matrix<double>& m, int col);
119 
121  static double getVariance(const BALL::Matrix<double>& m, int col, double mean=-1);
122 
124  static double getStddev(const BALL::Matrix<double>& m, int col, double mean=-1);
125 
127  static double getCovariance(const BALL::Matrix<double>& m, int col1, int col2, double mean1=-1, double mean2=-1);
128 
130  static double sq(const BALL::Matrix<double>& m, int col, double mean=-1);
131 
133  static double distance(const BALL::Matrix<double>& m, int& row1, int& row2, double& p);
134 
137  static double distance(const BALL::Matrix<double>& m1, const BALL::Matrix<double>& m2, int& row1, int& row2, double& p);
138 
139 
143  static double distance(const BALL::Matrix<double>& m1, const BALL::Matrix<double>& m2, int& row1, int& row2, String& f, String& g);
144 
145 
148  static double euclDistance(const BALL::Matrix<double>& m1, const BALL::Matrix<double>& m2, int row1, int row2);
149 
151  static double euclNorm(const Vector<double>& cv);
152 
154  static double euclDistance(const Vector<double>& c1, const Vector<double>& c2);
155 
157  static double scalarProduct(const Vector<double>& cv);
159 
160  };
161  }
162 }
163 
164 
165 #endif // STATISTICS