Package 'coRanking'

Title: Co-Ranking Matrix
Description: Calculates the co-ranking matrix to assess the quality of a dimensionality reduction.
Authors: Guido Kraemer [aut, cre]
Maintainer: Guido Kraemer <[email protected]>
License: GPL-3 | file LICENSE
Version: 0.2.5
Built: 2024-10-31 05:21:03 UTC
Source: https://github.com/gdkrmr/coranking

Help Index


Methods for the co-ranking matrix

Description

coRanking provides methods for the calculation of the co-ranking matrix and derived measures to assess the quality of a dimensionality reduction

Details

This package provides functions for calculating the co-ranking matrix, plotitng functions and some derived measures for quality assessment of dimensionality reductions.

Funding provided by the Department for Biogeochemical Integration, Empirical Inference of the Earth System Group, at the Max Plack Institute for Biogeochemistry, Jena.

Author(s)

Maintainer: Guido Kraemer [email protected] (ORCID)

References

Chen, L., Buja, A., 2006. Local Multidimensional Scaling for Nonlinear Dimension Reduction, Graph Layout and Proximity Analysis.

Lee, J.A., Lee, J.A., Verleysen, M., 2009. Quality assessment of dimensionality reduction: Rank-based criteria. Neurocomputing 72.

Lueks, W., Mokbel, B., Biehl, M., & Hammer, B. (2011). How to Evaluate Dimensionality Reduction? - Improving the Co-ranking Matrix. ArXiv:1110.3917 [Cs]. http://arxiv.org/abs/1110.3917

Lee, J. A., Peluffo-Ordóñez, D. H., & Verleysen, M., 2015. Multi-scale similarities in stochastic neighbour embedding: Reducing dimensionality while preserving both local and global structure. Neurocomputing, 169, 246–261. https://doi.org/10.1016/j.neucom.2014.12.095

See Also

Useful links:


Area under the RN_X curve

Description

Area under the RNX(K)R_{NX}(K) curve when KK is put on a logarithmic scale.

Usage

AUC_ln_K(R_NX)

Arguments

R_NX

The R_NX curve, a vector of values

Details

It is calculated as:

AUClnK(RNX(K))=(K=1N2RNX(K)/K)/(K=1N21/K)AUC_{\ln K}(R_{NX}(K)) = \left(\sum_{K=1}^{N-2}R_{NX}(K)/K\right)/\left(\sum_{K=1}^{N-2}1/K\right)

Value

A value, the area under the curve.

Author(s)

Guido Kraemer

References

Lee, J. A., Peluffo-Ordóñez, D. H., & Verleysen, M., 2015. Multi-scale similarities in stochastic neighbour embedding: Reducing dimensionality while preserving both local and global structure. Neurocomputing, 169, 246–261. https://doi.org/10.1016/j.neucom.2014.12.095


Co-Ranking Matrix

Description

Calculate the co-ranking matrix to assess the quality of a diminsionality reduction.

Usage

coranking(
  Xi,
  X,
  input_Xi = c("data", "dist", "rank"),
  input_X = input_Xi,
  use = "C"
)

Arguments

Xi

high dimensional data

X

low dimensional data

input_Xi

type of input of Xi (see. details)

input_X

type of input of X (see. details)

use

R or C backend

Details

Calculate the coranking matrix, to assess the quality of a dimensionality reduction. Xi is input in high dimensions, X is input in low dimensions the type of input is given in input_Xi and input_X, they can be one of c('data', 'dist', 'rank').

Value

a matrix of class 'coranking'

Author(s)

Guido Kraemer

See Also

rankmatrix


Image function for the co-ranking matrix

Description

Plots the co-ranking matrix nicely

Usage

imageplot(
  Q,
  lwd = 2,
  bty = "n",
  main = "co-ranking matrix",
  xlab = expression(R),
  ylab = expression(Ro),
  col = colorRampPalette(colors = c("gray85", "red", "yellow", "green", "blue"))(100),
  axes = FALSE,
  legend = TRUE,
  ...
)

Arguments

Q

of class coranking.

lwd

linewidth in legend

bty

boxtype of legend

main

title of plot

xlab

label of the x axis

ylab

label of the y axis

col

a palette for coloring

axes

ligical draw axes

legend

if T plot a legend.

...

parameters for the image function.

Details

Plots the co-ranking matrix nicely for visual inspection. uses the image function internaly, ... is passed down to the image function. The values in the co-ranking matrix are logscaled for better contrast.

