[WIP] Adds support for Pipelines with ModelVisualizers#955
[WIP] Adds support for Pipelines with ModelVisualizers#955bbengfort wants to merge 3 commits intoDistrictDataLabs:developfrom bbengfort:wrap-pipelines
Conversation
| try: | ||
| return getattr(self._final_estimator(), attr) | ||
| except AttributeError as e: | ||
| raise NotFitted(str(e)) |
There was a problem hiding this comment.
It makes sense to me that this would raise not fitted but I don't like the message "object has no attribute coef_" ... not sure if it would be better to just raise the Attribute Error or not.
| from sklearn.datasets import make_blobs, make_classification, make_regression | ||
|
|
||
|
|
||
| BASES = [ |
There was a problem hiding this comment.
This file takes the work from the audit and adds systematic checks to be tested across different groups of visualizers -- it replaces the old tests/checks.py framework by using pytest do perform all the checks.
|
|
||
| @pytest.mark.skip("too many edge cases, is tested in most visualizer-specific tests") | ||
| @pytest.mark.parametrize("Viz", VISUALIZERS) | ||
| def test_fit(Viz): |
There was a problem hiding this comment.
I thought this might be an easy one to implement, but there are a lot of edge cases here, so I'm thinking about removing it.
| assert oz.fit(data.X.train, data.y.train) is oz | ||
|
|
||
|
|
||
| @pytest.mark.xfail(reason="quick methods aren't primetime yet") |
There was a problem hiding this comment.
This check also tells us a lot about the state of our quick methods; only 5 xpass (e.g. pass even though the test is marked xfail)
| ########################################################################## | ||
|
|
||
|
|
||
| class TestModelVisualizer(VisualTestCase): |
There was a problem hiding this comment.
Adds tests for the final estimator functionality implemented for Pipelines.
| @@ -17,18 +17,23 @@ | |||
| ## Imports | |||
| ########################################################################## | |||
There was a problem hiding this comment.
Ensures all feature visualizers are imported into the top level.
There was a problem hiding this comment.
In fact, all of the modifications to __init__.py files are to ensure that the visualizers and bases are imported at the top level so they can be imported into the check functionality.
|
|
||
|
|
||
| # Alias for closer name to isinstance and issubclass | ||
| ispipeline = is_pipeline |
There was a problem hiding this comment.
This only checks Pipeline objects, I'm not sure if we also need to check FeatureUnion - am open for suggestions.
This PR fixes #498 and adds support for
Pipelinesin mostScoreVisualizers. It also adds some automatic checking extending functionality described in #180.I have made the following changes:
is_pipelinetype checkModelVisualizerto access the final estimator in a pipelineTODOs and questions
Still to do:
CHECKLIST
pytest?make html?