-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
ENH Adds HTML visualizations for estimators #14180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7e75b73
2ce3552
f8d2681
8b015e1
893dbfc
f7bfb0c
597a99b
9ccdbd0
4df33f8
8f57191
677e35a
343773a
1ac0e4c
50ed9f3
1598cad
464f6d8
b8b3ab0
6cb813b
90a4d92
f4d882c
57e4d0c
4288fbf
c4cfe63
2c700fe
2749e07
92be3e9
1b47170
733bade
ae98ae9
7b1de5f
741bc13
b0dd3f2
1b14ce2
e03362f
975c823
ecb3ae6
3451ab0
407cfff
80d9b10
791374b
d297bc7
9fde84a
f254e1d
48aebee
d44c38e
4d8d72a
3811190
9df8a4b
50ee0b4
212ba21
2a81f16
6c11293
da83a68
55a20e7
169964d
b8a84e0
1e1bd1b
ce0fc2c
93da060
1c08495
0a30ced
f740537
f656d8b
856ce5d
b5c26b0
f56060c
d6c7de6
52a640a
66ebce9
24029d3
adc977b
9df7573
ef02574
4f12e71
dbd7f2c
c1b451c
17f05e8
47d72ba
bae645b
c616802
1fe69fa
8d23d5b
3d41caf
1cc87b6
3af9151
0b4a64d
689d3f2
e0062f1
694124f
058e45e
662b1c3
d174a87
c5c03da
a642185
185986b
419cc09
bc03910
d57151c
4ed258f
bfa953a
19f43ba
e688cb7
b994664
57fea52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
from ..base import clone | ||
from ..base import ClassifierMixin, RegressorMixin, TransformerMixin | ||
from ..base import is_classifier, is_regressor | ||
from ..utils._estimator_html_repr import _VisualBlock | ||
|
||
from ._base import _fit_single_estimator | ||
from ._base import _BaseHeterogeneousEnsemble | ||
|
@@ -233,6 +234,14 @@ def predict(self, X, **predict_params): | |
self.transform(X), **predict_params | ||
) | ||
|
||
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]) | ||
|
||
|
||
class StackingClassifier(ClassifierMixin, _BaseStacking): | ||
"""Stack of estimators with a final classifier. | ||
|
@@ -496,6 +505,15 @@ def transform(self, X): | |
""" | ||
return self._transform(X) | ||
|
||
def _sk_visual_block_(self): | ||
# If final_estimator's default changes then this should be | ||
# updated. | ||
if self.final_estimator is None: | ||
final_estimator = LogisticRegression() | ||
else: | ||
final_estimator = self.final_estimator | ||
Comment on lines
+511
to
+514
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure about this one. Would it be fair to say an unfitted estimator here doesn't have an html repr? Or have None as given by the user? Or change the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the current implementation, an estimator always has an unfitted estimator. In this stacker, if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then maybe leave a comment about that here and also during validation where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah okay (missed this comment) |
||
return super()._sk_visual_block_(final_estimator) | ||
|
||
|
||
class StackingRegressor(RegressorMixin, _BaseStacking): | ||
"""Stack of estimators with a final regressor. | ||
|
@@ -665,3 +683,12 @@ def transform(self, X): | |
Prediction outputs for each estimator. | ||
""" | ||
return self._transform(X) | ||
|
||
def _sk_visual_block_(self): | ||
# If final_estimator's default changes then this should be | ||
# updated. | ||
if self.final_estimator is None: | ||
final_estimator = RidgeCV() | ||
else: | ||
final_estimator = self.final_estimator | ||
return super()._sk_visual_block_(final_estimator) |
Uh oh!
There was an error while loading. Please reload this page.