ColtAllen / btyd

Buy Till You Die and Customer Lifetime Value statistical models in Python.
https://btyd.readthedocs.io/
Apache License 2.0
114 stars 9 forks source link

Missing arguments on BetaGeoFitter.fit #80

Closed hedgehog-abraxas closed 2 years ago

hedgehog-abraxas commented 2 years ago

Hi!

My name is Antonio and I tried to use you library, I was following the user guide when I tried to use the function BetaGeoFitter().fit(data) i received the following error:

image

I went to the code and I see that we can pass the values as a np array so I tried and another error arise:

image

ColtAllen commented 2 years ago

Hey @hedgehog-abraxas,

(Cool username, by the way.)

This should fix your issue:

from btyd import BetaGeoFitter

# Similar API to scikit-learn.
bgm = BetaGeoFitter().fit(frequency = data['frequency'].values, recency = data['recency'].values, T = data['T'].values)
print(bgm)

You were passing in Pandas Series objects rather than numpy arrays, which is a common mistake with the legacy Fitter models. The new Model modules do not have this problem because the entire dataframe is provided in a single argument.

Also, the User Guide should reference BetaGeoModel instead of BetaGeoFitter, so thanks for pointing that out. I've made the necessary edits to the documentation, which should update in about 24 hours. It's important to note the Model classes do not support any of the plotting functions yet, so continue to use BetaGeoFitter if you require any diagnostic plots at this time.

hedgehog-abraxas commented 2 years ago

Thanks for your answer, it was very helpful. Cheers!