acalejos / exgboost

Elixir bindings to the XGBoost C API (https://xgboost.readthedocs.io/en/stable/c.html) using Native Implemented Functions (NIFs)
Apache License 2.0
160 stars 7 forks source link

Refactor training logic #35

Closed billylanchantin closed 8 months ago

billylanchantin commented 9 months ago

Adds:

This way the fun on %Training.Callback{} can have the spec:

instead of wrapping the output in a tuple. It also means we can write code like this:

state =
  state
  |> run_callbacks(callbacks, :before_training)
  |> run_training(callbacks, dmat, objective)
  |> run_callbacks(callbacks, :after_training)

since now run_callbacks/3 and run_training/4 (new) can branch on state.status.

I did some other code shuffling while I was in there, but none of it is crucial.