Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/whats_new/v1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ Changelog
experimental. They are now considered stable and are subject to the same
deprecation cycles as all other estimators. :pr:`19799` by `Nicolas Hug`_.

- |Enhancement| Improve the HTML rendering of the
:class:`ensemble.StackingClassifier` and :class:`ensemble.StackingRegressor`.
:pr:`19564` by `Thomas Fan`_.

:mod:`sklearn.feature_extraction`
.................................

Expand Down
11 changes: 8 additions & 3 deletions sklearn/ensemble/_stacking.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,14 @@ def _sk_visual_block_(self, final_estimator):
names, estimators = zip(*self.estimators)
parallel = _VisualBlock('parallel', estimators, names=names,
dash_wrapped=False)
serial = _VisualBlock('serial', (parallel, final_estimator),
dash_wrapped=False)
return _VisualBlock('serial', [serial])

# final estimator is wrapped in a parallel block to show the label:
# 'final_estimator' in the html repr
final_block = _VisualBlock('parallel', [final_estimator],
names=['final_estimator'],
dash_wrapped=False)
return _VisualBlock('serial', (parallel, final_block),
dash_wrapped=False)


class StackingClassifier(ClassifierMixin, _BaseStacking):
Expand Down