Sleipnir
Public Member Functions | Static Public Member Functions
Sleipnir::CMeasurePearson Class Reference

Calculates the Pearson correlation between the two vectors. More...

#include <measure.h>

Inheritance diagram for Sleipnir::CMeasurePearson:
Sleipnir::IMeasure

Public Member Functions

const char * GetName () const
 Return the human-readable unique identifier of the measure type.
bool IsRank () const
 Return true if the measure requires rank-based integer inputs.
IMeasureClone () const
 Create a copy of the current measure object.
double Measure (const float *adX, size_t iM, const float *adY, size_t iN, EMap eMap, const float *adWX, const float *adWY) const
 Calculate the measure between two given vectors with optional element weights.

Static Public Member Functions

static double Pearson (const float *adX, size_t iN, const float *adY, size_t iM, EMap eMap, const float *adWX=NULL, const float *adWY=NULL, size_t *piCount=NULL)
 Calculates the Pearson correlation between the vectors.

Detailed Description

Calculates the Pearson correlation between the two vectors.

Calculates Pearson correlation between two vectors; if weights are given, the means and each pairwise product are also multiplied by the appropriate elements' weights. Centering is performed as per EMap.

See also:
CMeasureQuickPearson | CMeasurePearNorm

Definition at line 396 of file measure.h.


Member Function Documentation

IMeasure* Sleipnir::CMeasurePearson::Clone ( ) const [inline, virtual]

Create a copy of the current measure object.

Returns:
Copy of the current measure object.
Remarks:
Caller is, of course, responsible for destroying the created object.

Implements Sleipnir::IMeasure.

Definition at line 409 of file measure.h.

const char* Sleipnir::CMeasurePearson::GetName ( ) const [inline, virtual]

Return the human-readable unique identifier of the measure type.

Returns:
The string identifier of the measure type.

Implements Sleipnir::IMeasure.

Definition at line 401 of file measure.h.

bool Sleipnir::CMeasurePearson::IsRank ( ) const [inline, virtual]

Return true if the measure requires rank-based integer inputs.

Returns:
True if the measure requires rank-based input vectors.
Remarks:
The input vectors for rank measures should contain only floating point values with no fractional part; behavior is undefined if they don't.

Implements Sleipnir::IMeasure.

Definition at line 405 of file measure.h.

double Sleipnir::CMeasurePearson::Measure ( const float *  adX,
size_t  iN,
const float *  adY,
size_t  iM,
EMap  eMap,
const float *  adWX,
const float *  adWY 
) const [inline, virtual]

Calculate the measure between two given vectors with optional element weights.

Parameters:
adXFirst array of values.
iNLength of first array.
adYSecond array of values.
iMLength of second array.
eMapWay in which returned value should be centered (implementation-specific).
adWXIf non-null, weights of elements in the first array.
adWYIf non-null, weights of elements in the second array.
Returns:
Measure calculated between the two input vectors and, optionally, weights.
Remarks:
Pretty much every implementation will puke if given bad input; bounds checking etc. is minimal.

Implements Sleipnir::IMeasure.

Definition at line 413 of file measure.h.

References Pearson().

double Sleipnir::CMeasurePearson::Pearson ( const float *  adX,
size_t  iM,
const float *  adY,
size_t  iN,
EMap  eMap,
const float *  adWX = NULL,
const float *  adWY = NULL,
size_t *  piCount = NULL 
) [static]

Calculates the Pearson correlation between the vectors.

Parameters:
adXFirst array of values.
iNLength of first array.
adYSecond array of values.
iMLength of second array.
eMapWay in which returned value should be centered.
adWXIf non-null, weights of elements in the first array.
adWYIf non-null, weights of elements in the second array.
piCountIf non-null, outputs the number of non-NaN elements used for the calculation.
Returns:
Pearson correlation calculated between the two input vectors and, optionally, weights.

Calculates Pearson correlation between two vectors; if weights are given, the means and each pairwise product are also multiplied by the appropriate elements' weights. Centering is performed as per EMap.

Definition at line 398 of file measure.cpp.

References Sleipnir::IMeasure::EMapAbs, Sleipnir::IMeasure::EMapCenter, Sleipnir::CMeta::GetNaN(), and Sleipnir::CMeta::IsNaN().

Referenced by Measure(), Sleipnir::CMeasurePearNorm::Measure(), Sleipnir::CMeasurePearsonSignificance::Measure(), and Sleipnir::CMeasureSignedDistanceCorrelation::Measure().


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