3
$\begingroup$

I have learned recently to train decision trees in R with data. Now I have a problem in which the data is a time series and I would like to use the same approach to detect when the time series presents and anomalous pattern.

Is it possible to train decision trees with times series data? I see that the main problem in is the labelling for informing the algorithm when the time series is anomalous.

$\endgroup$
7
  • 1
    $\begingroup$ First of all: Timeseries analysis (regression) is usually just "some" modelling algorithm applied to the lagged dataset, i.e. the input features are not 'weather', 'wind', etc (things that happen at the moment the prediction is made) but just the past value of the target variable before 1 timestep, the past value before 2 timesteps, and so on until some number k (it may be necessary to do some preprocessing in order to remove trends or so). In that sense you can use any regression algorithm (like a single decision tree) in order to predict the near future of the series. $\endgroup$ Aug 28 '17 at 12:07
  • 1
    $\begingroup$ You could then try to define 'anormal' as 'it deviates too much from the prediction'. However, there are many more algorithms out there in order to detect 'outliers'. For example: If you are not interested in "whether or not it behaves weird just now" but whether its fundamental properties change (in a certain way) then there is Bayesian Changepoint detection: hips.seas.harvard.edu/content/… $\endgroup$ Aug 28 '17 at 12:09
  • 2
    $\begingroup$ @FabianWerner, just to note, in time series models it is perfectly fine to have input features (usually lagged) such as "weather", "wind", etc. alongside the lagged values of the dependent variable, although some basic models (such as pure ARIMA or exponential smoothing) use only the lagged values of the dependent variable. $\endgroup$ Aug 28 '17 at 12:53
  • 1
    $\begingroup$ @RichardHardy: Yes, I was thinking about exactly that because this is usually one of the first models that one learns and is then surprised that one can also just apply 'any' model... in that sense ARIMA and TS analysis is nothing 'that special'... At least I was surprised when I realized that and I thougth that it might be a useful comment to add here :-) $\endgroup$ Aug 29 '17 at 9:01
  • 1
    $\begingroup$ @Ambesh: Yes, I was not sugesting the prediction in order for actually doing the prediction but in order to figure out exactly what you want: To find some deviance between the 'expected normal' behaviour [the prediction from the past] and the actual behaviour [the values you have observed] because according to what I understood you are looking for this criterion... How do you want to say what the 'normal' behaviour is otherwise? $\endgroup$ Aug 29 '17 at 9:03
-2
$\begingroup$

If I may, there is a much simpler and better way.

Vipin Kumar and colleages performed an extensive empirical evaluation and noted that

... on 19 different publicly available data sets, comparing 9 different techniques (time series discords) is the best overall technique.

See here.

$\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.