-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Closed
Labels
Description
Describe the bug
Pipeline without defined steps is displayed in HTML as fitted.
Steps/Code to Reproduce
from sklearn.pipeline import Pipeline
pipe = Pipeline([])
pipe
Expected Results
Maybe empty list should not be accepted. And it should rise a ValueError with a message asking to add steps.
Actual Results
Using vscode jupyter extension:

Note: Accepting an empty list is one issue, and showing that it is fitted is another.
The former occurs when a Pipeline
is initialized. The latter, I believe, is a design flaw in sklearn/utils/_repr_html/estimator.py.
Versions
System:
python: 3.12.2 (v3.12.2:6abddd9f6a, Feb 6 2024, 17:02:06) [Clang 13.0.0 (clang-1300.0.29.30)]
executable: /Users/dealeon/projects/scikit-learn/sklearn-env/bin/python
machine: macOS-15.5-arm64-arm-64bit
Python dependencies:
sklearn: 1.8.dev0
pip: 25.1
setuptools: 75.8.0
numpy: 2.1.1
scipy: 1.14.1
Cython: 3.0.11
pandas: 2.2.3
matplotlib: 3.9.2
joblib: 1.4.2
threadpoolctl: 3.5.0
Built with OpenMP: True
threadpoolctl info:
user_api: openmp
internal_api: openmp
num_threads: 8
prefix: libomp
filepath: /opt/homebrew/Cellar/libomp/19.1.7/lib/libomp.dylib
version: None
StefanieSenger and SwathiR1999