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 Report: cannot run in the demo predict_leaf_indices.R #4328

Closed
JiaxiangBU opened this issue Apr 3, 2019 · 1 comment
Closed

Bug Report: cannot run in the demo predict_leaf_indices.R #4328

JiaxiangBU opened this issue Apr 3, 2019 · 1 comment

Comments

@JiaxiangBU
Copy link
Contributor

accuracy.after <- sum((predict(bst, new.dtest) >= 0.5) == agaricus.test$label) / length(agaricus.test$label)

I get this error

> # Model accuracy with new features
> accuracy.after <- sum((predict(bst, new.dtest) >= 0.5) == agaricus.test$label) / length(agaricus.test$label)
Error in predict.xgb.Booster(bst, new.dtest) : 
  Feature names stored in `object` and `newdata` are different!

Seemingly the factor variables created by the function create.new.tree.features have different levels.

JiaxiangBU added a commit to JiaxiangBU/xgboost that referenced this issue Apr 3, 2019
Fix the bug report of dmlc#4328.
I am the beginner of the Git so just try my best to follows the guide, https://xgboost.readthedocs.io/en/latest/contribute.html#r-package.
I find there is no `dev`  branch, so I pull this fix from my master branch to the original master branch.
@JiaxiangBU
Copy link
Contributor Author

JiaxiangBU commented Apr 3, 2019

I get it, because the input column names are different.
Here is my quick fix, #4329

hcho3 pushed a commit that referenced this issue Apr 4, 2019
Fix the bug report of #4328.
I am the beginner of the Git so just try my best to follows the guide, https://xgboost.readthedocs.io/en/latest/contribute.html#r-package.
I find there is no `dev`  branch, so I pull this fix from my master branch to the original master branch.
@lock lock bot locked as resolved and limited conversation to collaborators Jul 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant