Add benchmark for HistGradientBoostingClassifier
-from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
+from sklearn.experimental import enable_hist_gradient_boosting # noqa
+from sklearn.ensemble import (RandomForestClassifier,
+ GradientBoostingClassifier,
+ HistGradientBoostingClassifier)
from .common import Benchmark, Estimator, Predictor
from .datasets import (_20newsgroups_highdim_dataset,
- _20newsgroups_lowdim_dataset)
+ _20newsgroups_lowdim_dataset,
+ _synth_classification_dataset)
from .utils import make_gen_classif_scorers
@@ -79,3 +83,33 @@ class GradientBoostingClassifierBenchmark(Predictor, Estimator, Benchmark):
def make_scorers(self):
make_gen_classif_scorers(self)
+
+
+class HistGradientBoostingClassifierBenchmark(Predictor, Estimator, Benchmark):
+ """
+ Benchmarks for HistGradientBoostingClassifier.
+ """
+
+ param_names = []
+ params = ()
+
+ def setup_cache(self):
+ super().setup_cache()
+
+ def make_data(self, params):
+ data = _synth_classification_dataset(n_samples=10000,
+ n_features=100,
+ n_classes=5)
+
+ return data
+
+ def make_estimator(self, params):
+ estimator = HistGradientBoostingClassifier(max_iter=100,
+ max_leaf_nodes=15,
+ early_stopping=False,
+ random_state=0)
+
+ return estimator
+
+ def make_scorers(self):
+ make_gen_classif_scorers(self)
