Learn R Programming

mlmts (version 1.1.2)

dis_swmd: Constructs a pairwise distance matrix based on VPCA and SWMD

Description

dis_swmd returns a pairwise distance matrix based on variable-based principal component analysis (VPCA) and a spatial weighted matrix distance (SWMD) he2018unsupervisedmlmts.

Usage

dis_swmd(X, var_rate = 0.9, features = FALSE)

Value

If features = FALSE (default), returns a distance matrix based on the distance \(d_{SWMD}\). Otherwise, the function returns a dataset of feature vectors, i.e., each row in the dataset contains the features employed to compute the distance \(d_{SWMD}\).

Arguments

X

A list of MTS (numerical matrices).

var_rate

Rate of retained variability concerning the dimensionality-reduced MTS samples (default is 0.90).

features

Logical. If features = FALSE (default), a distance matrix is returned. Otherwise, the function returns a dataset of feature vectors.

Author

Ángel López-Oriona, José A. Vilar

Details

Given a collection of MTS, the function returns the pairwise distance matrix, where the distance between two MTS \(\boldsymbol X_T\) and \(\boldsymbol Y_T\) is defined as $$d_{SWMD}(\boldsymbol X_T, \boldsymbol Y_T)=\Big[\big(vec (\boldsymbol Z^{\boldsymbol X_T})-vec(\boldsymbol Z^{\boldsymbol Y_T})\big)\boldsymbol S\big(vec(\boldsymbol Z^{\boldsymbol X_T})-vec(\boldsymbol Z^{\boldsymbol Y_T})\big)^\top\Big]^{1/2},$$ where \(\boldsymbol Z^{\boldsymbol X_T}\) and \(\boldsymbol Z^{\boldsymbol Y_T}\) are the dimensionality- reduced MTS samples associated with \(\boldsymbol X_T\) and \(\boldsymbol Y_T\), respectively, the operator \(vec(\cdot)\) creates a vector by concatenating the columns of the matrix received as input and \(\boldsymbol S\) is a matrix integrating the spatial dimensionality difference between the corresponding elements.

References

he2018unsupervisedmlmts

See Also

vpca_clustering

Examples

Run this code
toy_dataset <- AtrialFibrillation$data[1 : 10] # Selecting the first 10 MTS from the
# dataset AtrialFibrillation
distance_matrix <- dis_swmd(toy_dataset) # Computing the pairwise
# distance matrix based on the distance dis_swmd
feature_dataset <- dis_swmd(toy_dataset, features = TRUE) # Computing
# the corresponding dataset of features

Run the code above in your browser using DataLab