diff --git a/man-roxygen/example.R b/man-roxygen/example.R index da144ce0..571eba99 100644 --- a/man-roxygen/example.R +++ b/man-roxygen/example.R @@ -2,11 +2,32 @@ lrn = mlr3::lrn(id) pkgs = setdiff(lrn$packages, c("mlr3", "mlr3learners")) %> +#' <% task_id = if ("LearnerClassif" %in% class(lrn(id))) "sonar" else "mtcars" %> +#' #' @examples #' if (<%= paste0("requireNamespace(\"", pkgs, "\", quietly = TRUE)", collapse = " && ") %>) { -#' learner = mlr3::lrn("<%= id %>") -#' print(learner) +#' # Define the Learner and set parameter values +#' <%= sprintf("learner = lrn(\"%s\")", id)%> +#' print(learner) +#' +#' # Define a Task +#' <%= sprintf("task = tsk(\"%s\")", task_id)%> +#' +#' # Create train and test set +#' <%= sprintf("ids = partition(task)")%> +#' +#' # Train the learner on the training ids +#' <%= sprintf("learner$train(task, row_ids = ids$train)")%> +#' +#' # print the model +#' print(learner$model) +#' +#' # importance method +#' if("importance" %in% learner$properties) print(learner$importance) +#' +#' # Make predictions for the test rows +#' <%= sprintf("predictions = learner$predict(task, row_ids = ids$test)")%> #' -#' # available parameters: -#' learner$param_set$ids() +#' # Score the predictions +#' predictions$score() #' } diff --git a/man/mlr_learners_classif.cv_glmnet.Rd b/man/mlr_learners_classif.cv_glmnet.Rd index c40f3a1d..140479e7 100644 --- a/man/mlr_learners_classif.cv_glmnet.Rd +++ b/man/mlr_learners_classif.cv_glmnet.Rd @@ -87,11 +87,30 @@ as the first factor level. \examples{ if (requireNamespace("glmnet", quietly = TRUE)) { - learner = mlr3::lrn("classif.cv_glmnet") - print(learner) +# Define the Learner and set parameter values +learner = lrn("classif.cv_glmnet") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("sonar") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \references{ diff --git a/man/mlr_learners_classif.glmnet.Rd b/man/mlr_learners_classif.glmnet.Rd index 3d63350f..657684fe 100644 --- a/man/mlr_learners_classif.glmnet.Rd +++ b/man/mlr_learners_classif.glmnet.Rd @@ -96,11 +96,30 @@ as the first factor level. \examples{ if (requireNamespace("glmnet", quietly = TRUE)) { - learner = mlr3::lrn("classif.glmnet") - print(learner) +# Define the Learner and set parameter values +learner = lrn("classif.glmnet") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("sonar") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \references{ diff --git a/man/mlr_learners_classif.kknn.Rd b/man/mlr_learners_classif.kknn.Rd index 32a0f04d..879ad900 100644 --- a/man/mlr_learners_classif.kknn.Rd +++ b/man/mlr_learners_classif.kknn.Rd @@ -63,11 +63,30 @@ lrn("classif.kknn") \examples{ if (requireNamespace("kknn", quietly = TRUE)) { - learner = mlr3::lrn("classif.kknn") - print(learner) +# Define the Learner and set parameter values +learner = lrn("classif.kknn") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("sonar") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \references{ diff --git a/man/mlr_learners_classif.lda.Rd b/man/mlr_learners_classif.lda.Rd index b5a78306..8f3f65fa 100644 --- a/man/mlr_learners_classif.lda.Rd +++ b/man/mlr_learners_classif.lda.Rd @@ -48,11 +48,30 @@ lrn("classif.lda") \examples{ if (requireNamespace("MASS", quietly = TRUE)) { - learner = mlr3::lrn("classif.lda") - print(learner) +# Define the Learner and set parameter values +learner = lrn("classif.lda") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("sonar") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \references{ diff --git a/man/mlr_learners_classif.log_reg.Rd b/man/mlr_learners_classif.log_reg.Rd index 7a2593f8..e4af38fe 100644 --- a/man/mlr_learners_classif.log_reg.Rd +++ b/man/mlr_learners_classif.log_reg.Rd @@ -84,11 +84,30 @@ Instead, set the respective hyperparameter or use \CRANpkg{mlr3pipelines} to cre \examples{ if (requireNamespace("stats", quietly = TRUE)) { - learner = mlr3::lrn("classif.log_reg") - print(learner) +# Define the Learner and set parameter values +learner = lrn("classif.log_reg") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("sonar") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \seealso{ diff --git a/man/mlr_learners_classif.multinom.Rd b/man/mlr_learners_classif.multinom.Rd index 33628134..c4fe069f 100644 --- a/man/mlr_learners_classif.multinom.Rd +++ b/man/mlr_learners_classif.multinom.Rd @@ -53,11 +53,30 @@ lrn("classif.multinom") \examples{ if (requireNamespace("nnet", quietly = TRUE)) { - learner = mlr3::lrn("classif.multinom") - print(learner) +# Define the Learner and set parameter values +learner = lrn("classif.multinom") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("sonar") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \seealso{ diff --git a/man/mlr_learners_classif.naive_bayes.Rd b/man/mlr_learners_classif.naive_bayes.Rd index bc131580..74035c12 100644 --- a/man/mlr_learners_classif.naive_bayes.Rd +++ b/man/mlr_learners_classif.naive_bayes.Rd @@ -38,11 +38,30 @@ lrn("classif.naive_bayes") \examples{ if (requireNamespace("e1071", quietly = TRUE)) { - learner = mlr3::lrn("classif.naive_bayes") - print(learner) +# Define the Learner and set parameter values +learner = lrn("classif.naive_bayes") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("sonar") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \seealso{ diff --git a/man/mlr_learners_classif.nnet.Rd b/man/mlr_learners_classif.nnet.Rd index 85f8e694..e35c915e 100644 --- a/man/mlr_learners_classif.nnet.Rd +++ b/man/mlr_learners_classif.nnet.Rd @@ -73,11 +73,30 @@ lrn("classif.nnet") \examples{ if (requireNamespace("nnet", quietly = TRUE)) { - learner = mlr3::lrn("classif.nnet") - print(learner) +# Define the Learner and set parameter values +learner = lrn("classif.nnet") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("sonar") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \references{ diff --git a/man/mlr_learners_classif.qda.Rd b/man/mlr_learners_classif.qda.Rd index 5542e2d9..70181c7d 100644 --- a/man/mlr_learners_classif.qda.Rd +++ b/man/mlr_learners_classif.qda.Rd @@ -46,11 +46,30 @@ lrn("classif.qda") \examples{ if (requireNamespace("MASS", quietly = TRUE)) { - learner = mlr3::lrn("classif.qda") - print(learner) +# Define the Learner and set parameter values +learner = lrn("classif.qda") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("sonar") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \references{ diff --git a/man/mlr_learners_classif.ranger.Rd b/man/mlr_learners_classif.ranger.Rd index 7edcb87a..ff7ab887 100644 --- a/man/mlr_learners_classif.ranger.Rd +++ b/man/mlr_learners_classif.ranger.Rd @@ -61,6 +61,7 @@ lrn("classif.ranger") importance \tab character \tab - \tab none, impurity, impurity_corrected, permutation \tab - \cr keep.inbag \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr max.depth \tab integer \tab NULL \tab \tab \eqn{[0, \infty)}{[0, Inf)} \cr + min.bucket \tab integer \tab 1 \tab \tab \eqn{[1, \infty)}{[1, Inf)} \cr min.node.size \tab integer \tab NULL \tab \tab \eqn{[1, \infty)}{[1, Inf)} \cr min.prop \tab numeric \tab 0.1 \tab \tab \eqn{(-\infty, \infty)}{(-Inf, Inf)} \cr minprop \tab numeric \tab 0.1 \tab \tab \eqn{(-\infty, \infty)}{(-Inf, Inf)} \cr @@ -88,11 +89,30 @@ lrn("classif.ranger") \examples{ if (requireNamespace("ranger", quietly = TRUE)) { - learner = mlr3::lrn("classif.ranger") - print(learner) +# Define the Learner and set parameter values +learner = lrn("classif.ranger") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("sonar") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \references{ diff --git a/man/mlr_learners_classif.svm.Rd b/man/mlr_learners_classif.svm.Rd index 393e29c9..2328fe53 100644 --- a/man/mlr_learners_classif.svm.Rd +++ b/man/mlr_learners_classif.svm.Rd @@ -51,11 +51,30 @@ lrn("classif.svm") \examples{ if (requireNamespace("e1071", quietly = TRUE)) { - learner = mlr3::lrn("classif.svm") - print(learner) +# Define the Learner and set parameter values +learner = lrn("classif.svm") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("sonar") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \references{ diff --git a/man/mlr_learners_classif.xgboost.Rd b/man/mlr_learners_classif.xgboost.Rd index 5c366ebb..a5e55e48 100644 --- a/man/mlr_learners_classif.xgboost.Rd +++ b/man/mlr_learners_classif.xgboost.Rd @@ -88,6 +88,7 @@ lrn("classif.xgboost") colsample_bylevel \tab numeric \tab 1 \tab \tab \eqn{[0, 1]}{[0, 1]} \cr colsample_bynode \tab numeric \tab 1 \tab \tab \eqn{[0, 1]}{[0, 1]} \cr colsample_bytree \tab numeric \tab 1 \tab \tab \eqn{[0, 1]}{[0, 1]} \cr + device \tab untyped \tab cpu \tab \tab - \cr disable_default_eval_metric \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr early_stopping_rounds \tab integer \tab NULL \tab \tab \eqn{[1, \infty)}{[1, Inf)} \cr early_stopping_set \tab character \tab none \tab none, train, test \tab - \cr @@ -118,7 +119,6 @@ lrn("classif.xgboost") one_drop \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr outputmargin \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr predcontrib \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr - predictor \tab character \tab cpu_predictor \tab cpu_predictor, gpu_predictor \tab - \cr predinteraction \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr predleaf \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr print_every_n \tab integer \tab 1 \tab \tab \eqn{[1, \infty)}{[1, Inf)} \cr @@ -148,11 +148,30 @@ lrn("classif.xgboost") \examples{ if (requireNamespace("xgboost", quietly = TRUE)) { - learner = mlr3::lrn("classif.xgboost") - print(learner) +# Define the Learner and set parameter values +learner = lrn("classif.xgboost") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("sonar") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } # Train learner with early stopping on spam data set diff --git a/man/mlr_learners_regr.cv_glmnet.Rd b/man/mlr_learners_regr.cv_glmnet.Rd index 4b9c6202..d7c6d1c1 100644 --- a/man/mlr_learners_regr.cv_glmnet.Rd +++ b/man/mlr_learners_regr.cv_glmnet.Rd @@ -80,11 +80,30 @@ lrn("regr.cv_glmnet") \examples{ if (requireNamespace("glmnet", quietly = TRUE)) { - learner = mlr3::lrn("regr.cv_glmnet") - print(learner) +# Define the Learner and set parameter values +learner = lrn("regr.cv_glmnet") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("mtcars") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \references{ diff --git a/man/mlr_learners_regr.glmnet.Rd b/man/mlr_learners_regr.glmnet.Rd index 0a1a08e0..9a263a83 100644 --- a/man/mlr_learners_regr.glmnet.Rd +++ b/man/mlr_learners_regr.glmnet.Rd @@ -96,11 +96,30 @@ lrn("regr.glmnet") \examples{ if (requireNamespace("glmnet", quietly = TRUE)) { - learner = mlr3::lrn("regr.glmnet") - print(learner) +# Define the Learner and set parameter values +learner = lrn("regr.glmnet") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("mtcars") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \references{ diff --git a/man/mlr_learners_regr.kknn.Rd b/man/mlr_learners_regr.kknn.Rd index 4fb55533..77610851 100644 --- a/man/mlr_learners_regr.kknn.Rd +++ b/man/mlr_learners_regr.kknn.Rd @@ -63,11 +63,30 @@ lrn("regr.kknn") \examples{ if (requireNamespace("kknn", quietly = TRUE)) { - learner = mlr3::lrn("regr.kknn") - print(learner) +# Define the Learner and set parameter values +learner = lrn("regr.kknn") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("mtcars") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \references{ diff --git a/man/mlr_learners_regr.km.Rd b/man/mlr_learners_regr.km.Rd index ebc1b878..8bbd7fe6 100644 --- a/man/mlr_learners_regr.km.Rd +++ b/man/mlr_learners_regr.km.Rd @@ -72,11 +72,30 @@ lrn("regr.km") \examples{ if (requireNamespace("DiceKriging", quietly = TRUE)) { - learner = mlr3::lrn("regr.km") - print(learner) +# Define the Learner and set parameter values +learner = lrn("regr.km") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("mtcars") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \references{ diff --git a/man/mlr_learners_regr.lm.Rd b/man/mlr_learners_regr.lm.Rd index 03ae4565..e043af12 100644 --- a/man/mlr_learners_regr.lm.Rd +++ b/man/mlr_learners_regr.lm.Rd @@ -41,6 +41,9 @@ lrn("regr.lm") singular.ok \tab logical \tab TRUE \tab TRUE, FALSE \tab - \cr x \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr y \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr + rankdeficient \tab character \tab - \tab warnif, simple, non-estim, NA, NAwarn \tab - \cr + tol \tab numeric \tab 1e-07 \tab \tab \eqn{(-\infty, \infty)}{(-Inf, Inf)} \cr + verbose \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr } } @@ -58,11 +61,30 @@ Instead, set the respective hyperparameter or use \CRANpkg{mlr3pipelines} to cre \examples{ if (requireNamespace("stats", quietly = TRUE)) { - learner = mlr3::lrn("regr.lm") - print(learner) +# Define the Learner and set parameter values +learner = lrn("regr.lm") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("mtcars") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \seealso{ diff --git a/man/mlr_learners_regr.nnet.Rd b/man/mlr_learners_regr.nnet.Rd index 50bfb588..6dbecf0a 100644 --- a/man/mlr_learners_regr.nnet.Rd +++ b/man/mlr_learners_regr.nnet.Rd @@ -73,11 +73,30 @@ lrn("regr.nnet") \examples{ if (requireNamespace("nnet", quietly = TRUE)) { - learner = mlr3::lrn("regr.nnet") - print(learner) +# Define the Learner and set parameter values +learner = lrn("regr.nnet") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("mtcars") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \references{ diff --git a/man/mlr_learners_regr.ranger.Rd b/man/mlr_learners_regr.ranger.Rd index cb848580..b297c93d 100644 --- a/man/mlr_learners_regr.ranger.Rd +++ b/man/mlr_learners_regr.ranger.Rd @@ -36,6 +36,7 @@ lrn("regr.ranger") importance \tab character \tab - \tab none, impurity, impurity_corrected, permutation \tab - \cr keep.inbag \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr max.depth \tab integer \tab NULL \tab \tab \eqn{[0, \infty)}{[0, Inf)} \cr + min.bucket \tab integer \tab 1 \tab \tab \eqn{[1, \infty)}{[1, Inf)} \cr min.node.size \tab integer \tab 5 \tab \tab \eqn{[1, \infty)}{[1, Inf)} \cr min.prop \tab numeric \tab 0.1 \tab \tab \eqn{(-\infty, \infty)}{(-Inf, Inf)} \cr minprop \tab numeric \tab 0.1 \tab \tab \eqn{(-\infty, \infty)}{(-Inf, Inf)} \cr @@ -88,11 +89,30 @@ Note that \code{mtry} and \code{mtry.ratio} are mutually exclusive. \examples{ if (requireNamespace("ranger", quietly = TRUE)) { - learner = mlr3::lrn("regr.ranger") - print(learner) +# Define the Learner and set parameter values +learner = lrn("regr.ranger") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("mtcars") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \references{ diff --git a/man/mlr_learners_regr.svm.Rd b/man/mlr_learners_regr.svm.Rd index 96b39afc..8a4eb6ee 100644 --- a/man/mlr_learners_regr.svm.Rd +++ b/man/mlr_learners_regr.svm.Rd @@ -49,11 +49,30 @@ lrn("regr.svm") \examples{ if (requireNamespace("e1071", quietly = TRUE)) { - learner = mlr3::lrn("regr.svm") - print(learner) +# Define the Learner and set parameter values +learner = lrn("regr.svm") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("mtcars") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } } \references{ diff --git a/man/mlr_learners_regr.xgboost.Rd b/man/mlr_learners_regr.xgboost.Rd index d4ea721b..656db9e6 100644 --- a/man/mlr_learners_regr.xgboost.Rd +++ b/man/mlr_learners_regr.xgboost.Rd @@ -49,6 +49,7 @@ lrn("regr.xgboost") colsample_bylevel \tab numeric \tab 1 \tab \tab \eqn{[0, 1]}{[0, 1]} \cr colsample_bynode \tab numeric \tab 1 \tab \tab \eqn{[0, 1]}{[0, 1]} \cr colsample_bytree \tab numeric \tab 1 \tab \tab \eqn{[0, 1]}{[0, 1]} \cr + device \tab untyped \tab cpu \tab \tab - \cr disable_default_eval_metric \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr early_stopping_rounds \tab integer \tab NULL \tab \tab \eqn{[1, \infty)}{[1, Inf)} \cr early_stopping_set \tab character \tab none \tab none, train, test \tab - \cr @@ -79,7 +80,6 @@ lrn("regr.xgboost") one_drop \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr outputmargin \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr predcontrib \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr - predictor \tab character \tab cpu_predictor \tab cpu_predictor, gpu_predictor \tab - \cr predinteraction \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr predleaf \tab logical \tab FALSE \tab TRUE, FALSE \tab - \cr print_every_n \tab integer \tab 1 \tab \tab \eqn{[1, \infty)}{[1, Inf)} \cr @@ -147,11 +147,30 @@ would error. Just setting a nonsense default to workaround this. \examples{ if (requireNamespace("xgboost", quietly = TRUE)) { - learner = mlr3::lrn("regr.xgboost") - print(learner) +# Define the Learner and set parameter values +learner = lrn("regr.xgboost") +print(learner) - # available parameters: -learner$param_set$ids() +# Define a Task +task = tsk("mtcars") + +# Create train and test set +ids = partition(task) + +# Train the learner on the training ids +learner$train(task, row_ids = ids$train) + +# print the model +print(learner$model) + +# importance method +if("importance" \%in\% learner$properties) print(learner$importance) + +# Make predictions for the test rows +predictions = learner$predict(task, row_ids = ids$test) + +# Score the predictions +predictions$score() } # Train learner with early stopping on spam data set