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

feat: add leaf_min_events_ratio for surv.aorsf #384

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jemus42
Copy link
Member

@jemus42 jemus42 commented Sep 10, 2024

Based on #383

This adds leaf_min_events_ratio to surv.aorsf to allow tuning leaf_min_events as a ratio, analogously to mtry[._]ratio parameter in this and other forest-based learners.

I have settled for an intermediate upper bound of 0.5, corresponding to half the number of observed events in the task.
This is most likely a bit confusing, but it corresponds to what the upstream learner enforces.

I'm not sure what a sensible conversion is here, considering the following example:

library(mlr3)
library(mlr3proba)
library(mlr3extralearners)
library(mlr3pipelines)
library(mlr3tuning)
#> Loading required package: paradox

set.seed(123)
task = tsk("lung")


# ratio of 0 yields a minimum of 1, sensible?
lrn1 = lrn("surv.aorsf", leaf_min_events_ratio = 0)$train(task)
lrn1$model$leaf_min_events
#> [1] 1

# A reasonable case, I think?
lrn2 = lrn("surv.aorsf", leaf_min_events_ratio = 0.3)$train(task)
lrn2$model$leaf_min_events
#> [1] 37

# This is a bit on the edge?
lrn3 = lrn("surv.aorsf", leaf_min_events_ratio = 0.49)$train(task)
lrn3$model$leaf_min_events
#> [1] 60

lrn4 = lrn("surv.aorsf", leaf_min_events_ratio = 0.50)$train(task)
#> Error: leaf_min_events = 61 should be <= 60 (number of events divided by 2)

# Here the param set restriction hits, maybe confusingly so?
lrn5 = lrn("surv.aorsf", leaf_min_events_ratio = 0.51)$train(task)
#> Error in self$assert(xs, sanitize = TRUE): Assertion on 'xs' failed: leaf_min_events_ratio: Element 1 is not <= 0.5.

Created on 2024-09-10 with reprex v2.1.1

@sebffischer
Copy link
Member

Is this ready to be reviewed or still a draft?

@jemus42
Copy link
Member Author

jemus42 commented Oct 18, 2024

Pending some discussion about the API in #383 --- feel free to chime in, because I'm still uncertain what we want to do here.

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