yat  0.14.5pre
Public Member Functions | List of all members
theplu::yat::statistics::PearsonDistance Struct Reference

Calculates the Pearson correlation distance between two points given by elements of ranges. More...

#include <yat/statistics/PearsonDistance.h>

Public Member Functions

template<typename ForwardIterator1 , typename ForwardIterator2 >
double operator() (ForwardIterator1 beg1, ForwardIterator1 end1, ForwardIterator2 beg2) const
 Calculates the Pearson correlation distance between elements of two ranges. More...
 

Detailed Description

Calculates the Pearson correlation distance between two points given by elements of ranges.

This class is modelling the concept Distance.

Member Function Documentation

template<typename ForwardIterator1 , typename ForwardIterator2 >
double theplu::yat::statistics::PearsonDistance::operator() ( ForwardIterator1  beg1,
ForwardIterator1  end1,
ForwardIterator2  beg2 
) const
inline

Calculates the Pearson correlation distance between elements of two ranges.

If elements of both ranges are unweighted the distance is calculated as $ 1-\mbox{C}(x,y) $, where $ x $ and $ y $ are the two points and C is the Pearson correlation.

If elements of one or both of ranges have weights the distance is calculated as $ 1-[\sum w_{x,i}w_{y,i}(x_i-y_i)^2/(\sum w_{x,i}w_{y,i}(x_i-m_x)^2\sum w_{x,i}w_{y,i}(y_i-m_y)^2)] $, where and $ w_x $ and $ w_y $ are weights for the elements of the first and the second range, respectively, and $ m_x=\sum w_{x,i}w_{y,i}x_i/\sum w_{x,i}w_{y,i} $ and correspondingly for $ m_y $. If the elements of one of the two ranges are unweighted, the weights for these elements are set to unity.


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

Generated on Tue Sep 26 2017 02:33:30 for yat by  doxygen 1.8.5