class_docstr: Tests simple classification for different models. Note: still doesn't test all the models!
      
class_docstr_tok: ["Tests","simple","classification","for","different","models",".","Note",":","still","does","n't","test","all","the","models","!"]
docstr: Test imodels on basic binary classification task
          
docstr_tok: ["Test","imodels","on","basic","binary","classification","task"]
code: def test_classification_binary(self):
      """Test imodels on basic binary classification task"""
  
      for model_type in [
          BoostedRulesClassifier,
          TaoTreeClassifier,
          RuleFitClassifier,
          GreedyRuleListClassifier,
          SkopeRulesClassifier,
          OneRClassifier,
          SlipperClassifier,
          GreedyTreeClassifier,
          OptimalTreeClassifier,
          C45TreeClassifier,
          FIGSClassifier,
          TreeGAMClassifier,
      ]:  # IRFClassifier, SLIMClassifier, BayesianRuleSetClassifier,
          init_kwargs = {}
          if (
              model_type == SkopeRulesClassifier
              or model_type == FPSkopeClassifier
          ):
              init_kwargs["random_state"] = 0
              init_kwargs["max_samples_features"] = 1.0
          elif model_type == SlipperClassifier:
              init_kwargs["n_estimators"] = 1
          elif model_type == TreeGAMClassifier:
              init_kwargs["n_boosting_rounds"] = 10
          m = model_type(**init_kwargs)
  
          X = self.X_classification_binary
          m.fit(X, self.y_classification_binary)
  
          # test predict()
          preds = m.predict(X)  # > 0.5).astype(int)
          assert preds.size == self.n, "predict() yields right size"
  
          # test preds_proba()
          if model_type not in {
              OptimalRuleListClassifier,
              OptimalTreeClassifier,
          }:
              preds_proba = m.predict_proba(X)
              assert (
                  len(preds_proba.shape) == 2
              ), "preds_proba has 2 columns"
              assert (
                  preds_proba.shape[1] == 2
              ), "preds_proba has 2 columns"
              assert (
                  np.max(preds_proba) < 1.1
              ), "preds_proba has no values over 1"
              assert (np.argmax(preds_proba, axis=1) == preds).all(), (
                  "predict_proba and " "predict agree"
              )
  
          # test acc
          acc_train = np.mean(preds == self.y_classification_binary)
          # print(type(m), m, 'final acc', acc_train)
          assert acc_train > 0.8, "acc greater than 0.8"
  
imports: import random
  import numpy
  from imodels import *
label_desc: Use image node_id 2 for calling the TestClassClassificationContinuousInputs obj's underlying member method code with example usage: obj.test_classification_binary() without return types