lol.project.lrlda: Low-Rank Linear Discriminant Analysis (LRLDA)

Description Usage Arguments Value Details Author(s) Examples

View source: R/pca.R

Description

A function that performs LRLDA on the class-centered data. Same as class-conditional PCA.

Usage

1
lol.project.lrlda(X, Y, r, xfm = FALSE, xfm.opts = list(), robust = 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.

xfm

whether to transform the variables before taking the SVD.

  • FALSEapply no transform to the variables.

  • 'unit'unit transform the variables, defaulting to centering and scaling to mean 0, variance 1. See scale for details and optional args.

  • 'log'log-transform the variables, for use-cases such as having high variance in larger values. Defaults to natural logarithm. See log for details and optional args.

  • 'rank'rank-transform the variables. Defalts to breaking ties with the average rank of the tied values. See rank for details and optional args.

  • c(opt1, opt2, etc.)apply the transform specified in opt1, followed by opt2, etc.

xfm.opts

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

robust

whether to use a robust estimate of the covariance matrix when taking PCA. Defaults to FALSE.

...

trailing args.

Value

A list containing the following:

A

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

d

the eigen values associated with the eigendecomposition.

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.

Details

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

Author(s)

Eric Bridgeford

Examples

1
2
3
4
library(lolR)
data <- lol.sims.rtrunk(n=200, d=30)  # 200 examples of 30 dimensions
X <- data$X; Y <- data$Y
model <- lol.project.lrlda(X=X, Y=Y, r=2)  # use lrlda to project into 2 dimensions

lolR documentation built on July 8, 2020, 7:35 p.m.