Sleipnir
|
Encapsulates any similarity (or occasionally distance) measure operating over two vectors. More...
#include <measure.h>
Public Types | |
enum | EMap { EMapNone = 0, EMapCenter = EMapNone + 1, EMapAbs = EMapCenter + 1 } |
Indicates how the result of a measure should be centered. More... | |
Public Member Functions | |
virtual const char * | GetName () const =0 |
Return the human-readable unique identifier of the measure type. | |
virtual bool | IsRank () const =0 |
Return true if the measure requires rank-based integer inputs. | |
virtual IMeasure * | Clone () const =0 |
Create a copy of the current measure object. | |
virtual double | Measure (const float *adX, size_t iN, const float *adY, size_t iM, EMap eMap=EMapNone, const float *adWX=NULL, const float *adWY=NULL) const =0 |
Calculate the measure between two given vectors with optional element weights. |
Encapsulates any similarity (or occasionally distance) measure operating over two vectors.
IMeasures are generally similarity measures consuming two floating point vectors and producing a single continuous result. There are a few distance measures implemented, but since everything in Sleipnir assumes measures to be similarity-based (i.e. higher is closer), several IMeasures exist to reverse distance measures (e.g. CMeasureNegate and CMeasureInvert).
Most measures require input vectors of the same length, but some don't; likewise, most measures will ignore weights for the vector elements if they're provided, but some won't. Most measures will deal appropriately with missing values (NaNs) in their inputs. Many measures support different forms of centering, although some will ignore centering and return the raw measure value. For more information, see EMap.
virtual IMeasure* Sleipnir::IMeasure::Clone | ( | ) | const [pure virtual] |
Create a copy of the current measure object.
Implemented in Sleipnir::CMeasureDice, Sleipnir::CMeasureSignedDistanceCorrelation, Sleipnir::CMeasureDistanceCorrelation, Sleipnir::CMeasurePearsonSignificance, Sleipnir::CMeasureRelativeAUC, Sleipnir::CMeasureMutualInformation, Sleipnir::CMeasureBinaryInnerProduct, Sleipnir::CMeasureInnerProduct, Sleipnir::CMeasureHypergeometric, Sleipnir::CMeasurePearNorm, Sleipnir::CMeasureSpearman, Sleipnir::CMeasureKendallsTau, Sleipnir::CMeasureKolmogorovSmirnov, Sleipnir::CMeasureQuickPearson, Sleipnir::CMeasurePearson, Sleipnir::CMeasureEuclideanScaled, Sleipnir::CMeasureEuclidean, Sleipnir::CMeasureAutocorrelate, Sleipnir::CMeasureInvert, Sleipnir::CMeasureNegate, and Sleipnir::CMeasureSigmoid.
Referenced by Sleipnir::CMeasureSigmoid::Clone(), Sleipnir::CMeasureNegate::Clone(), Sleipnir::CMeasureInvert::Clone(), Sleipnir::CMeasureAutocorrelate::Clone(), and Sleipnir::CPCL::Distance().
virtual const char* Sleipnir::IMeasure::GetName | ( | ) | const [pure virtual] |
Return the human-readable unique identifier of the measure type.
Implemented in Sleipnir::CMeasureDice, Sleipnir::CMeasureSignedDistanceCorrelation, Sleipnir::CMeasureDistanceCorrelation, Sleipnir::CMeasurePearsonSignificance, Sleipnir::CMeasureRelativeAUC, Sleipnir::CMeasureMutualInformation, Sleipnir::CMeasureBinaryInnerProduct, Sleipnir::CMeasureInnerProduct, Sleipnir::CMeasureHypergeometric, Sleipnir::CMeasurePearNorm, Sleipnir::CMeasureSpearman, Sleipnir::CMeasureKendallsTau, Sleipnir::CMeasureKolmogorovSmirnov, Sleipnir::CMeasureQuickPearson, Sleipnir::CMeasurePearson, Sleipnir::CMeasureEuclideanScaled, Sleipnir::CMeasureEuclidean, Sleipnir::CMeasureAutocorrelate, Sleipnir::CMeasureInvert, Sleipnir::CMeasureNegate, and Sleipnir::CMeasureSigmoid.
Referenced by Sleipnir::CPCL::Distance(), Sleipnir::CMeasureSigmoid::GetName(), Sleipnir::CMeasureNegate::GetName(), Sleipnir::CMeasureInvert::GetName(), and Sleipnir::CMeasureAutocorrelate::GetName().
virtual bool Sleipnir::IMeasure::IsRank | ( | ) | const [pure virtual] |
Return true if the measure requires rank-based integer inputs.
Implemented in Sleipnir::CMeasureDice, Sleipnir::CMeasureSignedDistanceCorrelation, Sleipnir::CMeasureDistanceCorrelation, Sleipnir::CMeasurePearsonSignificance, Sleipnir::CMeasureRelativeAUC, Sleipnir::CMeasureMutualInformation, Sleipnir::CMeasureBinaryInnerProduct, Sleipnir::CMeasureInnerProduct, Sleipnir::CMeasureHypergeometric, Sleipnir::CMeasurePearNorm, Sleipnir::CMeasureSpearman, Sleipnir::CMeasureKendallsTau, Sleipnir::CMeasureKolmogorovSmirnov, Sleipnir::CMeasureQuickPearson, Sleipnir::CMeasurePearson, Sleipnir::CMeasureEuclideanScaled, Sleipnir::CMeasureEuclidean, Sleipnir::CMeasureAutocorrelate, Sleipnir::CMeasureInvert, Sleipnir::CMeasureNegate, and Sleipnir::CMeasureSigmoid.
Referenced by Sleipnir::CPCL::Distance(), Sleipnir::CMeasureSigmoid::IsRank(), Sleipnir::CMeasureNegate::IsRank(), Sleipnir::CMeasureInvert::IsRank(), Sleipnir::CMeasureAutocorrelate::IsRank(), and Sleipnir::CDatasetCompact::Open().
virtual double Sleipnir::IMeasure::Measure | ( | const float * | adX, |
size_t | iN, | ||
const float * | adY, | ||
size_t | iM, | ||
EMap | eMap = EMapNone , |
||
const float * | adWX = NULL , |
||
const float * | adWY = NULL |
||
) | const [pure virtual] |
Calculate the measure between two given vectors with optional element weights.
adX | First array of values. |
iN | Length of first array. |
adY | Second array of values. |
iM | Length of second array. |
eMap | Way in which returned value should be centered (implementation-specific). |
adWX | If non-null, weights of elements in the first array. |
adWY | If non-null, weights of elements in the second array. |
Implemented in Sleipnir::CMeasureDice, Sleipnir::CMeasureSignedDistanceCorrelation, Sleipnir::CMeasureDistanceCorrelation, Sleipnir::CMeasurePearsonSignificance, Sleipnir::CMeasureRelativeAUC, Sleipnir::CMeasureMutualInformation, Sleipnir::CMeasureBinaryInnerProduct, Sleipnir::CMeasureInnerProduct, Sleipnir::CMeasureHypergeometric, Sleipnir::CMeasurePearNorm, Sleipnir::CMeasureSpearman, Sleipnir::CMeasureKendallsTau, Sleipnir::CMeasureKolmogorovSmirnov, Sleipnir::CMeasureQuickPearson, Sleipnir::CMeasurePearson, Sleipnir::CMeasureEuclideanScaled, Sleipnir::CMeasureEuclidean, Sleipnir::CMeasureAutocorrelate, Sleipnir::CMeasureInvert, Sleipnir::CMeasureNegate, and Sleipnir::CMeasureSigmoid.
Referenced by Sleipnir::CClustKMeans::Cluster(), Sleipnir::CPCL::Distance(), Sleipnir::CPCL::Impute(), Sleipnir::CMeasureSigmoid::Measure(), Sleipnir::CMeasureNegate::Measure(), Sleipnir::CMeasureInvert::Measure(), Sleipnir::CMeasureAutocorrelate::Measure(), and Sleipnir::CDatasetCompact::Open().