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

Feature request: Callbacks #18

Open
romanovzky opened this issue Jun 6, 2024 · 2 comments
Open

Feature request: Callbacks #18

romanovzky opened this issue Jun 6, 2024 · 2 comments
Assignees

Comments

@romanovzky
Copy link

Since SymbolicRegressor is an iterative process, akin to online learning algorithms (neural nets, etc), it would be useful to have callbacks that could be called at different stages. For example, a monitoring callback could print the generation number, the best objective values, etc. Another example would be to implement early stop callback under certain conditions. Yet another example would be to better integrate with optuna.

@foolnotion
Copy link
Member

foolnotion commented Jun 6, 2024

A general monitoring callback is already supported by the bindings:

def report():

But calling python lambdas from C++ can be unreliable due to the GIL. We could expose this as callback=... in the SymbolicRegressor. More detailed callbacks would require changes to the C++ library and to implement some termination operators.

Regarding Optuna, is this similar to what you had in mind? https://gist.github.com/foolnotion/226fe764b9af79f219d63c8c10b0d497

@foolnotion foolnotion self-assigned this Jun 6, 2024
@romanovzky
Copy link
Author

Indeed exposing callbacks=... is the customary API design for ML libraries. See for example:

other examples of ML libraries using callback API: xgboost, lightgbm.

All of these provide the required functionality to use callbacks with TensorBoard, a leading ML experiment tracker, and I imagine that the same could be done for MLFlow, see for example how one can use Keras callbacks.

Regarding optuna: I was thinking about using callbacks to extend optuna's functionality with pyoperon. For example, optuna has integration callbacks to use pruners to kill unpromising trials. It's an example of application, not strictly part of the feature requested.

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