Lasso regressor

LassoRegressor(reg_lambda = 0.1, max_iter = 10L, tol = 0.001)

Arguments

reg_lambda

L1 regularization parameter

max_iter

number of iterations of lasso shooting algorithm.

tol

tolerance for convergence of lasso shooting algorithm.

Value

An object of class Lasso

Examples


if (FALSE) {
library(datasets)

X <- as.matrix(datasets::mtcars[, -1])
y <- as.integer(datasets::mtcars[, 1])

n <- dim(X)[1]
p <- dim(X)[2]
set.seed(21341)
train_index <- sample(x = 1:n, size = floor(0.8*n), replace = TRUE)
test_index <- -train_index
X_train <- as.matrix(X[train_index, ])
y_train <- as.double(y[train_index])
X_test <- as.matrix(X[test_index, ])
y_test <- as.double(y[test_index])

obj <- mlsauce::LassoRegressor()

print(obj$get_params())

obj$fit(X_train, y_train)

print(obj$score(X_test, y_test))}