I have a dataset of users, each user has has daily information about his activities (numerical values representing some measurements of his physical activities).

In addition, each user in each day has a boolean value that represents if he/she took a particular action.

The dataset looks as follow

|userID|      date| activity1| activity2| action|
| user1|2016-06-05|       5.3|         6|  false|
| user1|2016-06-04|       3.1|         8|   true|
| user1|2016-06-03|       2.0|        13|  false|
| user1|2016-06-02|       4.7|         1|  false|
| user1|2016-06-01|       1.3|         9|  false|
| user1|   ...ect.|       ...|       ...|    ...|
| user2|2016-06-05|       0.6|         5|   ture|
| user2|2016-06-04|       3.0|         5|  false|
| user2|2016-06-03|       0.0|         0|  false|
| user2|2016-06-02|       2.1|         3|  false|
| user2|2016-06-01|       6.3|         9|  false|
| user2|   ...ect.|       ...|       ...|    ...|
| user3|2016-06-05|       5.3|         0|  false|
| user3|2016-06-04|       5.3|        11|  false|
| user3|2016-06-03|       6.8|         5|  false|
| user3|2016-06-02|       4.9|         2|  false|
| user3|   ...ect.|       ...|       ...|    ...|

Note that the dataset is not fixed, so one new row is added for each user on every new day. But the number of columns is fixed.


Build a model that predicts which user is likely to take the action in the near future (e.g. in any of the next 7 days).


My approach is to build feature vectors representing the activity values for each users over a period of time, and use the action column as a source of ground-truth. Then I feed the ground-truth and the feature vectors to a binary classification training algorithm (e.g. SVM or Random Forest) in order to generate a model able to predict if a user is likely to take the action or not.


I started by the positive examples that are the users who took the action. To extract the feature vector of a positive example, I combined the activity values in the X (30 or 7 or 1) days preceding the action (the day of taking the action is included).

When I moved to the negative examples, it gets less obvious, I am not sure how to select negative examples and how to extract features from them. This has led me actually to re-question if my way of selecting positive examples and building my the feature vectors was correct.


  1. How to build the ground-truth of positive (users who did take the action) and negative (users who didn't take the action) examples?
  2. What is a negative example in this case? is it the user who didn't take the action in a fixed period of time? What if he didn't take the action in this fixed period, but he just took it right after?
  3. What are the possible approaches of selecting the ranges of dates to extract feature vectors from.

Rational Question

Is there more suitable approaches (other than classification) to solve this kind of problems?


1 Answer 1


Your approach is a good one. This way to extract features can lead to good results. But before moving forward I recommend answering these two questions: Is there is any correlation between the behavior of the user today and yesterday ... Etc " temporal correlation/ temporal dependency" Is there is any kind of dependency between the users? Answering these questions can measure the quality of your feature ? Sometimes there is no need even to do calculations to answer these questions , if you tell us what kind of actions or activities you are looking at we may help in better way . For example : if user 1 used his car today , there still a high prob to use it tomorrow, but if user 1 went to barbershop today there is a high probability that will not go tomorrow

  • $\begingroup$ Thanks @BH85, the features are not correlated in time. I would like to hear you opinion on how to select the negative examples. $\endgroup$
    – Rami
    Jun 10, 2016 at 7:21

Your Answer

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

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