We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It seems that the original ordering of the levels of categorical variables can change randomly, which might catch the unsuspecting user by surprise.
Here is a self.contained example using the categorical features of the titanic data:
library(titanic) data(titanic_train) titanic_train = titanic_train[,c("Survived", "Pclass", "Sex")] for (j in 1:3) titanic_train[,j] = factor(titanic_train[,j]) str(titanic_train)
GenSynData = function(x = titanic_train){ # Train the ARF arf <- adversarial_rf(x, verbose = 0) # Estimate distribution parameters psi <- forde(arf, x) #generate: x_syn = forge(psi, nrow(x)) LevChanged = 0 for (j in 1:ncol(x)){ if (any(levels(x[,j]) != levels(x_syn[,j]))) { LevChanged = LevChanged + 1 cat("new levels for ",colnames(x)[j] , levels(x_syn[,j]), "\n") } } cat(LevChanged, " categorical levels changed overall!\n") }
set.seed(123) for (k in 1:5) GenSynData()
'data.frame': 891 obs. of 3 variables: $ Survived: Factor w/ 2 levels "0","1": 1 2 2 2 1 1 1 1 2 2 ... $ Pclass : Factor w/ 3 levels "1","2","3": 3 1 3 1 3 3 1 3 3 2 ... $ Sex : Factor w/ 2 levels "female","male": 2 1 1 1 2 2 2 2 1 1 ... new levels for Survived 1 0 new levels for Pclass 3 1 2 new levels for Sex male female 3 categorical levels changed overall! new levels for Pclass 3 2 1 new levels for Sex male female 2 categorical levels changed overall! new levels for Survived 1 0 new levels for Pclass 3 2 1 2 categorical levels changed overall! new levels for Pclass 2 3 1 1 categorical levels changed overall! new levels for Survived 1 0 new levels for Pclass 1 3 2 new levels for Sex male female 3 categorical levels changed overall!
The text was updated successfully, but these errors were encountered:
I think this is fixed already on Github (but not on CRAN). Another reason for a new CRAN release!
Sorry, something went wrong.
No branches or pull requests
It seems that the original ordering of the levels of categorical variables can change randomly, which might catch the unsuspecting user by surprise.
Here is a self.contained example using the categorical features of the titanic data:
The text was updated successfully, but these errors were encountered: