Skip to content

[Callbacks] API Rename eval_on_fit_task_*#33561

Merged
jeremiedbb merged 4 commits intoscikit-learn:callbacksfrom
jeremiedbb:rename-eval
Mar 17, 2026
Merged

[Callbacks] API Rename eval_on_fit_task_*#33561
jeremiedbb merged 4 commits intoscikit-learn:callbacksfrom
jeremiedbb:rename-eval

Conversation

@jeremiedbb
Copy link
Copy Markdown
Member

@jeremiedbb jeremiedbb commented Mar 16, 2026

As reported in scikit-learn/enhancement_proposals#90 (comment), eval might evoke model evaluation since we're a ML library.

2 alternative names were proposed in different discussion channels: run_on_fit_task_* and call_on_fit_task_*.
I also asked an ai to propose other alternatives. Here's its answer:

1. invoke_on_fit_task_begin / invoke_on_fit_task_end
“Invoke” clearly means “call the callbacks’ hooks.”
Common in callback/event APIs, and not overloaded like “eval.”

2. dispatch_on_fit_task_begin / dispatch_on_fit_task_end
“Dispatch” suggests sending an event to all registered callbacks.
Fits well if you think of this as dispatching a lifecycle event.

3. notify_on_fit_task_begin / notify_on_fit_task_end
“Notify” suggests informing listeners (the callbacks) that the task began/ended.
Slightly less explicit that you’re calling a method, but still clear.

4. call_on_fit_task_begin / call_on_fit_task_end
Most literal: we are calling the callbacks’ on_fit_task_* hooks.
Very clear, a bit plain.

5. run_on_fit_task_begin / run_on_fit_task_end
“Run” is simple and implies execution of the hooks.
Could be read as “run (something) when fit task begins” rather than 
“run the begin hooks,” so slightly less precise than “invoke” or “call.”

Recommendation: invoke_on_fit_task_begin / invoke_on_fit_task_end or
call_on_fit_task_begin / call_on_fit_task_end are the clearest and least ambiguous.
I’d lean to invoke_ for a public API and call_ if you want maximum literal clarity.

I don't like dispatch and notify.
I wasn't aware that invoke was common callback vocabulary. I think that we can assume that developers of estimator will be either, so call is probably a better call for us. Hence I went for call.
Let me know what's your preference.

ping @ogrisel @FrancoisPgm @StefanieSenger @lesteve

@ogrisel
Copy link
Copy Markdown
Member

ogrisel commented Mar 17, 2026

+1 for invoke_*.

+0.5 for call_*.

-1 for dispatch_* and 0 for the others.

@lesteve
Copy link
Copy Markdown
Member

lesteve commented Mar 17, 2026

Small preference for call it feels simpler and does what it says. invoke feels fancier but a tiny bit less clear to me ... not a big fan of dispatch, run or notify.

@StefanieSenger
Copy link
Copy Markdown
Member

I'm +1 on on call and run, and -1 on dispatch and notify.

@FrancoisPgm
Copy link
Copy Markdown
Contributor

FrancoisPgm commented Mar 17, 2026

I'm +1 for call and invoke, +0.5 for run, -1 for dispatch and notify.

@jeremiedbb
Copy link
Copy Markdown
Member Author

I'm 1 for call, +0.75 for invoke, +0.5 for run and -1 for the other 2

@jeremiedbb
Copy link
Copy Markdown
Member Author

🥁

@jeremiedbb
Copy link
Copy Markdown
Member Author

call: +4.5
invoke: +3.25
run: +1
dispatch / notify: -5

Let's go for call then :)

(I interpreted loic's answer as +1 call, +0.5 invoke, -1 rest)
(I interpreted stefanie's abstention for invoke as 0)

@jeremiedbb jeremiedbb merged commit eff5209 into scikit-learn:callbacks Mar 17, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants