yat  0.12.3pre
Public Member Functions | Protected Attributes | List of all members
theplu::yat::statistics::Pearson Class Reference

Class for calculating Pearson correlation. More...

#include <yat/statistics/Pearson.h>

Inheritance diagram for theplu::yat::statistics::Pearson:
theplu::yat::statistics::Score

Public Member Functions

 Pearson (bool absolute=true)
 The default constructor.
 
virtual ~Pearson (void)
 The destructor.
 
double score (const classifier::Target &target, const utility::VectorBase &value) const
 
double score (const classifier::Target &target, const classifier::DataLookupWeighted1D &value) const
 
double score (const classifier::Target &target, const utility::VectorBase &value, const utility::VectorBase &weight) const
 
void absolute (bool absolute)
 Function changing mode of Score.
 
virtual double score (const classifier::Target &target, const classifier::DataLookup1D &value) const
 
double score (const classifier::Target &target, const classifier::DataLookup1D &value, const classifier::DataLookup1D &weight) const
 

Protected Attributes

bool absolute_
 

Detailed Description

Class for calculating Pearson correlation.

Member Function Documentation

double theplu::yat::statistics::Pearson::score ( const classifier::Target target,
const utility::VectorBase value 
) const
virtual

$ \frac{\vert \sum_i(x_i-\bar{x})(y_i-\bar{y})\vert }{\sqrt{\sum_i (x_i-\bar{x})^2\sum_i (x_i-\bar{x})^2}} $.

Returns
Pearson correlation, if absolute=true absolute value of Pearson is used.

Implements theplu::yat::statistics::Score.

double theplu::yat::statistics::Pearson::score ( const classifier::Target target,
const classifier::DataLookupWeighted1D value 
) const
virtual

$ \frac{\vert \sum_iw^2_i(x_i-\bar{x})(y_i-\bar{y})\vert } {\sqrt{\sum_iw^2_i(x_i-\bar{x})^2\sum_iw^2_i(y_i-\bar{y})^2}} $, where $ m_x = \frac{\sum w_ix_i}{\sum w_i} $ and $ m_x = \frac{\sum w_ix_i}{\sum w_i} $. This expression is chosen to get a correlation equal to unity when x and y are equal.

Returns
absolute value of weighted version of Pearson correlation.

Reimplemented from theplu::yat::statistics::Score.

virtual double theplu::yat::statistics::Score::score ( const classifier::Target target,
const classifier::DataLookup1D value 
) const
virtualinherited

Function calculating the score. In absolute mode, also the score using negated class labels is calculated, and the largest of the two scores are calculated.

value is copied to a utility::vector and that operator is called. If speed is important this operator should be implemented in inherited class to avoid copying.

Returns
score
double theplu::yat::statistics::Pearson::score ( const classifier::Target target,
const utility::VectorBase value,
const utility::VectorBase weight 
) const
virtual

$ \frac{\vert \sum_iw^2_i(x_i-\bar{x})(y_i-\bar{y})\vert } {\sqrt{\sum_iw^2_i(x_i-\bar{x})^2\sum_iw^2_i(y_i-\bar{y})^2}} $, where $ m_x = \frac{\sum w_ix_i}{\sum w_i} $ and $ m_x = \frac{\sum w_ix_i}{\sum w_i} $. This expression is chosen to get a correlation equal to unity when x and y are equal.

Returns
absolute value of weighted version of Pearson correlation.

Implements theplu::yat::statistics::Score.

double theplu::yat::statistics::Score::score ( const classifier::Target target,
const classifier::DataLookup1D value,
const classifier::DataLookup1D weight 
) const
inherited

Function calculating the weighted version of score. In absolute mode, also the score using negated class labels is calculated, and the largest of the two scores are calculated. Absolute mode should be used when two-tailed test is wanted.

value and weight are copied to utility::vector and the corresponding operator is called. If speed is important this operator should be implemented in inherited class to avoid copying.

Member Data Documentation

bool theplu::yat::statistics::Score::absolute_
protectedinherited

true if method is absolute, which means if score is below expected value (by chance) E, score returns E-score+E instead.


The documentation for this class was generated from the following file:

Generated on Mon Jun 1 2015 12:29:53 for yat by  doxygen 1.8.5