Expand source code
from imodels.rule_set.boosted_rules import BoostedRulesClassifier
from imodels.rule_set.slipper_util import SlipperBaseEstimator
from imodels.util.arguments import check_binary_target


class SlipperClassifier(BoostedRulesClassifier):
    def __init__(self, n_estimators=10, **kwargs):
        '''
        An estimator that supports building rules as described in
        A Simple, Fast, and Effective Rule Learner (1999).
        Parameters
        ----------
        n_estimators
        '''
        super().__init__(estimator=SlipperBaseEstimator(), n_estimators=n_estimators, **kwargs)

    def fit(self, X, y, feature_names=None, **kwargs):
        # its base estimator learns a single binary rule, so a multiclass target
        # otherwise fails deep inside boosting with a shape mismatch
        check_binary_target(self, y)
        return super().fit(X, y, feature_names=feature_names, **kwargs)

Classes

class SlipperClassifier (n_estimators=10, **kwargs)

An easy-interpretable classifier optimizing simple logical rules.

Params

estimator: object with fit and predict methods Defaults to DecisionTreeClassifier with AdaBoost. For SLIPPER, should pass estimator=imodels.SlipperBaseEstimator

An estimator that supports building rules as described in A Simple, Fast, and Effective Rule Learner (1999). Parameters


n_estimators
 
Expand source code
class SlipperClassifier(BoostedRulesClassifier):
    def __init__(self, n_estimators=10, **kwargs):
        '''
        An estimator that supports building rules as described in
        A Simple, Fast, and Effective Rule Learner (1999).
        Parameters
        ----------
        n_estimators
        '''
        super().__init__(estimator=SlipperBaseEstimator(), n_estimators=n_estimators, **kwargs)

    def fit(self, X, y, feature_names=None, **kwargs):
        # its base estimator learns a single binary rule, so a multiclass target
        # otherwise fails deep inside boosting with a shape mismatch
        check_binary_target(self, y)
        return super().fit(X, y, feature_names=feature_names, **kwargs)

Ancestors

  • BoostedRulesClassifier
  • sklearn.ensemble._weight_boosting.AdaBoostClassifier
  • sklearn.utils._metadata_requests._RoutingNotSupportedMixin
  • sklearn.base.ClassifierMixin
  • sklearn.ensemble._weight_boosting.BaseWeightBoosting
  • sklearn.ensemble._base.BaseEnsemble
  • sklearn.base.MetaEstimatorMixin
  • sklearn.base.BaseEstimator
  • sklearn.utils._repr_html.base.ReprHTMLMixin
  • sklearn.utils._repr_html.base._HTMLDocumentationLinkMixin
  • sklearn.utils._metadata_requests._MetadataRequester

Inherited members