1
$\begingroup$

My goal is to build a classification model in order to predict if a customer will buy a product or not (binary classification).

Since in the last months (let's say 3-4) I know that the advertising of the company is changed a bit, I want to put more emphasis on the newer records.

I know that it is possible to specify the sample_weights parameter in most of the classification algorithms, but I don't know how to properly build these weights.

Basically, I have the date in which the customers have (or have not) bought the product, but I want to understand if there is a specific way to build the weights using this information.

In addition, I would also know if someone knows some references or applications for this application (time-related sampling weights).

Thank you in advance!

$\endgroup$
2
  • $\begingroup$ Have you heard about adversarial validation? kaggle.com/tunguz/elo-adversarial-validation It basically implies training a model that helps you classify between training and testing samples. I think you could apply that to your problem, and use the predictions of the adversarial model that predicts last months vs older data as the weights of your samples $\endgroup$ Jul 31, 2020 at 10:32
  • 1
    $\begingroup$ Not sure what is the best solution here, nonetheless, a thing for you to have in mind is that you can also oversample the more recent instances or inversely downsample the older ones, you get the idea. For some algorithms, this works better than setting weights, or maybe it's not even possible. $\endgroup$
    – 20-roso
    Jul 31, 2020 at 19:58

2 Answers 2

1
$\begingroup$

If you want to define weights for your datapoints, you can just calculate them with a simple formula that has the right shape. Let your weights be a function of the age of the datapoint and choose wether you want to model their relative imortance with a linear or an exponential function.

It could be as simple as:

$w(t) = 2^{-0.1t}$

Which would give the relevance of your data a half-life time of ten days.

$\endgroup$
0
$\begingroup$

One option is incremental training. Update the model weights as more recent data is available. This automatically assigns more importance to recent records.

Incremental training works well within the Bayesian framework where historical data is the prior and more recent data updates the prior.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.