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_shrinkage(self):
      """Test imodels on basic binary classification task"""
  
      for model_type in [
          partial(
              HSTreeClassifier, estimator_=DecisionTreeClassifier()
          ),
          partial(
              HSTreeClassifier, estimator_=GradientBoostingClassifier()
          ),
          partial(
              HSTreeClassifier, estimator_=DecisionTreeClassifier()
          ),
          partial(
              HSTreeClassifierCV, estimator_=DecisionTreeClassifier()
          ),
          partial(
              HSTreeClassifierCV, estimator_=RandomForestClassifier()
          ),
          partial(
              HSC45TreeClassifierCV, estimator_=C45TreeClassifier()
          ),
          HSTreeClassifierCV,  # default estimator is Decision tree with 25 max_leaf_nodes
          # partial(HSOptimalTreeClassifierCV, estimator_=OptimalTreeClassifier()),
      ]:
          init_kwargs = {}
          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()
          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 correspond"
          )
  
          # 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"
  
          # complexity
          assert m.complexity_ > 0, "complexity is greater than 0"
  
file_path: imodels/tests/shrinkage_test.py
imports: import random
  from functools import partial
  import numpy
  from sklearn.ensemble import VotingRegressor, RandomForestClassifier, GradientBoostingClassifier
  from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
  from imodels import HSTreeClassifier, HSTreeClassifierCV, HSTreeRegressor, HSTreeRegressorCV, C45TreeClassifier
  from imodels.tree.c45_tree.c45_tree import HSC45TreeClassifierCV
  import random
  from functools import partial
  import numpy
  from sklearn.ensemble import VotingRegressor
  from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
  from imodels import HSTreeClassifier, HSTreeClassifierCV, HSTreeRegressor, HSTreeRegressorCV, C45TreeClassifier
  from imodels.tree.c45_tree.c45_tree import HSC45TreeClassifierCV
label_desc: Use image node_id 2 for calling the TestShrinkage obj's underlying member method code with example usage: obj.test_classification_shrinkage() without return types