chore(skore/estimator-report): Clean some parts of the metrics accessor#2331
Conversation
|
Please note that #2277 will result in significant changes to the metrics accessor. |
thomass-dev
left a comment
There was a problem hiding this comment.
IMO, this PR looks like a PR that changes only the "styling code". This should be avoided when possible, or included in other changes when really needed.
Otherwise, we could do the same thing for all parts of the code...
| if isinstance(score, list) and len(score) == 1: | ||
| score = score[0] | ||
| if isinstance(score, list) and "classification" in self._parent._ml_task: | ||
| score = dict( | ||
| zip(self._parent._estimator.classes_.tolist(), score, strict=False) | ||
| ) |
There was a problem hiding this comment.
Please use if/elif when the condition are exclusive. Same for your change on line 554.
There was a problem hiding this comment.
@GaetandeCast @thomass-dev I've simplified the conditional but the conditions are not quite exclusive enough to go further. Please advise.
There was a problem hiding this comment.
reverted as I misunderstood what array.item() does (I thought it gave you the element of a 1-element array, but it also converts numpy-typed numbers to native types).
There was a problem hiding this comment.
@thomass-dev please give it another look
I did these changes while working on a larger refactor, and I wanted to make it as simple to review and merge as possible |
|
So I'm ok with this, although I agree with @thomass-dev 's remark about exclusive if/if statements. |
df8b4e2 to
1f1c8fa
Compare
…or (probabl-ai#2331) In preparation for a larger refactor of `_MetricsAccessor`
…or (probabl-ai#2331) In preparation for a larger refactor of `_MetricsAccessor`
…or (probabl-ai#2331) In preparation for a larger refactor of `_MetricsAccessor`
…or (probabl-ai#2331) In preparation for a larger refactor of `_MetricsAccessor`
In preparation for a larger refactor of
_MetricsAccessor