-
-
Notifications
You must be signed in to change notification settings - Fork 554
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature-api' into develop
- Loading branch information
Showing
5 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# yellowbrick.base | ||
# Abstract base classes and interface for Yellowbrick. | ||
# | ||
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com> | ||
# Created: Fri Jun 03 10:20:59 2016 -0700 | ||
# | ||
# Copyright (C) 2016 District Data Labs | ||
# For license information, see LICENSE.txt | ||
# | ||
# ID: base.py [] benjamin@bengfort.com $ | ||
|
||
""" | ||
Abstract base classes and interface for Yellowbrick. | ||
""" | ||
|
||
from .exceptions import YellowbrickTypeError | ||
from sklearn.base import BaseEstimator, TransformerMixin | ||
|
||
########################################################################## | ||
## Base class hierarhcy | ||
########################################################################## | ||
|
||
class BaseVisualization(object): | ||
""" | ||
The root of the visual object hierarchy that defines how yellowbrick | ||
creates, stores, and renders visual artifcats using matplotlib. | ||
""" | ||
|
||
def render(self): | ||
""" | ||
Render is the primary entry point for producing the visualization. | ||
""" | ||
raise NotImplementedError( | ||
"All visualizations must specify their own render methodology" | ||
) | ||
|
||
|
||
class FeatureVisualization(BaseVisualization, BaseEstimator, TransformerMixin): | ||
""" | ||
A feature visualization class accepts as input a DataFrame or Numpy array | ||
in order to investigate features individually or together. | ||
FeatureVisualization is itself a transformer so that it can be used in | ||
a Scikit-Learn Pipeline to perform automatic visual analysis during build. | ||
""" | ||
|
||
def fit(self, X, y=None, **kwargs): | ||
pass | ||
|
||
def transform(self, X): | ||
pass | ||
|
||
def render(self, data=None): | ||
""" | ||
A feature visualization renders data. | ||
""" | ||
raise NotImplementedError( | ||
"Please specify how to render the feature visualization" | ||
) | ||
|
||
|
||
class ModelVisualization(BaseVisualization, BaseEstimator): | ||
""" | ||
A model visualization class accepts as input a Scikit-Learn estimator(s) | ||
and is itself an estimator (to be included in a Pipeline) in order to | ||
visualize the efficacy of a particular fitted model. | ||
""" | ||
|
||
def fit(self, X, y=None, **kwargs): | ||
pass | ||
|
||
def predict(self, X): | ||
pass | ||
|
||
def render(self, model=None): | ||
""" | ||
A model visualization renders a model | ||
""" | ||
raise NotImplementedError( | ||
"Please specify how to render the model visualization" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# yellowbrick.exceptions | ||
# Exceptions hierarchy for the yellowbrick library | ||
# | ||
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com> | ||
# Created: Fri Jun 03 10:39:41 2016 -0700 | ||
# | ||
# Copyright (C) 2016 District Data Labs | ||
# For license information, see LICENSE.txt | ||
# | ||
# ID: exceptions.py [] benjamin@bengfort.com $ | ||
|
||
""" | ||
Exceptions hierarchy for the yellowbrick library | ||
""" | ||
|
||
########################################################################## | ||
## Exceptions Hierarchy | ||
########################################################################## | ||
|
||
class YellowbrickError(Exception): | ||
""" | ||
The root exception for all yellowbrick related errors. | ||
""" | ||
pass | ||
|
||
|
||
class VisualError(YellowbrickError): | ||
""" | ||
A problem when interacting with matplotlib or the display framework. | ||
""" | ||
pass | ||
|
||
|
||
class ModelError(YellowbrickError): | ||
""" | ||
A problem when interacting with sklearn or the ML framework. | ||
""" | ||
pass | ||
|
||
|
||
class YellowbrickTypeError(YellowbrickError, TypeError): | ||
""" | ||
There was an unexpected type or none for a property or input. | ||
""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# yellowbrick.regressor | ||
# Visualizations related to evaluating Scikit-Learn regressor models | ||
# | ||
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com> | ||
# Created: Fri Jun 03 10:30:36 2016 -0700 | ||
# | ||
# Copyright (C) 2016 District Data Labs | ||
# For license information, see LICENSE.txt | ||
# | ||
# ID: regressor.py [] benjamin@bengfort.com $ | ||
|
||
""" | ||
Visualizations related to evaluating Scikit-Learn regressor models | ||
""" | ||
|
||
########################################################################## | ||
## Imports | ||
########################################################################## | ||
|
||
from .base import ModelVisualization | ||
|
||
|
||
########################################################################## | ||
## Regression Visualization Base Object | ||
########################################################################## | ||
|
||
class RegressorVisualization(ModelVisualization): | ||
pass |