0

I'm trying to understand how to use symfit for fitting some data and I run the next example:

from symfit import Parameter, Variable, exp
from symfit.core.objectives import LogLikelihood
import numpy as np

# Define the model for an exponential distribution (numpy style)
beta = Parameter('beta')
x = Variable('x')
model = (1 / beta) * exp(-x / beta)

# Draw 100 samples from an exponential distribution with beta=5.5
data = np.random.exponential(5.5, 100)

# Do the fitting!
fit = Fit(model, data, objective=LogLikelihood)
fit_result = fit.execute()

From this page: https://symfit.readthedocs.io/en/stable/fitting_types.html and I'm getting the next error:

AttributeError: 'Derivative' object has no attribute 'derivative_count'

What's wrong with the example?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
  • your code runs without error on Linux Mint 19.2, Python 3.7.4, symfit 0.5.1. I had to only add `from symfit import Fit` – furas Sep 15 '19 at 04:05
  • @furas, the code runs without error when I create a new enviroment without default packages and installing numpy, pandas, matplotlib, seaborn, symfit and then uninstalling sympy 1.4 and re-installing sympy 1.1.1 with pip. Do you understand what's happening? I'm working in windows 10... – Charlie Vargas Sarmiento Sep 15 '19 at 19:01
  • maybe there was conflict with other module or they changed something in other module which is used in `symfit` and it has to use older one. – furas Sep 15 '19 at 22:24

0 Answers0