Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: change example template #274

Merged
merged 2 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions man-roxygen/example.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()
#' }
27 changes: 23 additions & 4 deletions man/mlr_learners_classif.cv_glmnet.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 23 additions & 4 deletions man/mlr_learners_classif.glmnet.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 23 additions & 4 deletions man/mlr_learners_classif.kknn.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 23 additions & 4 deletions man/mlr_learners_classif.lda.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 23 additions & 4 deletions man/mlr_learners_classif.log_reg.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 23 additions & 4 deletions man/mlr_learners_classif.multinom.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 23 additions & 4 deletions man/mlr_learners_classif.naive_bayes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 23 additions & 4 deletions man/mlr_learners_classif.nnet.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 23 additions & 4 deletions man/mlr_learners_classif.qda.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 24 additions & 4 deletions man/mlr_learners_classif.ranger.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading