| LR | R Documentation |
This function builds a classification model using Logistic Regression.
LR(
train,
labels,
reg = c("none", "ridge", "lasso", "elastic"),
lambda = NULL,
alpha = 0.5,
nfolds = 10,
tune = FALSE,
methodparameters = NULL,
graph = FALSE,
seed = NULL,
...
)
train |
The training set (description), as a |
labels |
Class labels of the training set ( |
reg |
The penalty applied to the coefficients, as in |
lambda |
The grid of penalty strengths searched by cross-validation; the retained value
is the one minimising the cross-validated deviance. |
alpha |
The elastic net mixing parameter, between 0 (ridge) and 1 (lasso). Used by
|
nfolds |
The number of folds of the cross-validation used to choose |
tune |
If true, the function returns parameters instead of a classification model. |
methodparameters |
Present for interface consistency with |
graph |
Whether the cross-validation curve used to choose |
seed |
A specified seed for random number generation, so that two runs on the same data give the same model. Every learning method accepts it, so that it can be set the same way whatever the method; the deterministic ones simply have nothing to draw and give the same model with or without it. |
... |
Other parameters. |
The classification model.
multinom, glmnet, LINREG
require (datasets)
data (iris)
LR (iris [, -5], iris [, 5])
# Penalized variants: same three penalties as LINREG()
d = splitdata (iris, 5, seed = 0)
model = LR (d$train.x, d$train.y, reg = "lasso")
evaluation (predict (model, d$test.x), d$test.y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.