<commit_before># yellowbrick.base
# Abstract base classes and interface for Yellowbrick.
#
# Author:   <NAME> <<EMAIL>>
# Created:  Fri Jun 03 10:20:59 2016 -0700
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: base.py [4a59c49] <EMAIL> $

"""
Abstract base classes and interface for Yellowbrick.
"""

import matplotlib.pyplot as plt

from .exceptions import YellowbrickTypeError
from .utils import get_model_name, isestimator
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.cross_validation import cross_val_predict as cvp

##########################################################################
## Base class hierarhcy
##########################################################################

class Visualizer(BaseEstimator):
    """
    The root of the visual object hierarchy that defines how yellowbrick
    creates, stores, and renders visual artifacts using matplotlib.

    Inherits from Scikit-Learn's BaseEstimator class.

    The base class for feature visualization and model visualization
    primarily ensures that styling arguments are passed in.
    """

    def __init__(self, **kwargs):
        self.size  = kwargs.pop('size')
        self.color = kwargs.pop('color')

    def fit(self, X, y=None, **kwargs):
        """
        Fits a transformer to X and y
        """
        pass

    def _draw(self, **kwargs):
        pass

    def poof(self, model=None):
        """
        Primary entry point for producing the visualization

        Visualizes either data features or fitted model scores
        """
        raise NotImplementedError(
            "All visualizations must specify their own poof methodology"
        )


    def fit_draw(self, X, y=None):
        """
        Fits a transformer to X and y then returns
        visualization of features or fitted model.
        """
        pass


class FeatureVisualizer(Visualizer, TransformerMixin):
    """
    Base class for feature visualization to investigate features
    individually or together.

    FeatureVisualizer is itself a transformer so that it can be used in
    a Scikit-Learn Pipeline to perform automatic visual analysis during build.

    Accepts as input a DataFrame or Numpy array.
    """

    def __init__(self):
        pass

    def fit(self, X, y=None, **kwargs):
        pass

    def transform(self, X):
        pass

    def poof(self, data=None):
        """
        Visualize data features individually or together
        """
        raise NotImplementedError(
            "Please specify how to render the feature visualization"
        )

    def fit_draw(self, X, data=None):
        pass

    def fit_transform(self, X, data=None):
        pass

class ScoreVisualizer(Visualizer):
    """
    Base class to follow an estimator in a visual pipeline.

    Draws the score for the fitted model.
    """

    def __init__(self, model):
        pass

    def fit(self, X, y=None):
        pass

    def predict(self, X):
        pass

    def score(self, y, y_pred=None):
        """
        Score will call draw to visualize model performance.
        If y_pred is None, call fit-predict on the model to get a y_pred.
        """
        return self.draw(y,y_pred)

    def _draw(self, X, y):
        pass

    def poof(self, **kwargs):
        """
        Poof calls render
        """
        raise NotImplementedError(
            "Please specify how to render the feature visualization"<commit_msg>removing old render terminology from new API<commit_after># yellowbrick.base
# Abstract base classes and interface for Yellowbrick.
#
# Author:   <NAME> <<EMAIL>>
# Created:  Fri Jun 03 10:20:59 2016 -0700
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: base.py [4a59c49] <EMAIL> $

"""
Abstract base classes and interface for Yellowbrick.
"""

import matplotlib.pyplot as plt

from .exceptions import YellowbrickTypeError
from .utils import get_model_name, isestimator
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.cross_validation import cross_val_predict as cvp

##########################################################################
## Base class hierarhcy
##########################################################################

class Visualizer(BaseEstimator):
    """
    The root of the visual object hierarchy that defines how yellowbrick
    creates, stores, and renders visual artifacts using matplotlib.

    Inherits from Scikit-Learn's BaseEstimator class.

    The base class for feature visualization and model visualization
    primarily ensures that styling arguments are passed in.
    """

    def __init__(self, **kwargs):
        self.size  = kwargs.pop('size')
        self.color = kwargs.pop('color')

    def fit(self, X, y=None, **kwargs):
        """
        Fits a transformer to X and y
        """
        pass

    def _draw(self, **kwargs):
        pass

    def poof(self, model=None):
        """
        Primary entry point for producing the visualization

        Visualizes either data features or fitted model scores
        """
        raise NotImplementedError(
            "All visualizations must specify their own poof methodology"
        )


    def fit_draw(self, X, y=None):
        """
        Fits a transformer to X and y then returns
        visualization of features or fitted model.
        """
        pass


class FeatureVisualizer(Visualizer, TransformerMixin):
    """
    Base class for feature visualization to investigate features
    individually or together.

    FeatureVisualizer is itself a transformer so that it can be used in
    a Scikit-Learn Pipeline to perform automatic visual analysis during build.

    Accepts as input a DataFrame or Numpy array.
    """

    def __init__(self):
        pass

    def fit(self, X, y=None, **kwargs):
        pass

    def transform(self, X):
        pass

    def poof(self, data=None):
        """
        Visualize data features individually or together
        """
        raise NotImplementedError(
            "Please specify how to render the feature visualization"
        )

    def fit_draw(self, X, data=None):
        pass

    def fit_transform(self, X, data=None):
        pass

class ScoreVisualizer(Visualizer):
    """
    Base class to follow an estimator in a visual pipeline.

    Draws the score for the fitted model.
    """

    def __init__(self, model):
        pass

    def fit(self, X, y=None):
        pass

    def predict(self, X):
        pass

    def score(self, y, y_pred=None):
        """
        Score will call draw to visualize model performance.
        If y_pred is None, call fit-predict on the model to get a y_pred.
        """
        return self.draw(y,y_pred)

    def _draw(self, X, y):
        pass

    def poof(self, **kwargs):
        """
        Poof calls _draw
        """
        raise NotImplementedError(
            "Please specify how to render the feature visualization"
{'fraction_non_alphanumeric': 0.11650485436893204, 'fraction_numerical': 0.007138777841233581, 'mean_word_length': 2.6541471048513303, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6302254', 'n_tokens_mistral': 1962, 'n_tokens_neox': 1830, 'n_words': 703}