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

bug in print.varImp.train #109

Closed
topepo opened this issue Jan 27, 2015 · 6 comments
Closed

bug in print.varImp.train #109

topepo opened this issue Jan 27, 2015 · 6 comments

Comments

@topepo
Copy link
Owner

topepo commented Jan 27, 2015

library(caret)
library(nnet)

#read in data
data = iris

#split data into training, test, and final test samples
trainIndex <- createDataPartition(data$Species, p=.80, list=F)
train = data[trainIndex,]
test = data[-trainIndex,]

#train and plot model fit
tree.fit = train(Species~., data=train, method="nnet")
varImp(tree.fit)
plot(tree.fit$finalModel)

#predict test data
tree.pred.test = predict(tree.fit, newdata=test)
confusionMatrix(tree.pred.test, test$Species)


> varImp(tree.fit)
nnet variable importance

  variables are sorted by maximum importance across the classes
Error in data.frame(`NA` = character(0), `NA` = character(0), `NA` = character(0),  : 
  row names supplied are of the wrong length
In addition: Warning message:
In format.data.frame(x, digits = digits, na.encode = FALSE) :
  corrupt data frame: columns will be truncated or padded with NAs
> plot(tree.fit$finalModel)
Error in xy.coords(x, y, xlabel, ylabel, log) : 
  'x' is a list, but does not have components 'x' and 'y'
topepo added a commit that referenced this issue Apr 2, 2015
See
[#109
aret/issues/109)
@topepo
Copy link
Owner Author

topepo commented Apr 2, 2015

done.

@topepo topepo closed this as completed Apr 2, 2015
@zohrehmosleh
Copy link

I have the same problem. can you explain how i can overcome from this error.

@topepo
Copy link
Owner Author

topepo commented Apr 7, 2015

You can install the current github version or just use the modified print function.

@zohrehmosleh
Copy link

If possible, please explain more. I install, but i receive error

@topepo
Copy link
Owner Author

topepo commented Apr 7, 2015

It is difficult to help with no information about your system, what you did, or the error.

@zohrehmosleh
Copy link

what mean use the modified print function? can you help me?

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

No branches or pull requests

2 participants