# Path: skutil/utils/metaestimators.py
# def if_delegate_has_method(delegate, method=None):
#     """Create a decorator for methods that are delegated to a sub-estimator
#     This enables ducktyping by ``hasattr`` returning True according to the
#     sub-estimator. This is an adaptation of the sklearn if_delegate_has_method
#     where this implementation allows specific method naming.
# 
#     Parameters
#     ----------
# 
#     delegate : string, list of strings or tuple of strings
#         Name of the sub-estimator that can be accessed as an attribute of the
#         base object. If a list or a tuple of names are provided, the first
#         sub-estimator that is an attribute of the base object  will be used.
# 
#     method : string, optional (default=None)
#         The name of the method delegated to the decorator. If None,
#         will use the name of the current function.
#     """
#     if isinstance(delegate, list):
#         delegate = tuple(delegate)
#     if not isinstance(delegate, tuple):
#         delegate = (delegate,)
# 
#     return lambda fn: _IffHasAttrDescriptor(fn, delegate,
#                                             attribute_name=(method if method is not None else fn.__name__))


import numbers
import numpy as np
import pandas as pd
import sklearn
import sys
import warnings
from abc import ABCMeta, abstractmethod
from sklearn.base import BaseEstimator, MetaEstimatorMixin, is_classifier, clone
from sklearn.externals import six
from sklearn.externals.joblib import Parallel, delayed
from sklearn.utils.validation import _num_samples, check_is_fitted, check_consistent_length #,indexable
from sklearn.metrics.scorer import check_scoring
from collections import namedtuple, Sized
from .metaestimators import if_delegate_has_method
    from sklearn.model_selection import check_cv
    from sklearn.model_selection._validation import _fit_and_score
    from sklearn.model_selection import ParameterSampler, ParameterGrid
        from sklearn.cross_validation import check_cv
        from sklearn.cross_validation import _fit_and_score
        from sklearn.grid_search import ParameterSampler, ParameterGrid
    @if_delegate_has_method(delegate='estimator')
    def decision_function(self, X):
        """Call decision_function on the estimator with the best found parameters.
        Only available if ``refit=True`` and the underlying estimator supports
        ``decision_function``.

        Parameters
        ----------
        X : indexable or pd.DataFrame, length n_samples
            Must fulfill the input assumptions of the
            underlying estimator.
        """
        X = _validate_X(X)
        return self.best_estimator_.decision_function(X)

    @if_delegate_has_method(delegate='estimator')
    def transform(self, X):
        """Call transform on the estimator with the best found parameters.
        Only available if the underlying estimator supports ``transform`` and
        ``refit=True``.

        Parameters
        ----------
        X : indexable or pd.DataFrame, length n_samples
            Must fulfill the input assumptions of the
            underlying estimator.
        """
        X = _validate_X(X)
        return self.best_estimator_.transform(X)


# Path: skutil/utils/metaestimators.py
# def if_delegate_has_method(delegate, method=None):
#     """Create a decorator for methods that are delegated to a sub-estimator
#     This enables ducktyping by ``hasattr`` returning True according to the
#     sub-estimator. This is an adaptation of the sklearn if_delegate_has_method
#     where this implementation allows specific method naming.
# 
#     Parameters
#     ----------
# 
#     delegate : string, list of strings or tuple of strings
#         Name of the sub-estimator that can be accessed as an attribute of the
#         base object. If a list or a tuple of names are provided, the first
#         sub-estimator that is an attribute of the base object  will be used.
# 
#     method : string, optional (default=None)
#         The name of the method delegated to the decorator. If None,
#         will use the name of the current function.
#     """
#     if isinstance(delegate, list):
#         delegate = tuple(delegate)
#     if not isinstance(delegate, tuple):
#         delegate = (delegate,)
# 
#     return lambda fn: _IffHasAttrDescriptor(fn, delegate,
#                                             attribute_name=(method if method is not None else fn.__name__))


# Path: skutil/utils/fixes.py
import numbers
import numpy as np
import pandas as pd
import sklearn
import sys
import warnings
from abc import ABCMeta, abstractmethod
from sklearn.base import BaseEstimator, MetaEstimatorMixin, is_classifier, clone
from sklearn.externals import six
from sklearn.externals.joblib import Parallel, delayed
from sklearn.utils.validation import _num_samples, check_is_fitted, check_consistent_length #,indexable
from sklearn.metrics.scorer import check_scoring
from collections import namedtuple, Sized
from .metaestimators import if_delegate_has_method
    from sklearn.model_selection import check_cv
    from sklearn.model_selection._validation import _fit_and_score
    from sklearn.model_selection import ParameterSampler, ParameterGrid
        from sklearn.cross_validation import check_cv
        from sklearn.cross_validation import _fit_and_score
        from sklearn.grid_search import ParameterSampler, ParameterGrid

    @if_delegate_has_method(delegate='estimator')
    def decision_function(self, X):
        """Call decision_function on the estimator with the best found parameters.
        Only available if ``refit=True`` and the underlying estimator supports
        ``decision_function``.

        Parameters
        ----------
        X : indexable or pd.DataFrame, length n_samples
            Must fulfill the input assumptions of the
            underlying estimator.
        """
        X = _validate_X(X)
        return self.best_estimator_.decision_function(X)

    @if_delegate_has_method(delegate='estimator')
    def transform(self, X):
        """Call transform on the estimator with the best found parameters.
        Only available if the underlying estimator supports ``transform`` and
        ``refit=True``.

        Parameters
        ----------
        X : indexable or pd.DataFrame, length n_samples
            Must fulfill the input assumptions of the
            underlying estimator.
        """
        X = _validate_X(X)
        return self.best_estimator_.transform(X)


    @if_delegate_has_method(delegate='estimator')