Author(s)

Guido Kramer


The local continuity meta-criterion

Description

Calculate the local continuity meta-criterion from a co-ranking matrix.

Usage

LCMC(Q, K = 1:nrow(Q))

Arguments

Q

a co-ranking matrix

K

vector of integers describing neighborhood size

Details

The local continuity meta-criterion (Chen and Buja, 2006) is defined as

LCMC=K1N+1NK(k,l)ULKqklLCMC = \frac{K}{1-N} + \frac{1}{NK} \sum_{(k,l)\in U L_K} q_{kl}

Higher values mean a better performance of the dimensionality reduction.

Value

A number, the local continuity meta-criterion

Author(s)

Guido Kraemer


Plot the RNX(K)R_{NX}(K) curve

Description

Produces a plot with the RNX(K)R_{NX}(K) curves from the arguments

Usage

plot_R_NX(R_NXs, pal = grDevices::palette(), ylim = c(0, 0.9), ...)

Arguments

R_NXs

A list of R_NX curves, names from the list will appear in the legend

pal

a vector of colors

ylim

set the y-axis limits of the plot

...

options for the plotting function

Value

Nothing, produces a plot.

Author(s)

Guido Kraemer

References

Lee, J. A., Peluffo-Ordóñez, D. H., & Verleysen, M., 2015. Multi-scale similarities in stochastic neighbour embedding: Reducing dimensionality while preserving both local and global structure. Neurocomputing, 169, 246–261. https://doi.org/10.1016/j.neucom.2014.12.095


The QNX(K)Q_{NX}(K) criterion

Description

A curve indicating the percentage of points that are mild in- and extrusions or keep their rank.

Usage

Q_NX(Q)

Arguments

Q

a co-ranking matrix

Details

QNX(K)=1KNk=1Kl=1KQklQ_{NX}(K) = \frac{1}{KN} \sum_{k=1}^{K}\sum_{l=1}^{K}Q_{kl}

Value

A vector with the values for Q_NX(K)

Author(s)

Guido Kraemer

References

Lueks, W., Mokbel, B., Biehl, M., & Hammer, B. (2011). How to Evaluate Dimensionality Reduction? - Improving the Co-ranking Matrix. ArXiv:1110.3917 [Cs]. http://arxiv.org/abs/1110.3917


The RNX(K)R_{NX}(K) criterion

Description

A curve indicating the improvement of the embedding over a random embedding for the neighborhood size KK. Values range from 0, for a random embedding, to 1 for a perfect embedding.

Usage

R_NX(Q)

Arguments

Q

a co-ranking matrix

Details

RNX(K)R_{NX}(K) is calculated as follows:

QNX(K)=1kK1lKqklKNQ_{NX}(K) = \sum_{1\leq k\leq K}\sum_{1\leq l\leq K} \frac{q_{kl}}{KN}

Counts the upper left KK-by-KK block of QQ, i.e. it considers the preserved ranks on the diagonal and the permutations within a neighborhood.

RNX(K)=(N1)QNX(K)KN1KR_{NX}(K) = \frac{(N-1)Q_{NX}(K)-K}{N-1-K}

A resulting vale of 0 corresponds to a random embedding, a value of 1 to a perfect embedding of the KK-ary neighborhood.

Value

A vector with the values for R_NX(K)

Author(s)

Guido Kraemer

References

Lee, J.A., Lee, J.A., Verleysen, M., 2009. Quality assessment of dimensionality reduction: Rank-based criteria. Neurocomputing 72.

Lee, J. A., Peluffo-Ordóñez, D. H., & Verleysen, M., 2015. Multi-scale similarities in stochastic neighbour embedding: Reducing dimensionality while preserving both local and global structure. Neurocomputing, 169, 246–261. https://doi.org/10.1016/j.neucom.2014.12.095


Rank matrix

Description

Replaces the elements of XX with their rank in the column vector of the distance matrix

Usage

rankmatrix(X, input = c("data", "dist"), use = "C")

Arguments

X

data, dist object, or distance matrix

input

type of input

use

if 'C' uses the compiled library, else uses the native R code

Details

Each column vector in the distance matrix (or the distance matrix computed from the input) is replaced by a vector indicating the rank of the distance inside that vector.

This is a computation step necessary for the co-ranking matrix and provided mainly so that the user has the possibility to save computation time.

Value

returns a matrix of class 'rankmatrix'

Author(s)

Guido Kraemer