i'm trying to maximize the log-likelihood function with python, using the funcion "minimize" from scipy.optimize.
declaring the log-likelihood function this way:
def like(mu,sigma,x):
l = -(len(x)/2)*np.log(2*np.pi) - (len(x)/2)*np.log(sigma)-(1/2*sigma)*np.dot((x-mu).T,(x-mu))
return -l
then trying to use "minimize" with method = "BFGS":
param = minimize(like,start_params,method="BFGS")
I get this error:
TypeError: like() missing 2 required positional arguments: 'sigma' and 'x'
Obviously i need to optimize w.r.t mu and sigma, given an x input vector.
Could somebody help with this ?