a-hanf / mlr3automl

Automated machine learning in mlr3
GNU Lesser General Public License v3.0
25 stars 4 forks source link

Use two or more tasks in AutoML #32

Open MislavSag opened 2 years ago

MislavSag commented 2 years ago

It seems to me it is not possible to use two or more tasks in AutoML?

If that's true, I would like to make feature request.

This is ussually possible in using mlr3 benchmark. It is possible to degine multiple tasks, learners etc.

If I use two tasks in AutoML:


library(mlr3automl)
library(mlr3verse)

task_1 <- tsk("iris")
task_2 <- tsk("iris")
bmr_results = AutoML(list(task_1, task_2))
bmr_results = AutoML(c(task_1, task_2))

it returns an error:

Error in if (task$task_type == "classif") { : argument is of length zero

BTW, is there any way I can contribute tu this package and help in developing? Maybe adding new learners, there are many of them in mlr3extensions?

a-hanf commented 2 years ago

mlr3automl adapts to the provided task (the pipeline that is created may be different for different tasks). Also, optimal hyperparameters will depend on the data. I'm not sure I understand your use case, can you elaborate a little bit more on what you want to happen when there are multiple tasks?

I would be happy to have more contributors :) You can create a pull request into the development branch with any new features / bugfixes / etc.

MislavSag commented 2 years ago

It s possible to use more than one task in mlr3 benchmark, for example:

design = benchmark_grid(
  tasks = tsks(c("spam", "german_credit", "sonar")),
  learners = lrns(c("classif.ranger", "classif.rpart", "classif.featureless"),
    predict_type = "prob", predict_sets = c("train", "test")),
  resamplings = rsmps("cv", folds = 3)
)

but this is not possible in AutoML function. I thought it would be very convenient to allow for more than onw task in AutoML. All tasks should be of the same type ofc (for example all should be binary classification).

It seems to me you found workaround to use number of features in mlr3 trafo. It seems there is an simple solution here https://github.com/mlr-org/mlr3tuning/issues/309.