Skip to content

Use type_of_target in all classifiers to reject regression targets #5060

Closed

Description

@amueller

I think we should use type_of_target / unique_labels in all classifiers to reject regression targets. Also adding a common test, clearly.

wdyt? @arjoly @jnothman @GaelVaroquaux might be interested.

Activity

  1. added
    Moderate
    on Jul 30, 2015
  2. amueller commented on Jul 30, 2015

    @amueller
    MemberAuthor

    The following classifiers run on regression targets (and do garbage and possibly run very long)

    from sklearn.datasets import load_boston
    boston = load_boston()
    from sklearn.utils.testing import all_estimators
    classifiers = all_estimators(type_filter="classifier")
    
    for name, Cl in classifiers:
        try:
            Cl().fit(boston.data, boston.target)
        except Exception as e:
            pass
        else:
            print(name)

    AdaBoostClassifier
    BaggingClassifier
    DecisionTreeClassifier
    ExtraTreeClassifier
    ExtraTreesClassifier
    GradientBoostingClassifier
    KNeighborsClassifier
    LabelPropagation
    LabelSpreading
    LinearSVC
    LogisticRegression
    LogisticRegressionCV
    NearestCentroid
    RadiusNeighborsClassifier
    RandomForestClassifier
    SVC

  3. vermouthmjl commented on Aug 4, 2015

    @vermouthmjl
    Contributor

    I can try this.

  4. amueller commented on Aug 4, 2015

    @amueller
    MemberAuthor

    sure, go for it :)

  5. vermouthmjl commented on Aug 4, 2015

    @vermouthmjl
    Contributor
  6. glouppe commented on Oct 20, 2015

    @glouppe
    Contributor

    Closed by #5084

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementModerate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions