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
@erikcs@halflearned
it seems that the make_encoder() function only allow for one categorical variable at a time. As an example, the code below produces error. Could be a nice improvement to allow for multiple categorical variables or just to type in the code to use in this case.
library(sufrep)
set.seed(12345)
n <- 100
p <- 3
X <- matrix(rnorm(n * p), n, p)
G <- data.frame(as.factor(sample(5, size = n, replace = TRUE)), as.factor(sample(5, size = n, replace = TRUE)))
@erikcs @halflearned
it seems that the make_encoder() function only allow for one categorical variable at a time. As an example, the code below produces error. Could be a nice improvement to allow for multiple categorical variables or just to type in the code to use in this case.
library(sufrep)
set.seed(12345)
n <- 100
p <- 3
X <- matrix(rnorm(n * p), n, p)
G <- data.frame(as.factor(sample(5, size = n, replace = TRUE)), as.factor(sample(5, 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: