Machine Learning Library
CDatasetStatistic.h
Go to the documentation of this file.
1 /*
2  COPYRIGHT (C) 2003 APPLIED NEUROINFORMATIC GROUP - UNIVERSITY OF BIELEFELD.
3 
4  ALL RIGHTS RESERVED.
5 
6  REDISTRIBUTION AND USE IN SOURCE AND BINARY FORM, WITH OR WITHOUT
7  MODIFICATION, REQUIRE THE PERMISSION OF THE COPYRIGHT HOLDERS.
8 
9  COMMERCIAL USE WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT HOLDERS
10  IS FORBIDDEN
11 
12  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
13  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15  ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
16  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
20  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
21  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 */
23 
24 
25 
26 #ifndef CDATASETSTATISTIC_H
27 #define CDATASETSTATISTIC_H
28 
29 #include "CDenseVector.h"
30 #include "CMatrix.h"
31 #include "CMetric.h"
32 #include "CDataset.h"
33 #include "CDatasetItem.h"
34 #include <vector>
35 #include <algorithm>
36 #include <ctime>
37 #include <iostream>
38 #include "CObject.h"
39 /******************************************************************************/
43 template<class Type>
44 class CDatasetStatistic: public CObject<Type>{
45 private:
46  CDataset<Type>* ptData;
47 
48 public:
49 
50 /*----------------------------------------------------------------------------*/
54  CDatasetStatistic(void);
55 
56 /*----------------------------------------------------------------------------*/
61 
62 /*----------------------------------------------------------------------------*/
67  int inputDimension(void);
68 
69 
70 
72  static CDenseVector<Type> mean(const CDataset<Type>& rtDs, Type tClassLabel);
73 
74 
76  static CDenseVector<Type> mean(const CDataset<Type>& rtDs);
77 
78 
80  static CMatrix<Type> covarianceMatrix(const CDataset<Type>& rtDs, Type tClassLabel);
81 
82 
84  static CMatrix<Type> covarianceMatrix(const CDataset<Type>& rtDs);
85 
86 /*----------------------------------------------------------------------------*/
91  void setData(CDataset<Type>* ptSet);
92 
93  virtual string className() const { return string("CDatasetStatistic");};
94 /*----------------------------------------------------------------------------*/
99  CDataset<Type>* getData(void);
100 
101 /*----------------------------------------------------------------------------*/
107 
108 /*----------------------------------------------------------------------------*/
113  CMatrix<Type> getLDA(void);
114 
115 /*----------------------------------------------------------------------------*/
119  CMatrix<Type> getSW(void);
120 
121 /*----------------------------------------------------------------------------*/
125  CMatrix<Type> getSB(void);
126 
127 /*----------------------------------------------------------------------------*/
133 
134 /*----------------------------------------------------------------------------*/
140 
141 
150  void statistic(CDenseVector<Type>& rtMean,
151  CDenseVector<Type>& rtDeviation,
152  CDenseVector<Type>& rtVariance) const;
153 
154 
165  int statistic(const CDenseVector<Type>& rtPattern,
166  CDenseVector<Type>& rtMean,
167  CDenseVector<Type>& rtDeviation,
168  CDenseVector<Type>& rtVariance) const;
169 
180  CDataset<float>* rankInputSpace(int iSize, CMetric<Type>& rMetric);
181 
202  CDataset<float>* rankMapSpace(int iSize,
203  CDataset<double>& rNodeCoords,
204  CMetric<double>& rMetricMap);
205 
222  float spearman(int iSize,
223  CDataset<double>& rNodeCoords,
224  CMetric<double>& rMetricMap,
225  CMetric<Type>& rMetricData);
226 
230  void dumpStatistic();
231 
232  /*----------------------------------------------------------------------------*/
237 };
238 #endif
float spearman(int iSize, CDataset< double > &rNodeCoords, CMetric< double > &rMetricMap, CMetric< Type > &rMetricData)
CDenseVector< Type > maxElements()
void setData(CDataset< Type > *ptSet)
int inputDimension(void)
CMatrix< Type > getSW(void)
static CDenseVector< Type > mean(const CDataset< Type > &rtDs, Type tClassLabel)
Calculate mean vector of elements in rtDs with class label tClassLabel.
void statistic(CDenseVector< Type > &rtMean, CDenseVector< Type > &rtDeviation, CDenseVector< Type > &rtVariance) const
CDenseVector< Type > minElements()
static CMatrix< Type > covarianceMatrix(const CDataset< Type > &rtDs, Type tClassLabel)
Calculate covariance matrix of elements in rtDs with class label tClassLabel.
Base class for metrix objects.
Definition: CMetric.h:36
Template object implementing a matrix of single and double precision elements.
Definition: CDenseVector.h:38
Definition: CDatasetStatistic.h:44
CMatrix< Type > getLDA(void)
CDataset< float > * rankInputSpace(int iSize, CMetric< Type > &rMetric)
CMatrix< Type > getSB(void)
CDataset< float > * rankMapSpace(int iSize, CDataset< double > &rNodeCoords, CMetric< double > &rMetricMap)
Template object for vectors of single and double precision and integer.
Definition: CDenseVector.h:37
CDataset< Type > * getData(void)
Base class for all object.
Definition: CObject.h:51
CMatrix< Type > getAutoCorrelation(void)
Manages pairs of input and output vectors.
Definition: CDataset.h:110
virtual string className() const
Returns the class name.
Definition: CDatasetStatistic.h:93