0
$\begingroup$

I have a dataset with locations and a timestamp of a subject. For each location and timestamp I determined by comparing the location to the home address if the subject was at home or not (0/1) and added this value to the dataset.

Now, I want to train a model to learn based on the timestamp when it is most likely that the subject is at home. Thus, if you give the model some timestamp, it will classify if the subject was at home at this time. The model learns the "best time" for someone being at home so to say.

Obviously people are not at home at the same time every day but over a long period of time there should be some pattern and I want the model to classify based on this pattern.

What would be a fitting algorithm to do this?

$\endgroup$
  • $\begingroup$ If you just have the person (and no additional information like categories) then I'd recommend a normalized histogram (or a kernel-density estimator) that will give you the probability for every bin (or integral) and the it's just a matter of finding the highest peak (or maximum likelihood) $\endgroup$ – Magellan88 Sep 26 '19 at 14:29
1
$\begingroup$

This is an ideal case for feature engineering!

I did this same case for myself using the google takeaway data to predict whether I am at home or at work.

Instead of just using time I extracted the following features:

  1. Work Day --> 1 / 0
  2. Day of the Week
  3. Month
  4. Year
  5. Time

I then trained a random forest classification model to tell me whether I am at home, at work or other place based on those five features.

As a successive step I used this model to actually identify dates where I "moved" or was "on holiday" because of the difference between prediction and actual labels.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Interesting. Did you describe e.g. "day of the week" by 1 = monday ... 7 = sunday in your dataset? $\endgroup$ – Zelda_CompSci Sep 26 '19 at 14:53
  • $\begingroup$ @Zelda_CompSci I did encode as a categorical variable ( so one hot encoding). If you are more adventurous than me you could also encode it as the ordinal numerical variable (1-7) to get information from the day order (e.g. if the person is at home at a pattern like day 1-2 week 1 and day 2-3 week 2 ,etc.). $\endgroup$ – Fnguyen Sep 26 '19 at 15:09
  • $\begingroup$ @Zelda_CompSci I also added way more information but that might be out of scope for your question. But I added additional data via free APIs about weather conditions that day and location, bank holidays, etc. $\endgroup$ – Fnguyen Sep 26 '19 at 15:10
0
$\begingroup$

Choose any classifier you like and which fits your requirements...would be the "easy" answer :D

Your problem sounds as if you could go for an easy algorithm for classification up to complicated ones depending on which additional features you want to use. From the top of my head seasonal features could be interesting: Days until the next public holiday, days until christmas, vacation yes/no, month, etc.

Your output is binary which in principal could mean that you start with a Perceptron (or Multi Layer Perceptron) as a start. A neural network of your choice would be fine as well.

If you want to start with an easy to implement algorithm (for example as a benchmark for further experiments), maybe go with an easy decision tree or logistic regression.

| improve this answer | |
$\endgroup$

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.