Some variables that we may be interested in modelling, can take both discrete and continuous values.

For example, let's say we want to model the time until the next customer arrives in our shop on a given day, based on various factors like time of day, marketing efforts, and so on. Our shop's opening times are between 10am and 6pm.

At any given time in the day, the time until the next customer arrives can either be a number (e.g. seconds until they arrive) bounded between 0 and the time until the shop closes, or we may not get another customer on that day at all.

In an ML family programming language we might roughly model this data type like so:

type TimeToNextCustomer 
    = NoCustomer
    | LogSeconds Float  -- Using logs, so that the float can be unconstrained

What practical strategies can be used to build a predictive model for such an approach?

One option could be to reframe the task to predict something else. For example, "Number of customers in the rest of the day". However, this may not be appropriate in all cases.

Another option could be to model the distribution of Time To Next Customer, and use a custom loss function to evaluate cases near to the end of the day (no customers) more approprately; however, I am struggling to think through how this might work.

  • 1
    $\begingroup$ It is helpful to distinguish the model from the data. You appear to describe a circumstance in which a suitable model for the time to the next customer would be a continuous variable, but what you observe is either the time to the next customer or the remaining time until the shop closes. One common way to model these observations is to view that last time as constituting information that the time to the next customer (had they appeared) was greater than the recorded duration. This is a form of right censoring. Methods of survival analysis are likely applicable. $\endgroup$ – whuber Aug 18 '20 at 18:39
  • 2
    $\begingroup$ Thank you, @whuber. Survival analysis appears to be exactly the kind of rich, pre-existing domain I was looking for to investigate further. Thank you very much. I have also come across this paper on strategies for predicting "if and when" events, which appears to be appropriate: robots.ox.ac.uk/~vgg/publications/2019/Neumann19/neumann19.pdf $\endgroup$ – snakeoilsales Aug 19 '20 at 11:30

Your Answer

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

Browse other questions tagged or ask your own question.