From 937da1297c939358e2ffc10464cac20c336ce66c Mon Sep 17 00:00:00 2001 From: Navaneesh Gangala Date: Sat, 19 Oct 2019 12:48:43 +0530 Subject: [PATCH 1/2] Updated regression for compatilibility --- hunga_bunga/regression.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hunga_bunga/regression.py b/hunga_bunga/regression.py index 0a9967a..10edb22 100644 --- a/hunga_bunga/regression.py +++ b/hunga_bunga/regression.py @@ -21,8 +21,8 @@ from sklearn.linear_model import LinearRegression, Ridge, Lasso, ElasticNet, Lars, LassoLars, OrthogonalMatchingPursuit, BayesianRidge, ARDRegression, SGDRegressor, PassiveAggressiveRegressor, RANSACRegressor, HuberRegressor -from core import * -from params import * +from hunga_bunga.core import * +from hunga_bunga.params import * linear_models_n_params = [ From 8ea76bef26528a0f184787377e11bf6bfb2ce545 Mon Sep 17 00:00:00 2001 From: Navaneesh Gangala Date: Sat, 19 Oct 2019 15:04:10 +0530 Subject: [PATCH 2/2] Add module for gradient boosting for regression and classification, resolves #1 --- hunga_bunga/classification.py | 15 ++++++++++++--- hunga_bunga/regression.py | 12 ++++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/hunga_bunga/classification.py b/hunga_bunga/classification.py index 7871f36..5fd3603 100644 --- a/hunga_bunga/classification.py +++ b/hunga_bunga/classification.py @@ -24,9 +24,10 @@ from sklearn.base import ClassifierMixin from sklearn.base import RegressorMixin from sklearn.base import is_classifier +from sklearn.ensemble import GradientBoostingClassifier -from core import * -from params import * +from hunga_bunga.core import * +from hunga_bunga.params import * linear_models_n_params = [ @@ -157,7 +158,11 @@ (ExtraTreesClassifier, {'n_estimators': n_estimators, 'max_features': max_features, 'max_depth': max_depth, 'min_samples_split': min_samples_split, 'min_samples_leaf': min_samples_leaf, 'min_impurity_split': min_impurity_split, 'warm_start': warm_start, - 'criterion': ['gini', 'entropy']}) + 'criterion': ['gini', 'entropy']}), + + (GradientBoostingClassifier, + {'n_estimators': n_estimators, 'max_features': max_features, 'max_depth': max_depth, 'min_samples_split': min_samples_split, + 'min_samples_leaf': min_samples_leaf, 'min_impurity_split': min_impurity_split, 'warm_start': warm_start}) ] tree_models_n_params_small = [ @@ -171,6 +176,10 @@ }), (ExtraTreesClassifier, + {'n_estimators_small': n_estimators_small, 'max_features_small': max_features_small, 'max_depth_small': max_depth_small, + 'min_samples_split': min_samples_split, 'min_samples_leaf': min_samples_leaf}), + + (GradientBoostingClassifier, {'n_estimators_small': n_estimators_small, 'max_features_small': max_features_small, 'max_depth_small': max_depth_small, 'min_samples_split': min_samples_split, 'min_samples_leaf': min_samples_leaf}) ] diff --git a/hunga_bunga/regression.py b/hunga_bunga/regression.py index 10edb22..af73510 100644 --- a/hunga_bunga/regression.py +++ b/hunga_bunga/regression.py @@ -19,7 +19,7 @@ from sklearn.gaussian_process.kernels import RBF, ConstantKernel, DotProduct, WhiteKernel from sklearn.ensemble import AdaBoostRegressor, ExtraTreesRegressor, RandomForestRegressor from sklearn.linear_model import LinearRegression, Ridge, Lasso, ElasticNet, Lars, LassoLars, OrthogonalMatchingPursuit, BayesianRidge, ARDRegression, SGDRegressor, PassiveAggressiveRegressor, RANSACRegressor, HuberRegressor - +from sklearn.ensemble import GradientBoostingRegressor from hunga_bunga.core import * from hunga_bunga.params import * @@ -271,6 +271,10 @@ {'n_estimators': n_estimators, 'max_features': max_features, 'max_depth': max_depth, 'min_samples_split': min_samples_split, 'min_samples_leaf': min_samples_leaf, 'min_impurity_split': min_impurity_split, 'warm_start': warm_start, 'criterion': ['mse', 'mae']}), + + (GradientBoostingRegressor, + {'n_estimators': n_estimators, 'max_features': max_features, 'max_depth': max_depth, 'min_samples_split': min_samples_split, + 'min_samples_leaf': min_samples_leaf, 'min_impurity_split': min_impurity_split, 'warm_start': warm_start}), ] @@ -282,7 +286,11 @@ (ExtraTreesRegressor, {'n_estimators': n_estimators_small, 'max_features': max_features_small, 'max_depth': max_depth_small, 'min_samples_split': min_samples_split, 'min_samples_leaf': min_samples_leaf, - 'criterion': ['mse', 'mae']}) + 'criterion': ['mse', 'mae']}), + + (GradientBoostingRegressor, + {'n_estimators': n_estimators_small, 'max_features': max_features_small, 'max_depth': max_depth_small, 'min_samples_split': min_samples_split, + 'min_samples_leaf': min_samples_leaf}) ]