I have data x
and I want to optimize two parameters m
,s
, but i don't know how do that. I trying many of option but still it's no working. Result of esti_parametrs should be [0,1]
. Can someone help me?
from scipy import optimize
import numpy as np
x=np.random.randn(100)
def gaus(x,m,s):
return np.log(1 / (np.sqrt(2 * np.pi) * s) * np.exp(- (x - m) ** 2 / (2 * s ** 2)))
initial_guess=[0,0]
esti_parametrs=optimize.minimize(lambda m,s: -gaus(x,m,s),initial_guess)
print(esti_parametrs)