Data Science, Machine Learning, Data Analytics, Knowledgebase Analytics, Regularization.
set.seed(123) # for reproducibility trainIndex <- createDataPartition(hitters$Salary, p = .8, list = FALSE) trainData <- hitters[trainIndex, ] testData <- hitters[-trainIndex, ] # Define the control using a cross-validation approach trainControl <- trainControl(method = "cv", number = 10) # Train