Leaper Vision Toolkit
Data Structures | Enumerations
LPVMathLib Module Reference

LPV Math& Data analysis Library, provide mathematics and data analysis functionalities. More...

Data Structures

interface  ILDataBlob
 This interface holds single data blob and provide functionalities to access the data blob's properties. More...
 
interface  ILDataBlobAnalysis
 This interface provide functionalities of data blob analysis. More...
 
interface  ILDataBlobFilter
 This interface provide functionalities of data blob filtering. More...
 
interface  ILDataBlobResults
 This interface holds a collection of data blob results. More...
 
interface  ILDataList
 This interface defines a data list for metric calculation, filtering and analysis. More...
 
class  LDataBlob
 
class  LDataBlobAnalysis
 
class  LDataBlobFilter
 
class  LDataBlobResults
 
class  LDataList
 

Enumerations

enum  LPVDataBlobFeatures { LPVDataBlobPosition = 0 , LPVDataBlobWidth = 1 , LPVDataBlobData = 2 }
 This enumeration represents the numeric features of the data blob. More...
 
enum  LPVDistanceType {
  LPVDistanceL1 = 0 , LPVDistanceL2 = 1 , LPVDistanceLInf = 2 , LPVDistanceLp = 3 ,
  LPVDistanceCosine = 4 , LPVDistanceCorrelation = 5 , LPVDistanceCanberra = 6 , LPVDistanceBrayCurtis = 7
}
 This enumeration represents the distance metric between two numeric vectors. Smaller value usually means the vectors are more similar. More...
 
enum  LPVDistributionType {
  LPVDistributionIntersection = 0 , LPVDistributionChiSquare = 1 , LPVDistributionChiSquareAlt = 2 , LPVDistributionHellinger = 3 ,
  LPVDistributionCorrelation = 4 , LPVDistributionBhattacharyya = 5 , LPVDistributionKLDivergence = 6 , LPVDistributionJensenShannon = 7 ,
  LPVDistributionTotalVariation = 8 , LPVDistributionEMD = 9
}
 This enumeration represents the metric between two histograms or probability distributions. More...
 
enum  LPVSimilarityType { LPVSimilarityCosine = 0 , LPVSimilarityPearson = 1 , LPVSimilaritySpearman = 2 , LPVSimilarityKendall = 3 }
 This enumeration represents the similarity or correlation metric between two numeric vectors. Larger value usually means the vectors are more similar. More...
 

Detailed Description

LPV Math& Data analysis Library, provide mathematics and data analysis functionalities.

This library provides miscellaneous functions for data calculation, filtering, aggregation and display. To include the definitions of the library's classes, use the following directive:

Example Code

Enumeration Type Documentation

◆ LPVDataBlobFeatures

This enumeration represents the numeric features of the data blob.

Enumerator
LPVDataBlobPosition 

Position of the data blob, it's the index of its middle point

LPVDataBlobWidth 

Width of the data blob

LPVDataBlobData 

Data metrics of the data blob, calculated based on the specified aggregation type

◆ LPVDistanceType

This enumeration represents the distance metric between two numeric vectors. Smaller value usually means the vectors are more similar.

In the equations below, A and B are the two vectors to compare.

Enumerator
LPVDistanceL1 

L1 distance, aka. Manhattan distance: \( \sum_{i}{\left|a_i - b_i\right|} \)

LPVDistanceL2 

L2 distance, aka. Euclidean distance: \( \sqrt{\sum_{i}{\left(a_i - b_i\right)^2}} \)

LPVDistanceLInf 

L-infinity distance, aka. Chebyshev distance: \( \max_{i}{\left|a_i - b_i\right|} \)

LPVDistanceLp 

Minkowski distance with the given exponent \( p \ge 1 \) , p is the Minkowski exponent: \( \left(\sum_{i}{\left|a_i - b_i\right|^p}\right)^{1/p} \)

LPVDistanceCosine 

