CamDavidsonPilon / lifetimes

Lifetime value in Python
MIT License
1.45k stars 375 forks source link

Can I use negative monetary_value to fit GammaGammaFitter & calculate CLV? #211

Closed yanwu0105 closed 5 years ago

yanwu0105 commented 6 years ago

In my project, I will use the net profit to be monetary_value . So monetary_value have some negative, but it will be error. how can I use negative monetary_value to fit GammaGammaFitter & calculate CLV?

CamDavidsonPilon commented 6 years ago

I don't think so - an underlying Gamma distribution assumes positive random variables. One hack could be to shift all your observations by the minimum profit value plus some epsilon (so everything is positive), fit the model, and then "reverse" the shift when you predict new profits (subtract by the minimum and epsilon).

Trollgeir commented 6 years ago

Are you able to get the raw profits for monetary_value instead? I think it could be cleaner to calculate the net profit by post-processing the CLV.

yanwu0105 commented 6 years ago

Yes, I use raw net profits. In our office, we will use raw cost to calculate profits. so, the net profit will have negative. so can i use it to calculate CLV?

yanwu0105 commented 6 years ago

@CamDavidsonPilon @Trollgeir thank you to answer me . I want to check the customer_lifetime_value the CLV is average CLV? so if t=12, the total CLV will be *12 ?

Trollgeir commented 6 years ago

t=12 for customer_lifetime_value is 12 months, so 30*12 days. The CLV result is how much money you expect the customer to spend over those 12 months.

yanwu0105 commented 6 years ago

@Trollgeir Thanks you, I have a new question. conditional_expected_average_profit This is to calculate the profit in the period? this is average or total?

Trollgeir commented 6 years ago

From what I understand it, it is an estimate of the average monetary value for transactions on a customer level. In other words, for each customer, you can estimate how much money they will give per transaction.

This is all under the assumption that there is no correlation between frequency and monetary value for transactions: https://lifetimes.readthedocs.io/en/master/Quickstart.html#the-gamma-gamma-model-and-the-independence-assumption

prabhathn commented 5 years ago

Is there an alternative model recommended for when there may be a correlation between frequency and monetary value?

vincent-lange commented 5 years ago

you can try to learn your own relationship, most of the time linear or some simple exponential term will do, and update the distributions that way, it's not perfect though

psygo commented 5 years ago

In my project, I will use the net profit to be monetary_value . So monetary_value have some negative, but it will be error. how can I use negative monetary_value to fit GammaGammaFitter & calculate CLV?

Interesting question, but I agree with @CamDavidsonPilon in that the Gamma-Gamma Model does not have the assumptions you would like to have in your case, @yanwu0105.

If you want more information about the Gamma-Gamma Model, you can check out Prof. Bruce Hardie's notes, especially this one.

tamirbennatan commented 2 years ago

@vincent-lange

you can try to learn your own relationship, most of the time linear or some simple exponential term will do..

What relationship are you describing? Between something like: avg_transaction_profit ~ frequency + monetary_value ?

Or something else?