code: def lr_tuned(x_train, y_train, x_test, y_test):
      @optunity.cross_validated(x=x_train, y=y_train, num_folds=3)
      def inner_cv(
          x_train, y_train, x_test, y_test, regularization, step
      ):
          predict, _, _ = train_lr(
              x_train, y_train, regularization=regularization, step=step
          )
          yhat = predict(x_test)
          return optunity.metrics.logloss(y_test, yhat)
  
      pars, _, _ = optunity.minimize(
          inner_cv,
          num_evals=50,
          regularization=[0.001, 0.05],
          step=[0.01, 0.2],
      )
      predict, w, b = train_lr(x_train, y_train, **pars)
      yhat = predict(x_test)
      loss = optunity.metrics.logloss(y_test, yhat)
      brier = optunity.metrics.brier(y_test, yhat)
      print(
          "+ model: "
          + str(b.get_value())[:5]
          + " + "
          + str(w.get_value()[0])[:5]
          + " * x1 + "
          + str(w.get_value()[1])[:5]
          + " * x2"
      )
      print("++ log loss in test fold: " + str(loss))
      print("++ Brier loss in test fold: " + str(brier))
      print("")
      return loss, brier
  
file_path: optunity/bin/examples/python/theano/logistic_regression.py
imports: import numpy
  import theano
  import theano.tensor
  from numpy.random import multivariate_normal
  import optunity
  import optunity.metrics
label_desc: Use image node_id 3 for calling a global function with example usage: lr_tuned(x_train, y_train, x_test, y_test) and returns: loss,  brier, optunity