title: How to minimize with BFGS in Python?
body: <p>I have the following code in R:</p>
  
  <pre><code>LogLikelihood &lt;- function(c, x, y) {
      p &lt;- 1 / (1 + exp(-(c[1] + c[2] * x)))
      log_likelihood &lt;- sum(log(p[y == 1])) + sum(log(1 - p[y == 0]))
      return(-log_likelihood) # minus ll because we minimize in R
  }
  
  start_params &lt;- c(1, 1)
  optim_log_regression = optim(
      start_params,
      LogLikelihood,
      x = x,
      y = y,
      method = 'BFGS'
  )
  </code></pre>
  
  <p>I need an equivalent code for minimization in Python. So far, I think it might look something like this:</p>
  
  <pre><code>start_params = np.array([1, 1])
  res = minimize(log_likelihood, start_params, method='BFGS', options={'gtol': 
                 1e-6, 'disp': True})
  </code></pre>
  
  <p>How do I tell the minimize function to optimize only the argument "c" and somehow I need to provide "x" and "y". Can someone please help?</p>