Skip to content

Model cannot be tuned while forcing variables in the model #13

@sibipx

Description

@sibipx

Hi! I want to tune a model while forcing a variable in the model using always.split.variables.

It would also be nice to be able to specify bounds for the tuned parameters. Probably specifying upper bound for mtry at number of variables minus one would fix the problem.

Thanks!

library(ranger)
library(tuneRanger)
data("iris")

measure <- list(multiclass.brier)
task <- makeClassifTask(data = iris,
                        target = "Species")

parameters <- list(respect.unordered.factors = "order",
                   replace = TRUE,
                   always.split.variables = c("Sepal.Length"),
                   importance = "none")

res <- tuneRanger(task, measure = measure,
                  num.trees = 100,
                  show.info = TRUE,
                  tune.parameters = c("mtry", "min.node.size"),
                  parameters = parameters,
                  build.final.model = FALSE)

Computing y column(s) for design. Not provided.
Error: Number of variables to be always considered for splitting plus mtry cannot be larger than number of independent variables. Ranger will EXIT now.
Error in ranger::ranger(formula = NULL, dependent.variable.name = tn,  : 
  User interrupt or internal error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions