def __init__(self,
              n_estimators=10,
              criterion='gini',
              max_depth=None,
              min_samples_leaf=1,
              max_features='auto',
              bootstrap=True,
              n_jobs=None,
              random_state=None,
              verbose=False,
              use_histograms=False,
              hist_nbins=256,
              use_gpu=False,
              gpu_ids=None):
     assert pai4sk_installed, """Your Python environment does not have pai4sk installed. For installation instructions see: https://www.zurich.ibm.com/snapml/"""
     self._hyperparams = {
         'n_estimators': n_estimators,
         'criterion': criterion,
         'max_depth': max_depth,
         'min_samples_leaf': min_samples_leaf,
         'max_features': max_features,
         'bootstrap': bootstrap,
         'n_jobs': n_jobs,
         'random_state': random_state,
         'verbose': verbose,
         'use_histograms': use_histograms,
         'hist_nbins': hist_nbins,
         'use_gpu': use_gpu,
         'gpu_ids': gpu_ids
     }
     modified_hps = {**self._hyperparams}
     if modified_hps['gpu_ids'] is None:
         modified_hps['gpu_ids'] = [0]  #TODO: support list as default
     self._wrapped_model = pai4sk.RandomForestClassifier(**modified_hps)
示例#2
0
 def test_without_lale(self):
     import pai4sk
     clf = pai4sk.RandomForestClassifier()
     self.assertIsInstance(clf, pai4sk.RandomForestClassifier)
     fit_result = clf.fit(self.train_X, self.train_y)
     self.assertIsNone(fit_result)
     scorer = sklearn.metrics.make_scorer(sklearn.metrics.accuracy_score)
     accuracy = scorer(clf, self.test_X, self.test_y)
示例#3
0
 def __init__(
     self,
     n_estimators=10,
     criterion="gini",
     max_depth=None,
     min_samples_leaf=1,
     max_features="auto",
     bootstrap=True,
     n_jobs=None,
     random_state=None,
     verbose=False,
     use_histograms=False,
     hist_nbins=256,
     use_gpu=False,
     gpu_ids=None,
 ):
     assert (
         pai4sk_installed
     ), """Your Python environment does not have pai4sk installed. For installation instructions see: https://www.zurich.ibm.com/snapml/"""
     self._hyperparams = {
         "n_estimators": n_estimators,
         "criterion": criterion,
         "max_depth": max_depth,
         "min_samples_leaf": min_samples_leaf,
         "max_features": max_features,
         "bootstrap": bootstrap,
         "n_jobs": n_jobs,
         "random_state": random_state,
         "verbose": verbose,
         "use_histograms": use_histograms,
         "hist_nbins": hist_nbins,
         "use_gpu": use_gpu,
         "gpu_ids": gpu_ids,
     }
     modified_hps = {**self._hyperparams}
     if modified_hps["gpu_ids"] is None:
         modified_hps["gpu_ids"] = [0]  # TODO: support list as default
     self._wrapped_model = pai4sk.RandomForestClassifier(**modified_hps)