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

Fix print.xgb.Booster for R #3338

Merged
merged 2 commits into from
May 29, 2018
Merged

Fix print.xgb.Booster for R #3338

merged 2 commits into from
May 29, 2018

Conversation

r-suzuki
Copy link
Contributor

I always get "Handle is invalid!" message with the R package xgboost 0.71.1. I found that valid_handle is TRUE when x$handle is (a kind of ) NULL, but it seems to be the opposite.

valid_handle should be TRUE when x$handle is NOT null
Modify is.null.handle to return TRUE for NULL handle
@r-suzuki
Copy link
Contributor Author

r-suzuki commented May 24, 2018

I have also included a fix for is.null.handle to treat NULL handle.

If we load a model object from .RData file (not using xgb.save) the handle object is NULL. While is.null.handle is expected to return TRUE for NULL handle, is.null(handle) is never reached since it stops when checking the class. So I changed the sequence a bit.

So this PR includes:

  • Fix print.xgb.Booster to properly check whether handle is NULL or not.
  • Avoid stopping the print function when the handle is NULL

@codecov-io
Copy link

codecov-io commented May 24, 2018

Codecov Report

Merging #3338 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #3338   +/-   ##
=========================================
  Coverage     45.69%   45.69%           
  Complexity      228      228           
=========================================
  Files           166      166           
  Lines         12972    12972           
  Branches        466      466           
=========================================
  Hits           5927     5927           
  Misses         6853     6853           
  Partials        192      192

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 480e3fd...6e921ad. Read the comment docs.

@hcho3 hcho3 merged commit b7cbec4 into dmlc:master May 29, 2018
@hcho3
Copy link
Collaborator

hcho3 commented May 29, 2018

Thanks!

@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 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

Successfully merging this pull request may close these issues.

3 participants