Description Usage Arguments Value Methods (by class) Examples
Linear Discriminant Analysis finds directions in high-dimensional space that maximize the ratio of inter-class variance / within-class variance.
1 2 3 4 5 6 7 8 9 10 |
X |
matrix or data.frame, where each row is a sample and each column is a feature. |
... |
further arguments passed to or from other methods |
y |
a vector of class labels with length equal to the number of rows in X. If X is a data.frame, y can also be an index (integer) or name (character) of the column to be used as labels. |
lambda |
regularization parameter. Higher values lead to less overfitting and the cost of poorer separation between the classes. (Default: 0.1) |
formula |
an alternative way to specify the LDA model. See below for examples. |
data |
a data.frame associated with the formula-based model specification. |
An object of class LDA that contains variance quotients in $d and LDA component loadings in $v. See tidy.LDA
, glance.LDA
and augment.LDA
for tidy downstream usage of the LDA object.
data.frame
: accepts a data.frame and column index / name, or an external labels vector
matrix
: accepts a matrix and an external labels vector
formula
: accepts a formula and the corresponding data.frame
1 2 3 4 5 6 7 | ## All of the following are equivalent ways to train an LDA model on the built-in iris dataset
model1 <- LDA( iris, "Species" )
model2 <- LDA( iris, 5 )
model3 <- LDA( iris[,1:4], iris[,5] )
model4 <- LDA( as.matrix( iris[,1:4] ), iris[,5] )
model5 <- LDA( Species ~ ., iris )
model6 <- LDA( Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width, iris )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.