I have a time series data set from a sensor and the task is to predict the time before a failure event is occurred. The data set has one feature and has almost 20 million rows. This is a regression problem.

I tried polynomial features, auto correlation, rolling statistics and expanding statistics. The only one that seemed to improve my model was expanding sum. What are some relevant features to be extracted from this data?

My model is a Linear Regression model, the data set was scaled and currently only two features improved my model. The sensor data and the expanding sum. Any other suggestions to tackle this problem other than using deep learning?

Update: For clarification I added the plots for both the input and output.

Sensor reading plot - Input Sensor reading plot

Time to failure plot - Output Time to failure plot

  • $\begingroup$ you have 2 features right, i.e date and your other feature? Just verifying before suggesting a few ideas. $\endgroup$
    – Nischal Hp
    Feb 14, 2020 at 10:32
  • $\begingroup$ No, only one feature. The date variable is not available. $\endgroup$ Feb 14, 2020 at 10:34
  • $\begingroup$ So its not time series, because the series can also be jumbled, yes? $\endgroup$
    – Nischal Hp
    Feb 14, 2020 at 10:38
  • $\begingroup$ I am not really sure, i was confused by if it can be jumbled or not. I assumed that sensor data would should be time series. $\endgroup$ Feb 14, 2020 at 11:34
  • $\begingroup$ Without date or timestamp, you cannot come to that conclusion no? Is there any other way you can deduce its sorted in time series fashion? $\endgroup$
    – Nischal Hp
    Feb 14, 2020 at 11:48

2 Answers 2


I think the first question you should ask before you start going off on a deep learning model is, can you tell when the failure is going to occur just by looking at a plot of your data? If you can't, then no model will help you deduce when a failure will occur.

You shouldn't overlook some basic models also such as exponential or poisson distribution models that should model your current problem well.

Lastly, since it's a time series for rare events, some ways to gain more insight might include time between failures, identifying thresholds of the data value triggering a failure, splicing all the data into intervals and the number of failures, etc.. You should also check if the failures follow a pattern.

  • $\begingroup$ The thing is I do not want to use deep learning. I did not try exponential or poisson models that you suggested. I also added plots for both the input and output and indeed there is a pattern. Can you check it out $\endgroup$ Feb 16, 2020 at 11:54

First, how do you classify your failures? Are they these giant peaks? If so, you should probably employ a logarithmic scale first.

Second, your data looks extremely periodic, I'd say you have systematic failures.

Don't you think it's better to use more simple methods that do not involve complex ML. Try to calculate the frequency of events first and see if it's constant. One more thing is to add some mean-based features such as, for example, the average over a particular time interval (10 reads, 100 reads etc.).

Also, regarding some of the comments, since the data is from a sensor, it:

  1. is a time series meaning you can introduce an artificial time feature.
  2. can't be shuffled.

UPD. This looks like a rare event prediction problem, check these links:


Regression model to predict probability of rare event



  • $\begingroup$ Yeah, I think the peaks represents the failures. You mean logarithmic scale to the input or output ? What do you mean by frequency of events if you can elaborate more about it. I tried the window average method you mentioned but it made the model worse. $\endgroup$ Feb 25, 2020 at 12:24
  • $\begingroup$ @IbrahimSherifYahia "You mean logarithmic scale to the input or output ?" input, you're trying to predict values that are way greater than you base signal. "What do you mean by frequency of events " you work with time series, any signal like this can be Fourier transformed to get its frequency components. "I tried the window average method you mentioned but it made the model worse." I feel like these features can be strongly correlated, did you check this? $\endgroup$
    – Bracula
    Feb 25, 2020 at 12:34
  • $\begingroup$ I will try the log scale. You mean use the frequency components as features for the model or something else. Yes indeed the features were strongly correlated thats why I discarded them. $\endgroup$ Feb 25, 2020 at 15:07
  • $\begingroup$ @IbrahimSherifYahia not exactly features. You say "to predict the time before a failure event is occurred" and your data looks like a periodic signal i.e., failures occur at roughly regular time intervals. Try to find this frequency, say, it happens once every 5x10^6 time intervals. I'm not sure that you can get a feature from this though since I do not have the whole problem in front of me. I've also checked some of my bookmarks and updated the answer. $\endgroup$
    – Bracula
    Feb 25, 2020 at 15:53
  • 1
    $\begingroup$ @IbrahimSherifYahia I'm pretty much in a similar position so I'd say they're interested in your analysis and methods rather than in the result itself. Anyway, in this case give us an update, I'm quite curious as to how they propose to solve this. $\endgroup$
    – Bracula
    Mar 15, 2020 at 20:59

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.