title: Python Optunity: how to pass additional arguments to optimization routines
body: <h2>Background</h2>
  
  <p>I am using a support vector machine for binary classification on unbalanced classes (i.e. the ratio of positive to negative labels in my training set is ~100). I would like to optimize the following parameters: m (the ratio of positive to negative labels I sample from my training data), w (the class weight), and the SVM parameter C.</p>
  
  <h2>Problem</h2>
  
  <p>I would like to optimize these parameters by doing a gridsearch, and have defined the score function as follows:</p>
  
  <pre><code>def svm_acc(X, y, m, w, c):
    X, y = balanceClasses(X, y, m)
    clf = svm.SVC(kernel='rbf', C=c, class_weight = {1: w})
    scores = cross_validation.cross_val_score(clf, X, y, 5)
    return( scores.mean() )
  </code></pre>
  
  <p>where X is the feature matrix, y are binary classification labels, and <code>svm_acc</code> returns the mean accuracy from 5-fold cross-validation. I have tried the following in optunity:</p>
  
  <pre><code>import optunity as opt
  s = opt.solvers.GridSearch(mult=[1,10], w=[1,10], c=[1,10])
  best_pars, _ = s.optimize(svm_acc, X=X, y=y)
  </code></pre>
  
  <p>but I get this error:</p>
  
  <pre><code>Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  TypeError: optimize() got an unexpected keyword argument 'X'
  </code></pre>
  
  <p>I gathered from the documentation that <code>optimize</code> does not take any additional keyword arguments (<code>X</code> and <code>y</code>). I have tried different variations of the above but have not been able to figure out how to pass additional parameters that should not be optimized to the routine.</p>
  
  <p>As far as I can see, I cannot use scikit-learn's gridsearch because I want to optimize the <code>m</code> parameter, which is not 'intrinsic' to the estimator. Could anybody point me to a solution or to other python packages for doing gridsearch?</p>