I was trying to solve one problem based on Linear Regression (Predicting the sales which is a continuous variable). I have used Linear Regression for the problem but there is one suggested solution using Lasso Regression. However, the user has used Train function. I am unable to understand why train function has been used. Is it the syntax for Lasso? Similar function has been used for Ridge Regression.
my_control = trainControl(method="cv", number=5)
Grid = expand.grid(alpha = 0, lambda = seq(0.001,0.1,by = 0.0002))
lasso_linear_reg_mod3 = train(x = Train[, -c(1,2)], y = Train$Item_Outlet_Sales, method='glmnet', trControl= my_control, tuneGrid = Grid)