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

Error when building Explainer #18

Open
jdb78 opened this issue Feb 15, 2018 · 2 comments
Open

Error when building Explainer #18

jdb78 opened this issue Feb 15, 2018 · 2 comments

Comments

@jdb78
Copy link

jdb78 commented Feb 15, 2018

When I build the explainer, the following error is thrown in findPath(tree, leaf):

Error in while (currentnode >0) {: argument is of length zero.

Somehow currentnode seems to be zero. The problem only occurs for some trees making it more difficult to pin down.

@keithhurley
Copy link

I'm getting this same error...have not been able to sort out any possible cause as I've had it working fine before. Did you ever come to a solution?

@keithhurley
Copy link

I've tracked down this error. The problem actually occurs in the xgboost package. When calling the buildExplainer function (xgboostExplainer package), the xgb.model.dt.tree function (xgboost package) is called, which in turn calls the xgb.dump function (xgboost package).

The output from the xgb.dump function CAN create records like
2140:[f5<inf] yes=2487,no=2488,missing=2488

When the xgb.model.dt.tree function parses this record, the "[f5<inf]" part creates a NA value as the function is looking for a numerical value and not an inf or NaN value.

The proper way to fix this would be to have the xgboost package fix the regex code used in the xgb.model.dt.tree function and it appears that this has been corrected in version 0.6.4.6 and beyound. However, xgboostExplainer will not work with xgboost later than 0.6.4.1.

Until the xgboostExplainer package is updated to the new version of xgboost, I hacked together an alternative xgb.model.dt.tree function that does a find and replace for "inf" values and changes it to a significantly large value (for my dataset) so as to accomplish the same thing.

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