1
$\begingroup$

My goal is to predict when a prospect customer has the intent to purchase a product (industry has a very slow sales cycle). This is ultimately a marketing model, so predicting/estimating when the prospect becomes interested in purchasing this type of product is as important (if not more) than knowing the actual year they will purchase.

I think my question will be best solved by generating some fake data so I can best explain my intentions. Please see the R code below for generating some fake data.

# setup fake dataset with no purchases or flags to begin with
sales_data <- expand.grid(year=2004:2011,prospect=c('A', 'B', 'C'), 
                          flag=0, purchased=0)


# quick function to populate the sales, nothing to write home about
make_fake_sale <- function(data, prospect, salesyear) {
    # flag our actual purchase (pretend that this has been done already)
    yearindx <- which(data[,1] == salesyear)
    prospindx <- which(data[,2] == prospect)
    prosp_yr_indx <- yearindx[yearindx %in% prospindx]
    data[prosp_yr_indx,4] <- 1

    # set our fake target variable "flag" = to 1
    flag_yrs <- (salesyear - 3):(salesyear - 1) 
    yearsindx <- which(data[,1] %in% flag_yrs)
    pros_flgyr_indx <- yearsindx[yearsindx %in% prospindx]
    data[pros_flgyr_indx,3] <- 1
    return(data)
}

sales_data <- make_fake_sale(sales_data, 'A', 2010)
sales_data <- make_fake_sale(sales_data, 'B', 2008)
sales_data <- make_fake_sale(sales_data, 'C', 2009)

sales_data

that leaves us with the following data below (I cut off prospect 'C', but you get the idea).

enter image description here
(not pictured here are the features I would use to actually train the model itself)

My question is: Is there any danger to removing the 'purchased' column and using this new 'flag' field as my target variable for modeling?

Are there certain models where this would be a good idea and some where it would not?

Would it at all be a good idea to maybe turn this into a regression and make up a scoring construct so the year before the purchase would receive a value of 100, then two years before the purchase would receive a 75, and so on? That way we take into consideration how close they are to making the actual purchase?

The ultimate goal here is to model/predict when prospect customers have started considering their need for a product that has a very long sales cycle (typically over one year).

Also a final note, I am being very careful with how I split my train and test for the validation phase of modeling, so I have already considered the pitfalls there (data leaks, prospects who straddle the cutoff year, etc.)

EDIT: clarifying intentions for this model

EDIT: the industry I am dealing with is low-volume, so the "purchased" column is very sparse. Additional reasoning for the "flag" target variable would be for giving the predictive model more actual positive results to train with.

$\endgroup$
  • $\begingroup$ To be clear; you want to flag a user if they're expected to purchase within the next 3 years. You're going to create a model to predict the "flag" column and you want to know if the "purchased" column can be of any benefit to making a prediction model. Is that correct? $\endgroup$ – Hugh Nov 17 '16 at 22:30
  • $\begingroup$ My intent was to remove the "purchased" column altogether, and then just train/test using the "flag" as the target variable that indicates the prospect's intent to purchase relatively soon. I have never really created my own target variable like this and was wondering if it is a useful strategy or if I am overlooking some obvious fallacy of using this strategy. $\endgroup$ – TaylorV Nov 17 '16 at 22:34
0
$\begingroup$

It is perfectly valid to create a target variable like flag, you just need to be aware of how this differs from the purchased variable and your knowledge of the sales industry is needed to decide which is better.

Obviously flag and purchased are closely related but they both have potential drawbacks.

  • Predicting purchased will only give you 1-12 months notice before the customer is expected to buy the item. This might not be long enough for your to market the item to them.
  • Predicting flag should give you a few years notice for when a customer will buy a product, the downside is that 3 years notice is treated the same as 1 year notice (you know better than I if this is important). Are customers actually expected to show signs 3 years in advance? Is a customer who will buy in 3 years more similar to one who will buy in 4 or 2 years? If 3 years is more similar to 4 years then treating 3 years notice as a true flag will obscure the pattern in the data.

A possible solution to the issue with predicting flag is to reduce flag gradually between 1 and 4 years ahead of purchase. Perhaps 1 year ahead of time then flag=1, 2 years ahead flag=0.66, 3 years ahead flag=0.33, 4+ years ahead flag=0. This treats 4 and 5 years the same, you can decide if this is a fair assumption.

Treating 1 year ahead of purchase differently from 3 years ahead of purchase allows you to prioritize resources to those customers who will be purchasing soon.

$\endgroup$
  • $\begingroup$ Thank you for you response, this is the exact answer I was hoping for. If I did let the "flag" variable decay as we move further from the actual purchase year, would that have to be a regression at that point or do you think some type of ordinal classification would be better? I know it is tough to tel without knowledge of the remaining features... but just asking in general. $\endgroup$ – TaylorV Nov 18 '16 at 15:07
  • $\begingroup$ Regression would be a better idea than ordinal prediction because the features associated with 2 years are more similar to the features for 3 years than they are for 4 years. With ordinal prediction 2 years is equally different from anything that is not 2 years. Logistic regression would be a good option since that's bound between 0 and 1. $\endgroup$ – Hugh Nov 18 '16 at 17:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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