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

xgboost messages should not be output into stdout/stderr but available as iterator for python module #3020

Closed
KOLANICH opened this issue Jan 8, 2018 · 5 comments

Comments

@KOLANICH
Copy link
Contributor

KOLANICH commented Jan 8, 2018

This may be helpful to show them in a way not destroying CLI.

@tqchen tqchen closed this as completed Jul 4, 2018
@KOLANICH
Copy link
Contributor Author

KOLANICH commented Jul 4, 2018

???

@tqchen
Copy link
Member

tqchen commented Jul 4, 2018

There is already option (silent) to supress the messages in python API
The discussions are now welcomed at https://discuss.xgboost.ai/

@KOLANICH
Copy link
Contributor Author

KOLANICH commented Jul 4, 2018

It's not quite about suppression.
If I use tqdm, or any other cli gui framework, they are usually assume that only they can output into console, because they manipupate cursor position and delete the output emiting control codes or calling API. Violating this assumption destroys cli. So these frameworks have a funtion to output messages in the way without destroying cli: passing the text to them, so they correct own output with respect to the text you wanna output.

xgboost outputs directly, there is no way to pass its messages to frameworks output functions.

@tqchen
Copy link
Member

tqchen commented Jul 4, 2018

There is something related to this in R's implementation, where the logging is hijacked and send to R's console, maybe some direction along that would be helpful

@hcho3
Copy link
Collaborator

hcho3 commented Jul 4, 2018

@tqchen @KOLANICH LOG(INFO) can be re-directed to a custom callback function by defining the function dmlc::CustomLogMessage::Log(). The project I recently started (dmlc/treelite) precisely does this.

  1. Have an interface in C API to register custom callback function for all logging outputs. Something like:
int XGBRegisterLogCallback(void (*callback)(const char*))
  1. Python package should register a callback function by calling C API.
  2. Define the function dmlc::CustomLogMessage::Log() to make use of the callback.

Let me go ahead and file a PR to re-direct LOG(INFO) to Python module.

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

3 participants