regmlelda.cv: Cross-validation for the regularised maximum likelihood...

View source: R/reg.mle.lda.R

Cross-validation for the regularised maximum likelihood linear discriminant analysisR Documentation

Cross-validation for the regularised maximum likelihood linear discriminant analysis

Description

Cross-validation for the regularised maximum likelihood linear discriminant analysis.

Usage

regmlelda.cv(x, ina, lambda = seq(0, 1, by = 0.1), folds = NULL, nfolds = 10, 
             stratified = TRUE, seed = FALSE, pred.ret = FALSE)

Arguments

x

A matrix with numerical data.

ina

A numerical vector or factor with consecutive numbers indicating the group to which each observation belongs to.

lambda

A vector of regularization values \lambda such as (0, 0.1, 0.2,...).

folds

A list with the indices of the folds.

nfolds

The number of folds to be used. This is taken into consideration only if "folds" is NULL.

stratified

Do you want the folds to be selected using stratified random sampling? This preserves the analogy of the samples of each group. Make this TRUE if you wish, but only for the classification. If you have regression (type = "R"), do not put this to TRUE as it will cause problems or return wrong results.

seed

If you set this to TRUE, the same folds will be created every time.

pred.ret

If you want the predicted values returned set this to TRUE.

Details

Cross-validation for the regularised maximum likelihood linear discriminant analysis is performed. The function is not extremely fast, yet is pretty fast.

Value

A list including:

preds

If pred.ret is TRUE the predicted values for each fold are returned as elements in a list.

crit

A vector whose length is equal to the number of k and is the accuracy metric for each k. For the classification case it is the percentage of correct classification. For the regression case the mean square of prediction error.

Author(s)

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

References

Friedman J., Hastie T. and Tibshirani R. (2017). The elements of statistical learning. New York: Springer.

Cover TM and Hart PE (1967). Nearest neighbor pattern classification. IEEE Transactions on Information Theory. 13(1):21-27.

See Also

reg.mle.lda, bigknn.cv, mle.lda, big.knn, weibull.nb

Examples

x <- as.matrix(iris[, 1:4])
mod <- regmlelda.cv(x, iris[, 5])

Rfast2 documentation built on Aug. 8, 2023, 1:11 a.m.