lol.project.lol: Linear Optimal Low-Rank Projection (LOL)

Description Usage Arguments Value Details Author(s) References Examples

View source: R/lol.R

Description

A function for implementing the Linear Optimal Low-Rank Projection (LOL) Algorithm. This algorithm allows users to find an optimal projection from 'd' to 'r' dimensions, where 'r << d', by combining information from the first and second moments in thet data.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
lol.project.lol(
  X,
  Y,
  r,
  second.moment.xfm = FALSE,
  second.moment.xfm.opts = list(),
  first.moment = "delta",
  second.moment = "linear",
  orthogonalize = FALSE,
  robust.first = TRUE,
  robust.second = FALSE,
  ...
)

Arguments

X

[n, d] the data with n samples in d dimensions.

Y

[n] the labels of the samples with K unique labels.

r

the rank of the projection. Note that r >= K, and r < d.

second.moment.xfm

whether to use extraneous options in estimation of the second moment component. The transforms specified should be a numbered list of transforms you wish to apply, and will be applied in accordance with second.moment.

second.moment.xfm.opts

optional arguments to pass to the second.moment.xfm option specified. Should be a numbered list of lists, where second.moment.xfm.opts[[i]] corresponds to the optional arguments for second.moment.xfm[[i]]. Defaults to the default options for each transform scheme.

first.moment

the function to capture the first moment. Defaults to 'delta'.

  • 'delta' capture the first moment with the hyperplane separating the per-class means.

  • FALSE do not capture the first moment.

second.moment

the function to capture the second moment. Defaults to 'linear'.

  • 'linear' performs PCA on the class-conditional data to capture the second moment, retaining the vectors with the top singular values. Transform options for second.moment.xfm and arguments in second.moment.opts should be in accordance with the trailing arguments for lol.project.lrlda.

  • 'quadratic' performs PCA on the data for each class separately to capture the second moment, retaining the vectors with the top singular values from each class's PCA. Transform options for second.moment.xfm and arguments in second.moment.opts should be in accordance with the trailing arguments for lol.project.pca.

  • 'pls' performs PLS on the data to capture the second moment, retaining the vectors that maximize the correlation between the different classes. Transform options for second.moment.xfm and arguments in second.moment.opts should be in accordance with the trailing arguments for lol.project.pls.

  • FALSE do not capture the second moment.

orthogonalize

whether to orthogonalize the projection matrix. Defaults to FALSE.

robust.first

whether to perform PCA on a robust estimate of the first moment component or not. A robust estimate corresponds to usage of medians. Defaults to TRUE.

robust.second

whether to perform PCA on a robust estimate of the second moment component or not. A robust estimate corresponds to usage of a robust covariance matrix, which requires d < n. Defaults to FALSE.

...

trailing args.

Value

A list containing the following:

A

[d, r] the projection matrix from d to r dimensions.

ylabs

[K] vector containing the K unique, ordered class labels.

centroids

[K, d] centroid matrix of the K unique, ordered classes in native d dimensions.

priors

[K] vector containing the K prior probabilities for the unique, ordered classes.

Xr

[n, r] the n data points in reduced dimensionality r.

cr

[K, r] the K centroids in reduced dimensionality r.

second.moment

the method used to estimate the second moment.

first.moment

the method used to estimate the first moment.

Details

For more details see the help vignette: vignette("lol", package = "lolR")

Author(s)

Eric Bridgeford

References

Joshua T. Vogelstein, et al. "Supervised Dimensionality Reduction for Big Data" arXiv (2020).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(lolR)
data <- lol.sims.rtrunk(n=200, d=30)  # 200 examples of 30 dimensions
X <- data$X; Y <- data$Y
model <- lol.project.lol(X=X, Y=Y, r=5)  # use lol to project into 5 dimensions

# use lol to project into 5 dimensions, and produce an orthogonal basis for the projection matrix
model <- lol.project.lol(X=X, Y=Y, r=5, orthogonalize=TRUE)

# use LRQDA to estimate the second moment by performing PCA on each class
model <- lol.project.lol(X=X, Y=Y, r=5, second.moment='quadratic')

# use PLS to estimate the second moment
model <- lol.project.lol(X=X, Y=Y, r=5, second.moment='pls')

# use LRLDA to estimate the second moment, and apply a unit transformation
# (according to scale function) with no centering
model <- lol.project.lol(X=X, Y=Y, r=5, second.moment='linear', second.moment.xfm='unit',
                         second.moment.xfm.opts=list(center=FALSE))

neurodata/lol documentation built on March 3, 2021, 1:46 a.m.