How to use an optimizer: 1) Provide a function to optimize, e.g f(x) = x**2+4 2) Provide an initial guess 3) Call the optimizer import scipy.optimize as spo min_result = spo.minimize(f, guess, method='SLSQP', options={'disp': True}) print min_result.x, min_result.fun Functions with multiple minima, any discontinuities or zero slope can be hard to minimize. Parameterized model e.g. f(x) = mx + b <-- model with two parameters m, b now we can use an optimizer to minimise the squared error to find the line of best fit for the model given the data