Skip to content

Commit

Permalink
Fixed: SVC Fixed and tested
Browse files Browse the repository at this point in the history
  • Loading branch information
Caparrini committed Feb 23, 2024
1 parent 3e54c16 commit bd6e1c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
18 changes: 4 additions & 14 deletions mloptimizer/genoptimizer/svc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,14 @@ def get_default_hyperparams():
default_hyperparams = {
'C': Hyperparam("C", 1, 10000, float, 10),
'degree': Hyperparam("degree", 0, 6, int),
'gamma': Hyperparam("gamma", 10, 100000000, float, 100)
'gamma': Hyperparam("gamma", 10, 100000000, float, 100),
'max_iter': Hyperparam("max_iter", 100, 1000, int)
}
return default_hyperparams

def get_clf(self, individual):
individual_dict = self.individual2dict(individual)
clf = SVC(C=individual_dict['C'],
cache_size=8000000,
class_weight="balanced",
coef0=0.0,
decision_function_shape='ovr',
degree=individual_dict['degree'], gamma=individual_dict['gamma'],
kernel='rbf',
max_iter=100000,
probability=False,
random_state=None,
shrinking=True,
tol=0.001,
verbose=False
clf = SVC(random_state=self.mlopt_seed,
**individual_dict
)
return clf
4 changes: 2 additions & 2 deletions mloptimizer/test/test_genoptimizer/test_optimizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
(TreeOptimizer, ForestOptimizer,
ExtraTreesOptimizer, GradientBoostingOptimizer,
XGBClassifierOptimizer,
# SVCOptimizer,
SVCOptimizer,
KerasClassifierOptimizer))
@pytest.mark.parametrize('dataset',
(load_breast_cancer, load_iris))
Expand All @@ -44,7 +44,7 @@ def test_get_subclasses():

@pytest.mark.parametrize('optimizer',
(TreeOptimizer, ForestOptimizer,
# ExtraTreesOptimizer, GradientBoostingOptimizer,
ExtraTreesOptimizer, GradientBoostingOptimizer,
XGBClassifierOptimizer,
# SVCOptimizer,KerasClassifierOptimizer
))
Expand Down

0 comments on commit bd6e1c8

Please sign in to comment.