Skip to content

Commit

Permalink
Major Refactor: SklearnOptimizer replace all old Optimizers
Browse files Browse the repository at this point in the history
  • Loading branch information
Caparrini committed Feb 27, 2024
1 parent 4cbce9b commit 783ba9a
Show file tree
Hide file tree
Showing 25 changed files with 467 additions and 623 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ dmypy.json
*testsdir
*testsfile
*testsfiles
*test
*testdir
*testfile
*testfiles
Expand Down
1 change: 0 additions & 1 deletion mloptimizer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from .genoptimizer.meta import SklearnOptimizer
from .genoptimizer import Hyperparam
79 changes: 79 additions & 0 deletions mloptimizer/conf/CustomXGBClassifier_default_HyperparamSpace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"fixed_hyperparams": {
"base_score": 0.5,
"booster": "gbtree",
"eval_metric": "auc"
},
"evolvable_hyperparams": {
"eta": {
"name": "eta",
"min_value": 0,
"max_value": 100,
"hyperparam_type": "float",
"scale": 100
},
"colsample_bytree": {
"name": "colsample_bytree",
"min_value": 3,
"max_value": 10,
"hyperparam_type": "float",
"scale": 10
},
"alpha": {
"name": "alpha",
"min_value": 0,
"max_value": 100,
"hyperparam_type": "int"
},
"lambda": {
"name": "lambda",
"min_value": 0,
"max_value": 100,
"hyperparam_type": "int"
},
"gamma": {
"name": "gamma",
"min_value": 0,
"max_value": 20,
"hyperparam_type": "int"
},
"max_depth": {
"name": "max_depth",
"min_value": 2,
"max_value": 20,
"hyperparam_type": "int"
},
"n_estimators": {
"name": "n_estimators",
"min_value": 100,
"max_value": 500,
"hyperparam_type": "int"
},
"subsample": {
"name": "subsample",
"min_value": 700,
"max_value": 1000,
"hyperparam_type": "float",
"scale": 1000
},
"num_boost_round": {
"name": "num_boost_round",
"min_value": 2,
"max_value": 100,
"hyperparam_type": "int"
},
"scale_pos_weight": {
"name": "scale_pos_weight",
"min_value": 15,
"max_value": 40,
"hyperparam_type": "float",
"scale": 100
},
"min_child_weight": {
"name": "min_child_weight",
"min_value": 0,
"max_value": 100,
"hyperparam_type": "int"
}
}
}
33 changes: 33 additions & 0 deletions mloptimizer/conf/ExtraTreesClassifier_default_HyperparamSpace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"fixed_hyperparams": {
"class_weight": "balanced"
},
"evolvable_hyperparams": {
"max_features": {
"name": "max_features",
"min_value": 1,
"max_value": 100,
"hyperparam_type": "float",
"scale": 100
},
"n_estimators": {
"name": "n_estimators",
"min_value": 5,
"max_value": 250,
"hyperparam_type": "int"
},
"max_depth": {
"name": "max_depth",
"min_value": 2,
"max_value": 20,
"hyperparam_type": "int"
},
"min_impurity_decrease": {
"name": "min_impurity_decrease",
"min_value": 0,
"max_value": 150,
"hyperparam_type": "float",
"scale": 1000
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"fixed_hyperparams": {
},
"evolvable_hyperparams": {
"max_features": {
"name": "max_features",
"min_value": 1,
"max_value": 100,
"hyperparam_type": "float",
"scale": 100
},
"n_estimators": {
"name": "n_estimators",
"min_value": 5,
"max_value": 250,
"hyperparam_type": "int"
},
"max_depth": {
"name": "max_depth",
"min_value": 2,
"max_value": 20,
"hyperparam_type": "int"
},
"min_impurity_decrease": {
"name": "min_impurity_decrease",
"min_value": 0,
"max_value": 150,
"hyperparam_type": "float",
"scale": 1000
},
"learning_rate": {
"name": "learning_rate",
"min_value": 1,
"max_value": 10000,
"hyperparam_type": "float",
"scale": 1000000
},
"subsample": {
"name": "subsample",
"min_value": 10,
"max_value": 100,
"hyperparam_type": "float",
"scale": 100
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"fixed_hyperparams": {
"class_weight": "balanced"
},
"evolvable_hyperparams": {
"max_features": {
"name": "max_features",
"min_value": 1,
"max_value": 100,
"hyperparam_type": "float",
"scale": 100
},
"n_estimators": {
"name": "n_estimators",
"min_value": 5,
"max_value": 250,
"hyperparam_type": "int"
},
"max_samples": {
"name": "max_samples",
"min_value": 10,
"max_value": 100,
"hyperparam_type": "float",
"scale": 100
},
"max_depth": {
"name": "max_depth",
"min_value": 2,
"max_value": 20,
"hyperparam_type": "int"
},
"min_impurity_decrease": {
"name": "min_impurity_decrease",
"min_value": 0,
"max_value": 150,
"hyperparam_type": "float",
"scale": 1000
}
}
}
31 changes: 31 additions & 0 deletions mloptimizer/conf/SVC_default_HyperparamSpace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"fixed_hyperparams": {
},
"evolvable_hyperparams": {
"C": {
"name": "C",
"min_value": 1,
"max_value": 10000,
"hyperparam_type": "float",
"scale": 10
},
"degree": {
"name": "degree",
"min_value": 0,
"max_value": 6,
"hyperparam_type": "int"
},
"gamma": {
"name": "gamma",
"min_value": 10,
"max_value": 100000000,
"hyperparam_type": "int"
},
"max_iter": {
"name": "max_iter",
"min_value": 100,
"max_value": 1000,
"hyperparam_type": "int"
}
}
}
52 changes: 52 additions & 0 deletions mloptimizer/conf/XGBClassifier_default_HyperparamSpace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"fixed_hyperparams": {
},
"evolvable_hyperparams": {
"colsample_bytree": {
"name": "colsample_bytree",
"min_value": 3,
"max_value": 10,
"hyperparam_type": "float",
"scale": 10
},
"gamma": {
"name": "gamma",
"min_value": 0,
"max_value": 20,
"hyperparam_type": "int"
},
"learning_rate": {
"name": "learning_rate",
"min_value": 1,
"max_value": 100,
"hyperparam_type": "float",
"scale": 1000
},
"max_depth": {
"name": "max_depth",
"min_value": 2,
"max_value": 20,
"hyperparam_type": "int"
},
"n_estimators": {
"name": "n_estimators",
"min_value": 100,
"max_value": 500,
"hyperparam_type": "int"
},
"subsample": {
"name": "subsample",
"min_value": 700,
"max_value": 1000,
"hyperparam_type": "float",
"scale": 1000
},
"scale_pos_weight": {
"name": "scale_pos_weight",
"min_value": 15,
"max_value": 40,
"hyperparam_type": "float",
"scale": 100
}
}
}
9 changes: 9 additions & 0 deletions mloptimizer/conf/default_hyperparameter_spaces.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"DecisionTreeClassifier": "DecisionTreeClassifier_default_HyperparamSpace.json",
"RandomForestClassifier": "RandomForestClassifier_default_HyperparamSpace.json",
"ExtraTreesClassifier": "ExtraTreesClassifier_default_HyperparamSpace.json",
"GradientBoostingClassifier": "GradientBoostingClassifier_default_HyperparamSpace.json",
"XGBClassifier": "XGBClassifier_default_HyperparamSpace.json",
"CustomXGBClassifier": "CustomXGBClassifier_default_HyperparamSpace.json",
"SVC": "SVC_default_HyperparamSpace.json"
}
3 changes: 0 additions & 3 deletions mloptimizer/genoptimizer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
from .base import BaseOptimizer
from .trees import TreeOptimizer, ForestOptimizer, ExtraTreesOptimizer, GradientBoostingOptimizer
from .xgb import XGBClassifierOptimizer, CustomXGBClassifierOptimizer
from .svc import SVCOptimizer
from .keras import KerasClassifierOptimizer
from .catboost import CatBoostClassifierOptimizer
from .meta import SklearnOptimizer
Loading

0 comments on commit 783ba9a

Please sign in to comment.