I am trying to create a decision tree algorithm for a multiclass classification. I decided to use the mlr3 package in order to have maximum options for parameter tuning. However I seem to have problems with creating the classification task. The data used for the task is in a dataframe with multiple variables, all numerical and one factor, which is "cluster"
, with four levels 1-4. This is also the target variable. This is the curent code:
task = as_task_classif(trainset, target = "cluster", id="clusters")
print(task)
When I run this code the output is:
Features:
NULL
I do not really understand why no features are created, hopefully someone can help me with this question.
Here is an example of the dataframe that I am using
Age <- c(58, 31, 58, 23, 58, 14)
Length <- c(185, 187, 180, 190, 184, 154)
Weight <- c(78, 86, 75, 69, 87, 46)
Skinfolds <- c(34, 49, 34, 26, 39, 21)
BMI <- c(17, 24, 23, 21, 26, 19)
cluster<- as.factor(c(3, 4, 3, 2, 1, 2))
trainset <- data.frame(Age, Length, Weight, Skinfolds, BMI, cluster)