tBuLi / symfit

Symbolic Fitting; fitting as it should be.
http://symfit.readthedocs.org
MIT License
233 stars 17 forks source link

Try Likelihood function #110

Closed endytc closed 7 years ago

endytc commented 7 years ago

I tried likelihood function from this tutorial https://media.readthedocs.org/pdf/symfit/latest/symfit.pdf That code is from symfit import Parameter, Variable, Likelihood, exp import numpy as np beta = Parameter() x = Variable() model = (1 / beta) * exp(-x / beta) data = np.random.exponential(5.5, 100) fit = Likelihood(model, data) fit_result = fit.execute() I'm getting errors /usr/local/lib/python3.4/site-packages/symfit/core/fit.py:2071: RuntimeWarning: invalid value encountered in double_scalars can you help me to resolving this error? thank you.

pckroon commented 7 years ago

Hi,

it produces a warning, not an error (which is a big difference). Warnings you can pretty much always ignore in my experience - they're usually caused by some under or overflow encountered in either numpy or scipy. I get the same warning running it on my machine (py3.5, symfit 0.3.5), but it does give a reasonable fit (beta=6.0).

tBuLi commented 7 years ago

I agree with @Pitje06, if it produces the right fit then these warnings are nothing to worry about. Good luck in fitting your data!