You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Package does not work when categorical variable has 2 levels. Of course you want to use the package when there are more than two levels. But I have many categorical variables and thus wrote a function to apply encoding on all the categorical variables. Since some of my categorical variables only have two levels, I get errors. See code below @erikcs@halflearned
set.seed(12345)
n <- 100
p <- 3
X <- matrix(rnorm(n * p), n, p)
G <- as.factor(sample(2, size = n, replace = TRUE))
Package does not work when categorical variable has 2 levels. Of course you want to use the package when there are more than two levels. But I have many categorical variables and thus wrote a function to apply encoding on all the categorical variables. Since some of my categorical variables only have two levels, I get errors. See code below
@erikcs @halflearned
set.seed(12345)
n <- 100
p <- 3
X <- matrix(rnorm(n * p), n, p)
G <- as.factor(sample(2, size = n, replace = TRUE))
One-hot encoding
onehot_encoder <- make_encoder(X = X, G = G, method = "one_hot")
train.df <- onehot_encoder(X = X, G = G)
print(head(train.df))
The text was updated successfully, but these errors were encountered: