How to use the tpot.operators_disable.selectors.base.Selector 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 / selectors / select_from_model.py View on Github external
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 Selector
from sklearn.feature_selection import SelectFromModel
from sklearn.ensemble import ExtraTreesClassifier


class TPOTSelectFromModel(Selector):
    """Uses scikit-learn's ExtraTreesClassifier combined with SelectFromModel
    to transform the feature set.

    Parameters
    ----------
    threshold: float
        Features whose importance is greater or equal are kept while the others
        are discarded.
    criterion: int
        For the ExtraTreesClassifier:
        Integer that is used to select from the list of valid criteria,
        either 'gini', or 'entropy'
    max_features: float
        For the ExtraTreesClassifier:
        The number of features to consider when looking for the best split
github EpistasisLab / tpot / tpot / operators_disable / selectors / select_percentile.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 Selector
from sklearn.feature_selection import SelectPercentile, f_classif


class TPOTSelectPercentile(Selector):
    """Uses scikit-learn's SelectPercentile to transform the feature set

    Parameters
    ----------
    percentile: int
        The features that belong in the top percentile to keep from the original
        set of features in the training data

    """
    import_hash = {'sklearn.feature_selection': ['SelectPercentile', 'f_classif']}
    sklearn_class = SelectPercentile
    arg_types = (int, )

    def __init__(self):
        pass
github EpistasisLab / tpot / tpot / operators_disable / selectors / select_from_model_r.py View on Github external
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 Selector
from sklearn.feature_selection import SelectFromModel
from sklearn.ensemble import ExtraTreesRegressor


class TPOTSelectFromModelR(Selector):
    """Uses scikit-learn's ExtraTreesRegressor combined with SelectFromModel
    to transform the feature set.

    Parameters
    ----------
    threshold: float
        Features whose importance is greater or equal are kept while the others
        are discarded.
    max_features: float
        For the ExtraTreesRegressor:
        The number of features to consider when looking for the best split

    """
    import_hash = {
        'sklearn.feature_selection': ['SelectFromModel'],
        'sklearn.ensemble':          ['ExtraTreesRegressor']
github EpistasisLab / tpot / tpot / operators_disable / selectors / rfe.py View on Github external
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 Selector
from sklearn.feature_selection import RFE
from sklearn.svm import SVC


class TPOTRFE(Selector):
    """Uses scikit-learn's RFE to transform the feature set

    Parameters
    ----------
    step: float
        The percentage of features to drop each iteration

    """
    import_hash = {'sklearn.feature_selection': ['RFE'], 'sklearn.svm': ['SVC']}
    sklearn_class = RFE
    arg_types = (float, )
    regression = False  # Can not be used in regression due to SVC estimator

    def __init__(self):
        pass
github EpistasisLab / tpot / tpot / operators_disable / selectors / select_fwe.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 Selector
from sklearn.feature_selection import SelectFwe, f_classif


class TPOTSelectFwe(Selector):
    """Uses scikit-learn's SelectFwe to transform the feature set

    Parameters
    ----------
    alpha: float in the range [0.001, 0.05]
        The highest uncorrected p-value for features to keep

    """
    import_hash = {'sklearn.feature_selection': ['SelectFwe', 'f_classif']}
    sklearn_class = SelectFwe
    arg_types = (float, )

    def __init__(self):
        pass

    def preprocess_args(self, alpha):
github EpistasisLab / tpot / tpot / operators_disable / selectors / variance_threshold.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 Selector
from sklearn.feature_selection import VarianceThreshold


class TPOTVarianceThreshold(Selector):
    """Uses scikit-learn's VarianceThreshold to transform the feature set

    Parameters
    ----------
    threshold: float
        The variance threshold that removes features that fall under the threshold

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

    def __init__(self):
        pass

    def preprocess_args(self, threshold):
github EpistasisLab / tpot / tpot / operators_disable / selectors / select_kbest.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 Selector
from sklearn.feature_selection import SelectKBest, f_classif


class TPOTSelectKBest(Selector):
    """Uses scikit-learn's SelectKBest to transform the feature set

    Parameters
    ----------
    k: int
        The top k features to keep from the original set of features in the training data

    """
    import_hash = {'sklearn.feature_selection': ['SelectKBest', 'f_classif']}
    sklearn_class = SelectKBest
    arg_types = (int, )

    def __init__(self):
        pass

    def preprocess_args(self, k):