classify blocks of time series of unknown section lengths basis slope and smoothed diff
What will be the best approach to classify blocks of a univariate time series that contains data of a fuel tank level (data captured every 30 seconds)? The slope of the curve would be an important feature but only after removing noise.
An example TSD looks like this. Marked in red is Sudden drain classified manually. I need to classify blocks of the time series on following 5 categories.
- Idle (no change in fuel level)
- Suddent drain (very fast reduction in level)
- Normal consumption (between n1 to n2 litres per hour rate)
- Fast consumption (more than n2 litres per hour sustained for atleast t1 minutes)
- Refilling
One approach I took was:
- Transform the base TS to a
diff
TS (differenced values) - Use K-means to cluster the differenced values.
The only problem in this is that the clustering is non adjacent. The time scale is lost. And secondly noisy values (turbulence of fluid level) results in false positive classifications.
Using any smootheining algo like spline or gam would result in losing the sudden drops and refillings. To use smoothing algos I have a painful way of splitting the time series into sections of prior to refilling and after refilling and feeding these sections to smoothing. This is not an elegant method.
I need an elegant method to solve this classification problem.
Thanks for reading and trying to help.
Topic time-series r
Category Data Science