4

I'm trying to use the lifetimes header to create the Recency, Frequency and T from a given data but it keeps showing the following error AttributeError: module 'scipy.misc' has no attribute 'logsumexp'

from lifetimes.plotting import *
from lifetimes.utils import *
from lifetimes.estimation import *
data = summary_data_from_transaction_data(df, 'CustomerID','InvoiceDate', monetary_value_col='Sales', observation_period_end='2011-12-9')
print(data.head())

The following output is received:

Traceback (most recent call last):
File "prj2.py", line 23, in <module>
from lifetimes.plotting import *
File "C:\Users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\lifetimes\__init__.py", line 5, in <module>
from .fitters.beta_geo_fitter import BetaGeoFitter
File "C:\Users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\lifetimes\fitters\beta_geo_fitter.py", line 9, in <module>
from autograd.scipy.special import gammaln, beta, gamma
File "C:\Users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\autograd\scipy\__init__.py", line 7, in <module>
from . import misc
File "C:\Users\AppData\Local\Programs\Python\Python37-32\lib\site-packages\autograd\scipy\misc.py", line 7, in <module>
logsumexp = primitive(scipy.misc.logsumexp)
AttributeError: module 'scipy.misc' has no attribute 'logsumexp'

The version of SciPy is 1.3.0 The code should generate a table with Recency, Frequency and T of each Customer

Shantanu
  • 43
  • 1
  • 4

2 Answers2

6

Downgrading to scipy==1.1.0 solves the issue

user7815551
  • 206
  • 1
  • 2
  • 6
1

Change from scipy.misc import logsumexpto from scipy.special import logsumexp

kelvinji
  • 1,166
  • 1
  • 8
  • 6
  • I tried both the solution, downgraded scipy version and changed to special instead of misc. But i still get same error. I am using this function on colab . Is there any other solution ? – j ' Jun 01 '21 at 19:29