Cosine distance: \( 1 - \frac{A \cdot B}{\left\|A\right\| \left\|B\right\|} \)

LPVDistanceCorrelation 

Correlation distance, one minus the Pearson correlation coefficient: \( 1 - \rho\left(A, B\right) \)

LPVDistanceCanberra 

Canberra distance: \( \sum_{i}{\frac{\left|a_i - b_i\right|}{\left|a_i\right| + \left|b_i\right|}} \)

LPVDistanceBrayCurtis 

Bray-Curtis distance, commonly used for non-negative data: \( \frac{\sum_{i}{\left|a_i - b_i\right|}}{\sum_{i}{\left|a_i + b_i\right|}} \)

◆ LPVDistributionType

This enumeration represents the metric between two histograms or probability distributions.

In the equations below, A and B are the two distributions to compare, ai and bi are the values of their ith bins.

Note
Hellinger, Bhattacharyya, KLDivergence and JensenShannon assume non-negative, normalized (probability) inputs, no automatic normalization is performed.
Enumerator
LPVDistributionIntersection 

Histogram intersection: \( \sum_{i}{\min\left(a_i, b_i\right)} \)

LPVDistributionChiSquare 

Pearson's chi-square statistic using the first distribution as denominator (asymmetric): \( \sum_{i}{\frac{\left(a_i - b_i\right)^2}{a_i}} \)

LPVDistributionChiSquareAlt 

Symmetric chi-square variant: \( 2\sum_{i}{\frac{\left(a_i - b_i\right)^2}{a_i + b_i}} \)

LPVDistributionHellinger 

Hellinger distance: \( \sqrt{1 - \sum_{i}{\sqrt{a_i b_i}}} \)

LPVDistributionCorrelation 

Pearson correlation coefficient between the bins: \( \rho\left(A, B\right) \)

LPVDistributionBhattacharyya 

Bhattacharyya distance: \( -\ln{\left(\sum_{i}{\sqrt{a_i b_i}}\right)} \)

LPVDistributionKLDivergence 

Kullback-Leibler divergence \( D_{KL}\left(A \| B\right) \) , the terms with non-positive ai or bi contribute 0: \( \sum_{i}{a_i \ln{\frac{a_i}{b_i}}} \)

LPVDistributionJensenShannon 

Jensen-Shannon divergence, symmetric and smoothed KL divergence: \( \frac{1}{2}D_{KL}\left(A \| M\right) + \frac{1}{2}D_{KL}\left(B \| M\right), M = \frac{A + B}{2} \)

LPVDistributionTotalVariation 

Total variation distance: \( \frac{1}{2}\sum_{i}{\left|a_i - b_i\right|} \)

LPVDistributionEMD 

Earth Mover's Distance, aka. the 1D Wasserstein-1 distance, it is the minimal work to transform one distribution into the other: \( \min_{\gamma \in \Pi\left(A, B\right)}{\sum_{i,j}{\gamma_{ij}\left|i - j\right|}} \)

◆ LPVSimilarityType

This enumeration represents the similarity or correlation metric between two numeric vectors. Larger value usually means the vectors are more similar.

In the equations below, A and B are the two vectors to compare.

Enumerator
LPVSimilarityCosine 

Cosine similarity: \( \frac{A \cdot B}{\left\|A\right\| \left\|B\right\|} \)

LPVSimilarityPearson 

Pearson correlation coefficient, the linear correlation after mean removal: \( \rho\left(A, B\right) \)

LPVSimilaritySpearman 

Spearman rank correlation coefficient, the Pearson correlation coefficient of the ranks: \( \rho\left(R\left(A\right), R\left(B\right)\right) \)

LPVSimilarityKendall 

Kendall rank correlation coefficient (tau-a), C and D are the counts of concordant and discordant pairs, n is the count of the values, the ties are not counted: \( \frac{C - D}{n\left(n - 1\right)/2} \)