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

[R-package] Ability to control the printed messages? #1440

Closed
Laurae2 opened this issue Jun 10, 2018 · 7 comments
Closed

[R-package] Ability to control the printed messages? #1440

Laurae2 opened this issue Jun 10, 2018 · 7 comments

Comments

@Laurae2
Copy link
Contributor

Laurae2 commented Jun 10, 2018

Currently, LightGBM is not using the R printf message, leading to bypassing any sink (see #513).

An alternative, without losing performance on metric computation, is to return to R the metric values required and have a callback to print the messages.

Currently, we can log the printed messages by using the metric callback. But that's not the best scenario unfortunately (performance wise, especially on large datasets).

Taking 100M observations, training a model and computing AUC on my machine for 10 iterations:

It would be beneficial for logging the performance of the model throughout the training to a file. Such case would be very useful, especially in RStudio Server: if a user is disconnected (for any reason) from the R session, he/she would not be able to get back on RStudio Server until LightGBM finishes training (logging performance would be a great addition).

@guolinke
Copy link
Collaborator

@Laurae2
Maybe "redirect" can solve your problem ?
https://stackoverflow.com/questions/6674327/redirect-all-output-to-file

@guolinke
Copy link
Collaborator

@Laurae2 any response ?

@Laurae2
Copy link
Contributor Author

Laurae2 commented Jun 16, 2018

Redirecting this way is not possible when the session creation is not controlled by the user (same issue with any server spawning R sessions).

@guolinke
Copy link
Collaborator

@Laurae2 got it. However, this require to rewrite the R package, more specifically, the dynamic library used by R.
Maybe the better solution is using some third-party high-performance metric evaluation packages.

@jameslamb
Copy link
Collaborator

Since we closed #1909 I want to add here that any solution needs to be compliant with CRAN's requirements, described there.

@StrikerRUS
Copy link
Collaborator

Closed in favor of being in #2302. We decided to keep all feature requests in one place.

Welcome to contribute this feature! Please re-open this issue (or post a comment if you are not a topic starter) if you are actively working on implementing this feature.

@jameslamb
Copy link
Collaborator

Reopening this one since we have an active PR (#2901) for it

@jameslamb jameslamb reopened this Mar 14, 2020
jameslamb added a commit to jameslamb/LightGBM that referenced this issue Mar 24, 2020
…#1440, fixes microsoft#1909) (microsoft#2901)

* [R-package] started cutting over from custom R-to-C interface to R.h

* replaced LGBM_SE with SEXP

* fixed error about ocnflicting definitions of length

* got linking working

* more stuff

* eliminated R CMD CHECK note about printing

* switched from hard-coded include dir to the one from FindLibR.cmake

* cleaned up formatting in FindLibR.cmake

* commented-out everything in CI that does not touch R

* more changes

* trying to get better logs

* tried ignoring

* added error message to confirm a suspicion

* still trying to find R during R CMD CHECK

* restore full CI

* fixed comment

* Update R-package/src/cmake/modules/FindLibR.cmake

* changed strategy for finding LIBR_HOME on Windows

* Removed 32-bit Windows stuff in FindLibR.cmake

* Update R-package/src/cmake/modules/FindLibR.cmake

* Update CMakeLists.txt

Co-Authored-By: Nikita Titov <nekit94-08@mail.ru>

* Update CMakeLists.txt

Co-Authored-By: Nikita Titov <nekit94-08@mail.ru>

* Update R-package/src/cmake/modules/FindLibR.cmake

Co-Authored-By: Nikita Titov <nekit94-08@mail.ru>

* removed some duplication in cmake scripts

* Update R-package/src/cmake/modules/FindLibR.cmake

Co-Authored-By: Nikita Titov <nekit94-08@mail.ru>

* Update R-package/src/cmake/modules/FindLibR.cmake

Co-Authored-By: Nikita Titov <nekit94-08@mail.ru>

* Update R-package/src/cmake/modules/FindLibR.cmake

Co-Authored-By: Nikita Titov <nekit94-08@mail.ru>

* Update R-package/src/cmake/modules/FindLibR.cmake

Co-Authored-By: Nikita Titov <nekit94-08@mail.ru>

* Update R-package/src/cmake/modules/FindLibR.cmake

Co-Authored-By: Nikita Titov <nekit94-08@mail.ru>

* Update R-package/src/cmake/modules/FindLibR.cmake

Co-Authored-By: Nikita Titov <nekit94-08@mail.ru>

* added LIBR_CORE_LIBRARY back

* small fixes to CMakeLists

* simplified FindLibR.cmake

* some fixes for windows

* Apply suggestions from code review

Co-Authored-By: Nikita Titov <nekit94-08@mail.ru>

* allowed for directly passing LIBR_EXECUTABLE to FindLibR.cmake

* reorganized FindLibR.cmake to catch more cases

* clean up inconsistencies  in R calls in FindLibR.cmake

* Update R-package/src/cmake/modules/FindLibR.cmake

Co-Authored-By: Nikita Titov <nekit94-08@mail.ru>

* removed unnecessary log messages

* removed unnecessary unset() call

Co-authored-by: Nikita Titov <nekit94-08@mail.ru>
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

4 participants