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

data inputs and outputs is not robust against character column, and fails with Error in torch_tensor_cpp(data, dtype, device, requires_grad, pin_memory) : R type not handled #124

Open
cregouby opened this issue Jun 25, 2023 · 1 comment
Assignees
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@cregouby
Copy link
Collaborator

Current situation

any predictor being of type character() makes tabnet_* fails with the following error

Error in torch_tensor_cpp(data, dtype, device, requires_grad, pin_memory) : 
  R type not handled

Expected situation

character columns shall be turned into factors with a warning to the end-user about the number of levels discovered

Workaround

use a character to factor transformation upfront using tabnet_* functions

library(dplyr)
#> 
library(tabnet)
data("billboard", package = "tidyr")
billboard_fct <- billboard %>% mutate_if(is.character, as.factor)
model <- tabnet_fit(wk1 ~ ., data = billboard_fct)

Created on 2023-06-25 with reprex v2.0.2

ReprEx

library(tabnet)
data("billboard", package = "tidyr")

model <- tabnet_fit(wk1 ~ ., data = billboard)
#> Error in torch_tensor_cpp(data, dtype, device, requires_grad, pin_memory): R type not handled

Created on 2023-06-25 with reprex v2.0.2

@cregouby cregouby added the bug Something isn't working label Jun 25, 2023
@cregouby cregouby self-assigned this Jun 25, 2023
@cregouby cregouby added the enhancement New feature or request label Jun 25, 2023
@cregouby
Copy link
Collaborator Author

cregouby commented Jun 25, 2023

even if tabnet:::check_type(processed$outcomes) should host it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant