Describe the bug
Benchmarking.run() stores results in a dict keyed only by estimator.__class__.__name__, so benchmarking two estimators of the same class silently overwrites the first result with the second.
This means hyperparameter comparisons within the same estimator family are not represented correctly in the summary table.
Relevant code:
pyaptamer/benchmarking/_base.py (est_name = estimator.__class__.__name__ and results[est_name] = est_scores)
Minimal reproduction
import numpy as np
from sklearn.dummy import DummyClassifier
from sklearn.metrics import accuracy_score
from pyaptamer.benchmarking import Benchmarking
X = np.array([[0], [1], [0], [1], [0], [1], [0], [1]])
y = np.array([0, 1, 0, 1, 0, 1, 0, 1])
bench = Benchmarking(
estimators=[
DummyClassifier(strategy="most_frequent"),
DummyClassifier(strategy="stratified", random_state=0),
],
metrics=[accuracy_score],
X=X,
y=y,
cv=2,
)
print(bench.run())
Current behavior:
- only one
DummyClassifier row is returned
Expected behavior:
- both estimators should appear in the results under distinct labels
- distinct estimator classes should keep their original class-name labels
Proposed fix
Generate stable display names for estimators before running CV, and disambiguate duplicate class names with a deterministic suffix such as [1], [2], etc.
Describe the bug
Benchmarking.run()stores results in a dict keyed only byestimator.__class__.__name__, so benchmarking two estimators of the same class silently overwrites the first result with the second.This means hyperparameter comparisons within the same estimator family are not represented correctly in the summary table.
Relevant code:
pyaptamer/benchmarking/_base.py(est_name = estimator.__class__.__name__andresults[est_name] = est_scores)Minimal reproduction
Current behavior:
DummyClassifierrow is returnedExpected behavior:
Proposed fix
Generate stable display names for estimators before running CV, and disambiguate duplicate class names with a deterministic suffix such as
[1],[2], etc.