0

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)
  • Check this answer out -> https://stackoverflow.com/questions/12200114/two-dimensional-optimization-minimization-in-python-using-scipy-optimize – D_Serg Apr 09 '18 at 17:30
  • I don't understand the question. You have a bunch of x values. How do they relate to the Gaussian distribution function, you create and for which you want to determine mu and sigma? You know, function x and f(x). What is your y value in this question? P.S.: And please delete your other question, which does in essence not differ. – Mr. T Apr 09 '18 at 18:41
  • I must implementation of maximum likelihood estimation and optimize sigma, m I think you have right, i dont need x but still I stuck becouse program dont know what is parameter (sigma, m) and what is only variable (x). – Bartłomiej Bojanowski Apr 09 '18 at 19:21

0 Answers0