public final class RelationalDistances extends Object
This is a helper class for the computation of distances between data points and convex combinations. As demonstrated in Hasenfuss and Hammer (2009), if a prototype wk is given in terms of a convex combination
wk = Σi=1,...,m αk, i · xi
were all convex coefficients αk, i are non-negative and
Σi=1,...,m αk, i = 1
we obtain for all i:
d(wk, xi)² = αk · D(:, i)² - 0.5 · αk · D² · αkT
| Modifier and Type | Method and Description |
|---|---|
protected static double[][] |
getDistancesToPrototypes(double[][] D,
double[][] Alpha,
double[] Z)
Calculates the squared distances of n data points to all prototypes, based on the
distances from the test to the training data D, the normalization terms for each prototype
Z, and the convex coefficients representing the prototypes Alpha.
|
static double[][] |
getDistancesToPrototypes(double[][] D,
RNGModel model)
Calculates the squared distances of n data points to all prototypes, based on the
distances from the test to the training data D and a relational neural gas model.
|
protected static double[] |
getDistancesToPrototypes(double[] d,
double[][] Alpha,
double[] Z)
Calculates the squared distances of data point to all prototypes, based on the
distances to the training data d, the normalization terms for each prototype
Z, and the convex coefficients representing the prototypes Alpha.
|
static double[] |
getDistancesToPrototypes(double[] d,
RNGModel model)
Calculates the squared distances of a data point to all prototypes, based on the
distances to the training data d and a relational neural gas model.
|
protected static double[] |
getNormalizationTerms(double[][] D,
double[][] Alpha)
Computes the normalization terms
|
public static double[][] getDistancesToPrototypes(double[][] D,
RNGModel model)
Calculates the squared distances of n data points to all prototypes, based on the distances from the test to the training data D and a relational neural gas model.
D - The n x m distance matrix from test data points to training data points.model - a RNGModel.public static double[] getDistancesToPrototypes(double[] d,
RNGModel model)
Calculates the squared distances of a data point to all prototypes, based on the distances to the training data d and a relational neural gas model.
d - The 1 x m vector of distances from the data point to all training data points.model - a RNGModel.protected static double[][] getDistancesToPrototypes(double[][] D,
double[][] Alpha,
double[] Z)
Calculates the squared distances of n data points to all prototypes, based on the distances from the test to the training data D, the normalization terms for each prototype Z, and the convex coefficients representing the prototypes Alpha. In particular, let m be the number of training data points and K be the number of prototypes. Then, the output is a n x K matrix Dp, where
Dp[j][k] = Σi=1,...,m Alpha[k][i] · D[j][i]² + Z[k] - 0.5 * Alpha[k] · D_train² · Alpha[k]T
D - The n x m distance matrix from test data points to training data points.Alpha - The prototypes given as a K x m matrix of convex coefficients.Z - The K x 1 vector of normalization terms for each prototype, meaning prototype k
contains
- 0.5 * Alpha[k] · D_train² · Alpha[k]T
where D_train is the matrix of pairwise distances for the training data points.protected static double[] getDistancesToPrototypes(double[] d,
double[][] Alpha,
double[] Z)
Calculates the squared distances of data point to all prototypes, based on the distances to the training data d, the normalization terms for each prototype Z, and the convex coefficients representing the prototypes Alpha. In particular, let m be the number of training data points and K be the number of prototypes. Then, the output is a 1 x K vector dp, where
dp[k] = Σi=1,...,m Alpha[k][i] · d[i]² + Z[k] - 0.5 * Alpha[k] · D_train² · Alpha[k]T
d - The 1 x m vector of distances from the data point to all training data points.Alpha - The prototypes given as a K x m matrix of convex coefficients.Z - The K x 1 vector of normalization terms for each prototype, meaning prototype k
contains
- 0.5 * Alpha[k] · D_train² · Alpha[k]T
where D_train is the matrix of pairwise distances for the training data points.protected static double[] getNormalizationTerms(double[][] D,
double[][] Alpha)
Computes the normalization terms
-0.5 * Alpha[k] · D² · Alpha[k]T
for all prototypes k, where Alpha[k] are the convex coefficients representing prototype k and D² is the matrix of squared distances for all training data points.
D - a m x m matrix of distances for all training data points.Alpha - The prototypes given as a K x m matrix of convex coefficients.Copyright (C) 2015-2017 Benjamin Paaßen, AG Machine Learning, Centre of Excellence Cognitive Interaction Technology (CITEC), University of Bielefeld, licensed under the GPL v. 3: https://gitlab.ub.uni-bielefeld.de/bpaassen/relational_neural_gas . This documentation is licensed under the conditions of CC-BY-SA 4.0: https://creativecommons.org/licenses/by-sa/4.0/