code: def compute_roc_tuned(x_train, y_train, x_test, y_test):
      # define objective function
      @optunity.cross_validated(
          x=x_train, y=y_train, num_iter=2, num_folds=5
      )
      def inner_cv(
          x_train,
          y_train,
          x_test,
          y_test,
          kernel="linear",
          C=0,
          gamma=0,
          degree=0,
          coef0=0,
      ):
          model = train_model(
              x_train, y_train, kernel, C, gamma, degree, coef0
          )
          decision_values = model.decision_function(x_test)
          return optunity.metrics.roc_auc(y_test, decision_values)
  
      # optimize parameters
      optimal_pars, _, _ = optunity.maximize_structured(
          inner_cv, space, 70, pmap=optunity.pmap
      )
      print("optimal parameters after tuning %s" % str(optimal_pars))
      # if you are running this in IPython, optunity.pmap will not work
      # more info at: https://github.com/claesenm/optunity/issues/8
      # comment out the above line and replace by the one below:
      # optimal_pars, _, _ = optunity.maximize_structured(inner_cv, space, 200)
  
      tuned_model = train_model(x_train, y_train, **optimal_pars)
      decision_values = tuned_model.decision_function(x_test)
      auc = optunity.metrics.roc_auc(y_test, decision_values)
      return auc
  
file_path: optunity/bin/examples/python/sklearn/svc_structured.py
imports: import optunity
  import optunity.metrics
  import sklearn.svm
  import numpy
  import time
  from sklearn.datasets import load_digits
label_desc: Use image node_id 3 for calling a global function with example usage: compute_roc_tuned(x_train, y_train, x_test, y_test) and returns: auc, optunity