set.seed(1234)
#simulate a dataset with continuous data
dataset <- matrix(nrow = 100 , ncol = 100)
dataset <- apply(dataset, 1:2, function(i) runif(1, 1, 10))
#the target feature is the last column of the dataset as a vector
target <- dataset[,100]
#get 50 percent of the dataset as a train set
train_set <- dataset[1:50,]
train_target=target[1:50]
#run a 10 fold CV for the regression task
best_model = cv.ses(target = train_target, dataset = train_set, kfolds = 10, task = "R")
#get the results
best_model$best_configuration
best_model$best_performance
#summary elements of the process. Press tab after each $ to view all the elements and
#choose the one you are intresting in.
#best_model$cv_results_all[[...]]$...
#i.e.
#mse value for the 1st configuration of SES of the 5 fold
abs(best_model$cv_results_all[[1]]$performances[5])
best_a = best_model$best_configuration$a
best_max_k = best_model$best_configuration$max_k
Run the code above in your browser using DataLab