mlr-org / mlr3

mlr3: Machine Learning in R - next generation
https://mlr3.mlr-org.com
GNU Lesser General Public License v3.0
929 stars 86 forks source link

Error while calling as.data.table(mlr_tasks) and as.data.table(mlr_resamplings) #544

Closed FlyImagi closed 4 years ago

FlyImagi commented 4 years ago

I am using mlr3, and still learning the ease of use

I am having an issue by making mlr objects which is mlr_resamplings and mlr_tasks to convert it as data table, error popups shows like:

I am following the 2.2 Tasking basic for this to happen

as.data.table(mlr_tasks)
Error in (function (rhs)  : 
  Assertion on 'names of col_roles' failed: Must be a permutation of set {feature,target,label,order,group,weight,coordinates,target_ordinal}.

And I am following the 2.5 Resampling basic for this to happen

as.data.table(mlr_resamplings)
Error in (function (task_id = NULL, cache = getOption("mlr3oml.cache",  : 
  Argument 'task_id' must be provided

Can I be enlighten with this? how should i do?

pat-s commented 4 years ago

Hi,

this repo is only for the old {mlr} package and not for {mlr3} related things.

Looks like you do not have the latest versions of all packages or the order of package loading is causing troubles. Please provide areproducible example, preferably using the reprex package.

FlyImagi commented 4 years ago

well, I dont know, I load everything mlr3 related, this is what I try from beginning:

library(mlr3)
library(mlr3db)
library(mlr3data)
library(mlr3oml)
library(mlr3misc)
library(mlr3measures)
library(bbotk)
library(mlr3forecasting)
library(mlr3spatiotempcv)
library(mlr3proba)
library(mlr3ordinal)
library(mlr3cluster)
library(paradox)
library(mlr3tuning)
library(mlr3hyperband)
library(mlr3mbo)
library(mlr3fselect)
library(mlr3filters)
library(mlr3keras)
library(mlr3learners)
library(mlr3pipelines)
library(mlr3viz)

data("mtcars", package = "datasets")
data = mtcars[, 1:3]
str(data)

library("mlr3")
task_mtcars = TaskRegr$new(id = "cars", backend = data, target = "mpg")
print(task_mtcars)

library("mlr3viz")
autoplot(task_mtcars, type = "pairs")
library("data.table")
as.data.table(mlr_tasks)

I installed those packages a week ago

As for resampling, I do these for start:

task = tsk("iris")
learner = lrn("classif.rpart")
as.data.table(mlr_resamplings)
mllg commented 4 years ago

This is actually a bug triggered by loading the mlr3oml package. I'll fix it over there.

Also note that it is probably not a good idea to load all those mlr3 packages which are not released yet (hyperband, ordinal, ...).