0
$\begingroup$

Is it possible to predict the time of an event or at least predict an hour of the day?

I want to predict a time of someone answering the call during a day. I have a historical call log of each contact based on that I want to create a model that can predict probabilities of an hour of the day or the time to call a person.

I've done a research on various approaches but couldn't find anything that I can relate it with my problem.

I'll appreciate your advice on the features I can use for such a task.

So far I have following features:

  • Person's job role
  • Day of the Week
  • Location of the person
  • Timezone
  • Season
  • The ratio of a number of times the person has answered a call to the number of time being called during each hour of the day. This makes ten features. The ratio is between 0 and 1.

Right now my target variable consists of 10 classes (one-hour blocks).

I don't have a major class imbalance. Using Gradient Boosting Classifier to predict the probabilities.

How can I get more granular i.e. instead of using ten one hour blocks, how can I predict more precise time to call a person?

$\endgroup$
0
$\begingroup$

Yes. Run regression in R (lm()).

Your response variable $Y$ is the time of day that somebody receives a call.

Your covariates $X_1, X_2, ..., X_n$ are the different "features" you mentioned. Many methods of categorical regression exist; you may use the factor() function in R to assign factor levels to your covariates.

Here is a great example: Coding for Categorical Variables

Once you fit a model, you can use the output of your regression, and new input, to find the time of day somebody is most likely to make a call. If you let your response variables be continuous (non-categorical), the predictive response will be non-categorical (i.e. more granular, as you desired).

$\endgroup$
7
  • $\begingroup$ You seem to have overlooked the time-series tag applied to the question. That is a (strong) indication that you will be leaving a lot of information on the table, or even producing misleading answers, unless you apply a procedure that copes with the serial correlations typical of time series data. lm is not one of them. $\endgroup$ – whuber Jul 7 '18 at 2:11
  • $\begingroup$ Thank you for your answer. I think this makes sense. I'll try this and let you know. @whuber: Though my data is time-series, I can decompose it into features that negate the correlation or the effect of time. I mean aggregating the data and producing features will help. Any chance you know how to do it in Python using scikit-learn $\endgroup$ – Krishnang K Dalal Jul 7 '18 at 2:27
  • $\begingroup$ If your data do not have the features characteristic of time series data, then you ought to consider removing the time-series tag, for otherwise it's likely to attract answers you find irrelevant. $\endgroup$ – whuber Jul 7 '18 at 2:36
  • $\begingroup$ I have another question, my target variable Y is a categorical variable, how will lm() be useful here? How do you suggest to convert time into a continuous value? $\endgroup$ – Krishnang K Dalal Jul 7 '18 at 2:41
  • $\begingroup$ Whuber makes excellent points. I was under the impression you wanted a relatively simple model, which is why I felt I knew enough to answer the query. Time is inherently a continuous variable. You can convert your bins (9:00 a.m., 10:00 a.m., etc.) into values (9, 10, etc.). Yes, there are a number of flaws with this method in general, but for this purpose and complexity of data it may be sufficient. As with all models, you should back test the predictive ability of the model to make sure it is adequate for your purposes. $\endgroup$ – ERT Jul 7 '18 at 3:00

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.