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

factor attributes with a single level #11

Closed
rivolli opened this issue Oct 30, 2018 · 1 comment
Closed

factor attributes with a single level #11

rivolli opened this issue Oct 30, 2018 · 1 comment

Comments

@rivolli
Copy link
Owner

rivolli commented Oct 30, 2018

I was reported that when the base has factor attributes with a single level it breaks the code.
Create a test to assess and fix this issue.

@lpfgarcia
Copy link
Collaborator

lpfgarcia commented May 2, 2019

I made some tests using iris and an additional attribute with a single value. The first test added a numeric attribute and the second test added a factor attribute:

library(mfe)

data(iris)
iris$x = 1
metafeatures(Species~. , iris)

data(iris)
iris$x = factor(1)
metafeatures(Species~. , iris)

The first test returns an (expected) warning in the cov function. The second test returns an error caused by the single level attribute in the model.matrix (in the binarize function).

I checked how the other packages deal with that. While the rpart and nnet remove the attribute, the e1071 and kknn return the same error.

data(iris)
iris$x = factor(1)

library(e1071)
svm(Species~., iris)

library(kknn)
kknn(Species~., iris)

library(rpart)
rpart(Species~., iris)

I wish close the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants