Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[R-package] Cannot pass named categorical features to lightgbm() #6000

Closed
david-cortes opened this issue Jul 21, 2023 · 1 comment · Fixed by #6003
Closed

[R-package] Cannot pass named categorical features to lightgbm() #6000

david-cortes opened this issue Jul 21, 2023 · 1 comment · Fixed by #6003

Comments

@david-cortes
Copy link
Contributor

Calling lightgbm() will always end up throwing an error if I pass a matrix with named columns and pass column names for categorical_feature:

library(lightgbm)
data(mtcars)
y <- mtcars$mpg
x <- mtcars[, -1] |> as.matrix()
model <- lightgbm(
    x, y,
    categorical_feature = "cyl"
)
Error in data$set_categorical_feature(categorical_feature) : 
  set_categorical_feature: cannot set categorical feature after freeing raw data,
          please set ‘free_raw_data = FALSE’ when you construct lgb.Dataset

Calling lgb.Dataset beforehand doesn't result in the same error.

This is with the 4.0.0 version in the release tag that says it's for CRAN.

Copy link

github-actions bot commented Nov 8, 2023

This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants