# lol.project.bayes_optimal: Bayes Optimal In lolR: Linear Optimal Low-Rank Projection

## Description

A function for recovering the Bayes Optimal Projection, which optimizes Bayes classification.

## Usage

 `1` ```lol.project.bayes_optimal(X, Y, mus, Sigmas, priors, ...) ```

## Arguments

 `X` `[n, p]` the data with `n` samples in `d` dimensions. `Y` `[n]` the labels of the samples with `K` unique labels. `mus` `[d, K]` the `K` class means in `d` dimensions. `Sigmas` `[d, d, K]` the `K` class covariance matrices in `d` dimensions. `priors` `[K]` the priors for each of the `K` classes. `...` optional args.

## Value

A list of class `embedding` containing the following:

 `A` `[d, K]` the projection matrix from `d` to `K` 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, K]` the `n` data points in reduced dimensionality `K`. `cr` `[K, K]` the `K` centroids in reduced dimensionality `K`.

Eric Bridgeford

## Examples

 ```1 2 3 4 5 6``` ```library(lolR) data <- lol.sims.rtrunk(n=200, d=30) # 200 examples of 30 dimensions X <- data\$X; Y <- data\$Y # obtain bayes-optimal projection of the data model <- lol.project.bayes_optimal(X=X, Y=Y, mus=data\$mus, S=data\$Sigmas, priors=data\$priors) ```

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