Skip to content

Commit

Permalink
fix n_iter report
Browse files Browse the repository at this point in the history
  • Loading branch information
fcharras committed Jan 15, 2024
1 parent ca4077f commit 2f9d369
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion benchmarks/ridge/solvers/scikit_learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,20 @@ def run(self, _):
self.n_iter_ = estimator.n_iter_

def get_result(self):
n_iter = self.n_iter_
if isinstance(n_iter, list):
n_iter = set(n_iter)
if len(n_iter) > 1:
raise ValueError(
"In multitarget mode, the same number of iterations is expected "
"for all targets, to keep reports comparable."
)
n_iter = n_iter.pop()

return dict(
weights=self.weights,
intercept=self.intercept,
n_iter=self.n_iter_,
n_iter=n_iter,
version_info=f"scikit-learn {version('scikit-learn')}",
__name=self.name,
**self._parameters,
Expand Down

0 comments on commit 2f9d369

Please sign in to comment.