MV-MDS

Multiview Multidimensional Scaling

Multiview MDS (multidimensional scaling) provides a representation of the pattern of proximities among a set of matrices. Likewise, these matrices are composed of different attributes, which have a pattern of proximities as well. Coding of two principal functions found in mvmds file. The first function, preprocess mvmds, preprocess data for multiview MDs algorithm The second, md_mds, computes the MDS algorithm itself for a set of matrices.

class multiview.mvmds.MVMDS(k=2)

It receives two or more feature matrices or distance matrices, according to is_distance parameters and produces a low-dimensional representation of the samples according to the combined information in all the input data. In the case of plain data matrices, euclidean distance will be used to generate distance matrices for that data view. Mv_MDS preprocess input matrix wih square and double center.

Notes

All input views must have the same number of samples (rows).

Parameters:k (int, default: 2) – Number of desired dimensions of the low-dimensional projection.
components_

ndarray – Principal components of the dataset input.

References

Kruskal, J B. 1964. “Multidimensional scaling by optimizing goodness of fit to a nonmetric hypothesis.” Psychometrika 29 (1): 1–27. doi:10.1007/BF02289565.

Trendafilov, Nickolay T. 2010. “Stepwise estimation of common principal components.” Computational Statistics and Data Analysis 54 (12): 3446–57. doi:10.1016/j.csda.2010.03.010.

fit(x, is_distance)

Computes euclidean distances of X according to is_distance, preprocess these data and fit them.

Parameters:
  • x (list) – A list of data matrices. Matrices can be raw data or distance matrices. In the case of plain data matrices, euclidean distance will be used to generate a distance matrix for that data view.
  • is_distance (list) – Each boolean value indicates wheter the matrix in x with the same index is a distance matrix or not.
fit_transform(x, is_distance)

Computes euclidean distances of X according to is_distance, preprocess these data, fit and return them.

Parameters:
  • x (list) – A list of data matrices. Matrices can be raw data or distance matrices. In the case of plain data matrices, euclidean distance will be used to generate a distance matrix for that data view.
  • is_distance (list) – Each boolean value indicates wheter the matrix in x with the same index is a distance matrix or not.
Returns:

common – A n x k matrix with the k-dimensional projection, where n is the number of samples in the dataset.

Return type:

ndarray

Raises:
  • ValueError: Matrices are not square matrices, k value is negative
  • or data samples and is_distance parameters do not have the same
  • length.

Examples

>>> import numpy as np
>>> m = np.array([[1, 4], [2, 5], [3, 6]])
>>> r = np.array([[2, 4], [1, 5], [8, 6]])
>>> matrices = [m, r]
>>> is_distance = [False, False]
>>> mv_mds = MVMDS(k=2)
>>> mv_mds.fit_transform(matrices, is_distance)
array([[-0.55030705 -0.60318224]
       [-0.24721761  0.77817101]
       [ 0.79752467 -0.17498877]])