Skip to content
Permalink
Browse files

exponential search space in first example on main page

  • Loading branch information...
claesenm committed Jul 23, 2015
1 parent 6249327 commit b7bbf70336af1abfa13e7fdeb006dacb40c2db90
Showing with 5 additions and 5 deletions.
  1. +4 −4 docs/examples/python/sklearn/svc.py
  2. +1 −1 setup.py
@@ -4,13 +4,13 @@

# score function: twice iterated 10-fold cross-validated accuracy
@optunity.cross_validated(x=data, y=labels, num_folds=10, num_iter=2)
def svm_auc(x_train, y_train, x_test, y_test, C, gamma):
model = sklearn.svm.SVC(C=C, gamma=gamma).fit(x_train, y_train)
def svm_auc(x_train, y_train, x_test, y_test, logC, logGamma):
model = sklearn.svm.SVC(C=10 ** logC, gamma=10 ** logGamma).fit(x_train, y_train)
decision_values = model.decision_function(x_test)
return optunity.metrics.roc_auc(y_test, decision_values)

# perform tuning
optimal_pars, _, _ = optunity.maximize(svm_auc, num_evals=200, C=[0, 10], gamma=[0, 1])
hps, _, _ = optunity.maximize(svm_auc, num_evals=200, logC=[-5, 2], logGamma=[-5, 1])

# train model on the full training set with tuned hyperparameters
optimal_model = sklearn.svm.SVC(**optimal_pars).fit(data, labels)
optimal_model = sklearn.svm.SVC(C=10 ** hps['logC'], gamma=10 ** hps['logGamma']).fit(data, labels)
@@ -3,7 +3,7 @@

setup(
name = 'Optunity',
version = '1.1.0',
version = '1.1.1',
author = 'Marc Claesen',
author_email = 'marc.claesen@esat.kuleuven.be',
packages = ['optunity', 'optunity.tests', 'optunity.solvers'],

0 comments on commit b7bbf70

Please sign in to comment.
You can’t perform that action at this time.