# One Class SVM for Time Series data

I am trying to use an OCSVM for my time series data which looks like this:

  Time          Speed_of_Vehicle      Direction      Lane
------------------------------------------------------------
| 00:00:21   |       x  mph       |       North    |      1 |
| 00:01:12   |       x' mph       |       North    |      3 |
| 00:05:01   |       x''mph       |       South    |      5 |
|    .       |         .          |         .      |      . |
|    .       |         .          |         .      |      . |


There are

6 lanes in total [4 North and 2 South]

Time-stamps with the speed, direction and lane features for 30 days


I am trying to fit a OVSVM model over this data for anomaly detection. I have not used an SVM before so, I am unsure on how to pass the data to train the model.

What features would be most useful in my case to train the model?

What I have thought of doing was;

There are about on an average 700 time-stamps for each day. These time-stamps are not aligned for the days. So, I aggregate the time stamps on fixed intervals for each day.

Now that the data observations have aligned time periods, I am not sure on what features to put in my vector. Is it advised just to include the Speed_of_Vehicle as my feature for each observation?

I have also thought about having a different model for each different lane. So 6 trained OCSVMs for each lane.

Is it necessary/advised to include the time feature as well since the data is contextual?

Any advise on how to train the model or reference to any papers will be appreciated.

• Yes, you need to account for time, see here for example and explanation: stats.stackexchange.com/a/182354/35989 – Tim Feb 15 '18 at 14:13
• Thanks for the reply, Tim. So, if I aggregate the values every 5 minutes for a day, I would get 288 observations a day (so, 288 * 30 for a month). So the time feature for each of the 288 * 30 observations would be which '5 min interval' bin the observation lies in. So, multiple values in the month will lie in the same bin. Am I understanding it correct? Also, is it advised to use a different model for each lane? Thanks so much – RPT Feb 15 '18 at 14:59