code: def train_lr(x_train, y_train, regularization=0.01, step=0.1):
      x = T.matrix("x")
      y = T.vector("y")
      w = theano.shared(rng.randn(feats), name="w")
      b = theano.shared(0.0, name="b")
  
      # Construct Theano expression graph
      p_1 = 1 / (
          1 + T.exp(-T.dot(x, w) - b)
      )  # Probability that target = 1
      prediction = p_1
      xent = -y * T.log(p_1) - (1 - y) * T.log(
          1 - p_1
      )  # Cross-entropy loss function
      cost = (
          xent.mean() + regularization * (w**2).sum()
      )  # The cost to minimize
      gw, gb = T.grad(cost, [w, b])  # Compute the gradient of the cost
      # (we shall return to this in a
      # following section of this tutorial)
  
      # Compile
      train = theano.function(
          inputs=[x, y],
          outputs=[prediction, xent],
          updates=((w, w - step * gw), (b, b - step * gb)),
      )
      predict = theano.function(inputs=[x], outputs=prediction)
  
      # Train
      for i in range(training_steps):
          train(x_train, y_train)
      return predict, w, b
  
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 1 for calling a global function with example usage: train_lr(x_train, y_train, regularization, step) and returns: predict,  w,  b