How to use the tpot.operators_disable.preprocessors.base.Preprocessor function in TPOT

To help you get started, we’ve selected a few TPOT examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EpistasisLab / tpot / tpot / operators_disable / preprocessors / rbf.py View on Github external
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.

The TPOT library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License along
with the TPOT library. If not, see http://www.gnu.org/licenses/.

"""

from .base import Preprocessor
from sklearn.kernel_approximation import RBFSampler


class TPOTRBFSampler(Preprocessor):
    """Uses scikit-learn's RBFSampler to transform the feature set

    Parameters
    ----------
    gamma: float
        Parameter of RBF kernel: exp(-gamma * x^2)

    """
    import_hash = {'sklearn.kernel_approximation': ['RBFSampler']}
    sklearn_class = RBFSampler
    arg_types = (float, )

    def __init__(self):
        pass

    def preprocess_args(self, gamma):
github EpistasisLab / tpot / tpot / operators_disable / preprocessors / min_max_scalar.py View on Github external
modify it under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.

The TPOT library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License along
with the TPOT library. If not, see http://www.gnu.org/licenses/.

"""

from .base import Preprocessor
from sklearn.preprocessing import MinMaxScaler

class TPOTMaxAbsScaler(Preprocessor):

    """Uses scikit-learn's MinMaxScaler to transform all of the features by scaling them to the range [0, 1].
    
    Parameters
    ----------
    None
    """

    import_hash = {'sklearn.preprocessing': ['MinMaxScaler']}
    sklearn_class = MinMaxScaler
    arg_types = ()

    def __init__(self):
        pass

    def preprocess_args(self):
github EpistasisLab / tpot / tpot / operators_disable / preprocessors / pca.py View on Github external
modify it under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.

The TPOT library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License along
with the TPOT library. If not, see http://www.gnu.org/licenses/.

"""

from .base import Preprocessor
from sklearn.decomposition import PCA

class TPOTRandomizedPCA(Preprocessor):

    """Uses scikit-learn's randomized PCA to transform the feature set

    Parameters
    ----------
    iterated_power: int
        Number of iterations for the power method. [1, 10]
    """

    import_hash = {'sklearn.decomposition': ['PCA']}
    sklearn_class = PCA
    arg_types = (int, )

    def __init__(self):
        pass
github EpistasisLab / tpot / tpot / operators_disable / preprocessors / feat_agg.py View on Github external
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.

The TPOT library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License along
with the TPOT library. If not, see http://www.gnu.org/licenses/.

"""

from .base import Preprocessor
from sklearn.cluster import FeatureAgglomeration


class TPOTFeatureAgglomeration(Preprocessor):
    """Uses scikit-learn's Nystroem to transform the feature set

    Parameters
    ----------
    affinity: int
        Metric used to compute the linkage. Can be "euclidean", "l1", "l2",
        "manhattan", "cosine", or "precomputed". If linkage is "ward", only
        "euclidean" is accepted.
        Input integer is used to select one of the above strings.
    linkage: int
        Can be one of the following values:
            "ward", "complete", "average"
        Input integer is used to select one of the above strings.

    """
    import_hash = {'sklearn.cluster': ['FeatureAgglomeration']}
github EpistasisLab / tpot / tpot / operators_disable / preprocessors / binarizer.py View on Github external
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.

The TPOT library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License along
with the TPOT library. If not, see http://www.gnu.org/licenses/.

"""

from .base import Preprocessor
from sklearn.preprocessing import Binarizer


class TPOTBinarizer(Preprocessor):
    """Uses scikit-learn's Binarizer to transform the feature set

    Parameters
    ----------
    threshold: float
        Feature values below or equal to this value are replaced by 0, above it by 1

    """
    import_hash = {'sklearn.preprocessing': ['Binarizer']}
    sklearn_class = Binarizer
    arg_types = (float, )

    def __init__(self):
        pass

    def preprocess_args(self, threshold):
github EpistasisLab / tpot / tpot / operators_disable / preprocessors / normalizer.py View on Github external
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.

The TPOT library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License along
with the TPOT library. If not, see http://www.gnu.org/licenses/.

"""

from .base import Preprocessor
from sklearn.preprocessing import Normalizer


class TPOTNormalizer(Preprocessor):
    """Uses scikit-learn's Normalizer to normalize samples individually to unit norm

    Parameters
    ----------
    norm: 'l1', 'l2', or 'max'
        The norm to use to normalize each non zero sample.

    """
    import_hash = {'sklearn.preprocessing': ['Normalizer']}
    sklearn_class = Normalizer
    arg_types = (int, )

    def __init__(self):
        pass

    def preprocess_args(self, norm):
github EpistasisLab / tpot / tpot / operators_disable / preprocessors / standard_scaler.py View on Github external
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.

The TPOT library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License along
with the TPOT library. If not, see http://www.gnu.org/licenses/.

"""

from .base import Preprocessor
from sklearn.preprocessing import StandardScaler


class TPOTStandardScaler(Preprocessor):
    """Uses scikit-learn's StandardScaler to transform the feature set

    Parameters
    ----------
    None

    """
    import_hash = {'sklearn.preprocessing': ['StandardScaler']}
    sklearn_class = StandardScaler
    arg_types = ()

    def __init__(self):
        pass

    def preprocess_args(self):
        return {
github EpistasisLab / tpot / tpot / operators_disable / preprocessors / nystroem.py View on Github external
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.

The TPOT library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License along
with the TPOT library. If not, see http://www.gnu.org/licenses/.

"""

from .base import Preprocessor
from sklearn.kernel_approximation import Nystroem


class TPOTNystroem(Preprocessor):
    """Uses scikit-learn's Nystroem to transform the feature set

    Parameters
    ----------
    kernel: int
        Kernel type is selected from scikit-learn's provided types:
            'sigmoid', 'polynomial', 'additive_chi2', 'poly', 'laplacian', 'cosine', 'linear', 'rbf', 'chi2'

        Input integer is used to select one of the above strings.
    gamma: float
        Gamma parameter for the kernels.
    n_components: int
        The number of components to keep

    """
    import_hash = {'sklearn.kernel_approximation': ['Nystroem']}
github EpistasisLab / tpot / tpot / operators_disable / preprocessors / fast_ica.py View on Github external
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.

The TPOT library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License along
with the TPOT library. If not, see http://www.gnu.org/licenses/.

"""

from .base import Preprocessor
from sklearn.decomposition import FastICA


class TPOTFastICA(Preprocessor):
    """Uses scikit-learn's FastICA to transform the feature set

    Parameters
    ----------
    tol: float
        Tolerance on update at each iteration.

    """
    import_hash = {'sklearn.decomposition': ['FastICA']}
    sklearn_class = FastICA
    arg_types = (float, )

    def __init__(self):
        pass

    def preprocess_args(self, tol):
github EpistasisLab / tpot / tpot / operators_disable / preprocessors / polynomial_features.py View on Github external
Free Software Foundation, either version 3 of the License, or (at your option)
any later version.

The TPOT library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details. You should have received a copy of the GNU General Public License along
with the TPOT library. If not, see http://www.gnu.org/licenses/.

"""

from .base import Preprocessor
from sklearn.preprocessing import PolynomialFeatures


class TPOTPolynomialFeatures(Preprocessor):
    """Uses scikit-learn's PolynomialFeatures to transform the feature set

    Parameters
    ----------
    None

    """
    import_hash = {'sklearn.preprocessing': ['PolynomialFeatures']}
    sklearn_class = PolynomialFeatures
    arg_types = ()

    def __init__(self):
        pass

    def preprocess_args(self):
        return {