Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question regarding simultaneous objectives #2

Closed
robinvanschaik opened this issue Nov 29, 2020 · 2 comments
Closed

Question regarding simultaneous objectives #2

robinvanschaik opened this issue Nov 29, 2020 · 2 comments

Comments

@robinvanschaik
Copy link

robinvanschaik commented Nov 29, 2020

First of all, thank you for making the code for the loss function, metrics & example notebooks open source.

I am looking forward to trying this approach out. I have one question that I am a bit confused about.

The paper mentions that the model structure, in combination with the loss function used, allows for one model to capture both objectives: churn prediction and remaining lifetime value prediction.

First, it is capable of predicting the churn probability and LTV value simultane-
ously. It reduces the engineering complexity of building a two-stage model (Vanderveld et al., 2016)
— a binary classification model to predict repeat purchase propensity, followed by a regression model
to predict the LTV of returning customers predicted in stage 1.

Indeed, the loss function returns a composite of both churn & remaining value losses:

  return classification_loss + regression_loss

However, the notebooks are split up in two, one for each separate objective.

Can one trained model indeed perform both tasks: the notebooks are split up to illustrate a comparison between the churn and remaining value tasks to two separate models?

Or are did I completely misinterpret the paper? In which it is meant that the type of model can perform both tasks, but you need two trained models: one fine-tuned for each task.

Thanks, and I am looking forward to trying this out. :)

@TerenceLiu4444
Copy link
Contributor

One trained model can perform both tasks. The notebooks are separated into classification and regression for illustration purpose.

For churn prediction, you can use
y_pred = K.sigmoid(logits[..., :1]).numpy().flatten(). For average ltv, you can use

  logits = model.predict(x=x_eval, batch_size=1024)
  y_pred = ltv.zero_inflated_lognormal_pred(logits).numpy().flatten()

For remaining values, you can use

  loc = logits[..., 1:2]
  scale = tf.keras.backend.softplus(logits[..., 2:])
  preds = (
      tf.keras.backend.exp(loc + 0.5 * tf.keras.backend.square(scale)))

@robinvanschaik
Copy link
Author

Thank you, @TerenceLiu4444.

That's clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants