Skip to content

refactor: autotest#1437

Open
be-marc wants to merge 6 commits intomainfrom
autotest_v3
Open

refactor: autotest#1437
be-marc wants to merge 6 commits intomainfrom
autotest_v3

Conversation

@be-marc
Copy link
Copy Markdown
Member

@be-marc be-marc commented Feb 5, 2026

No description provided.

check_reorder.Learner = function(learner, task, prediction) {
newdata = task$data(cols = rev(task$feature_names))
tmp = learner$predict_newdata(newdata)
if (!isTRUE(all.equal(prediction$response, tmp$response))) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This reordering test depends on the response prediction type - I think it would be better to be more general here and find the first prediction type from the learner - learner$predcit_type - and compare that? (though in this case it is not a complete test but it is enough to check) - this for surivval learners what it does is comparing NULL with NULL actually right now!

Copy link
Copy Markdown
Contributor

@bblodfon bblodfon Feb 9, 2026

Choose a reason for hiding this comment

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

ofc the whole point here is that I ma able to make a more specialized check_order.LearnerXYZ, but first let make it more general, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes the whole idea is that mlr3survival implements check_order.LearnerSurv. But yes this is actually the specialized version for LearnerClassif and LearnerRegr

UseMethod("check_marshaling")
}

check_marshaling.Learner = function(learner, task) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't know if this test is enough - ie is it possible to have a faulty implementation of marshaling that makes this test pass?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok you test for it so it should be okay

Comment thread inst/testthat/helper_autotest.R Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use %nin% for readability.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This code block is in general complicated and I see the response also here used - can we abstract it out? the "surv/dens" are not checked either way here, because we loop over the predict types in run_autotest which created some problems from what I recall...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I had overlooked that part. I've completely rewritten it. Makes more sense like that?

}
}

if (task$task_type == "classif" && task$id == "sanity") {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be nice to abstract really generic testing and the S3 implementations that need to be written for individual packages here for example

}

for (task in tasks) {
for (predict_type in predict_types) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this might be an extra check_* function here => do we really need to check across all tasks and predict types?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe not all checks

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