cla_tune | R Documentation |
This function performs a grid search or random search over specified hyperparameter values to optimize a base classification model
cla_tune(base_model, folds = 10, metric = "accuracy")
base_model |
base model for tuning |
folds |
number of folds for cross-validation |
metric |
metric used to optimize |
returns a cla_tune
object
# preparing dataset for random sampling
sr <- sample_random()
sr <- train_test(sr, iris)
train <- sr$train
test <- sr$test
# hyper parameter setup
tune <- cla_tune(cla_mlp("Species", levels(iris$Species)))
ranges <- list(size=c(3:5), decay=c(0.1))
# hyper parameter optimization
model <- fit(tune, train, ranges)
# testing optimization
test_prediction <- predict(model, test)
test_predictand <- adjust_class_label(test[,"Species"])
test_eval <- evaluate(model, test_predictand, test_prediction)
test_eval$metrics
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.