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

docs: rewrite examples #305

Merged
merged 44 commits into from
Aug 22, 2024
Merged

docs: rewrite examples #305

merged 44 commits into from
Aug 22, 2024

Conversation

Brandonxzl
Copy link
Collaborator

No description provided.

@sebffischer
Copy link
Member

Thanks a lot already! Please make sure that the problems identified by rcmdcheck are addressed

R/learner_gbm_regr_gbm.R Outdated Show resolved Hide resolved
#' task = tsk("boston_housing")
#'
#'
#' # Train the learner on the training ids
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this trains the task on all ids

#' # Define a Task
#' task = as_task_classif(faraway::toenail, target = "outcome")
#'
#' # Train the learner on the training ids
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this uses all ids

#' print(learner)
#'
#' # Define a Task
#' task = as_task_classif(faraway::toenail, target = "outcome")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not a standard task? is the faraway package available?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried some standard tests but they're not available for this learner, so I use the dataset in the example of function glmer instead.

#' @examples
#' if (requireNamespace("mboost", quietly = TRUE)) {
#' # Define the Learner and set parameter values
#'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty lines

R/learner_lme4_classif_glmer.R Show resolved Hide resolved
R/learner_gbm_regr_gbm.R Outdated Show resolved Hide resolved
R/learner_prioritylasso_classif_priority_lasso.R Outdated Show resolved Hide resolved
man-roxygen/example.R Outdated Show resolved Hide resolved
@sebffischer
Copy link
Member

Note that you can (probably) use mlr3misc::require_namespaces() to address the line length warnings

@sebffischer
Copy link
Member

@Brandonxzl the CI is still not passing, please fix the line length :)

@sebffischer
Copy link
Member

because the line length is still an issue, you can use if (mlr3misc::require_namespaces(lrn(<id>)$packages, quietly = TRUE) { ...} I guess :)

R/learner_gbm_regr_gbm.R Outdated Show resolved Hide resolved
R/learner_lme4_classif_glmer.R Show resolved Hide resolved
@@ -15,7 +15,34 @@
#' `r format_bib("bates2010lme4")`
#'
#' @template seealso_learner
#' @template example
#' @examples
#' if (requireNamespace(c("lme4", "faraway"), quietly = TRUE)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is faraway neeed here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for building the task specified for this learner:

Define a Task

#' task = mlr3::as_task_regr(lme4::sleepstudy, target = "Reaction")

#' learner$train(task)
#'
#' # print the model
#' print(learner$model)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I can train a learner it should be possible to make predictions as well

#' @template example
#' @examples
#' if (mlr3misc::require_namespaces(c("mlr3extralearners", "mboost", "pracma"), quietly = TRUE)) {
#' # Define the Learner and set parameter values
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no parameter values are set.

Also, mboost and pracma are not required when I just want to construct the learner

R/learner_survivalmodels_surv_loghaz.R Outdated Show resolved Hide resolved
R/learner_survivalmodels_surv_pchazard.R Outdated Show resolved Hide resolved
R/learner_survivalsvm_surv_svm.R Outdated Show resolved Hide resolved
R/learner_survivalsvm_surv_svm.R Outdated Show resolved Hide resolved
man-roxygen/simple_example.R Outdated Show resolved Hide resolved
@sebffischer sebffischer merged commit 8ed7653 into main Aug 22, 2024
4 of 5 checks passed
@sebffischer sebffischer deleted the examples branch August 22, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants