I was trying to build a CNN model. I used time series data of daily temperature to predict if there is risk of an event, say bacteria growth. I calculated the descriptive statistics of the time series, ie. mean, variance, skewness, kurtosis etc for each observation and added them to input data.

My question:

Is CNN capable of extracting the effect of the descriptive statistics the label, meaning that adding these descriptive statistics features manually does not make a difference? (I will still try this later, but like to hear what you think about it). Thanks


1 Answer 1


CNNs learn convolutional filters that get trained on finding local, recurring patterns in some kind of image/volume data. 1D convolution is actually a thing, but I think what would be more suitable for your case is using Recurrent Neural Nets. They are specifically designed for working on time series-es of heterogeneous data.


I would like to reconsider the answer I gave earlier. First of all, in case of dealing with time series data where it is uncertain over which time span a given event to be detected lasts, I'd generally consider using Recurrent Neural Networks (RNNs) rather than CNNs, since RNNs maintain so-called hidden states that can carry potentially useful information over time, i.e. past inputs may influence present outputs. So, either if you know that the event to be detected spans many time steps (which might not even be consecutive time steps) or if you are uncertain about how long exactly the time span of an event to be detected is, then I'd suggest going for RNNs. If you decide to use RNNs, adding extra statistics to your data might make the learning task easier for the network, but is not strictly required since you would expect an RNN to learn relevant time-series statistics on its own.

However, there is a case where using CNNs might actually suffice and yield good results as well. Consider the case of the figure shown below, where the white tiles are time series inputs and the blueish area is the area that a CNN filter/kernel (or multiple ones) is working on right now.

enter image description here

As you can see, there is a time series of data points and some statistics derived from that time series that have been appended to the input data stream. So, in the figure, the augmented time series input consists of the measurements themselves as well as mean, variance, and skewness values derived from the time series data (over consecutive time steps). Under the assumption that the type of event you are interested in is bounded, in terms of time steps, to the width of the CNN filter(s)/kernel(s) that you slide over your input data, then a simple CNN might suffice to detect the events you are interested in. In other words, if the width of your filter spans over at least as many time steps as an event of interest lasts, then your CNN will be able to learn to detect the event (given proper training). In that case, adding further statistics to your input data might indeed help or even be necessary to detect certain events, since it implicitly widens the time window that your CNN filter can observe at any given time step, since a mean (or other statistics) may also considers past data that the filter itself (or multiple filters...) might not span over at a given time step where you want to detect an event.

  • $\begingroup$ But couldn't this require a potentially very long kernel? It may actually require a variable-length kernel, given that the relevant pasts even might have happened at different time steps in the past, from time step to time step. $\endgroup$
    – nbro
    Feb 6, 2021 at 14:36
  • 2
    $\begingroup$ Yes, that's definitely an issue with this approach and the reason why I advertised the RNN idea instead in the first place. It's also why I put the condition that the kernel must be wide enough in bold letters. But in theory, applying CNNs in this way is possible. That's why I altered my answer. On the other hand, I'd personally probably also not use CNNs in this way, but resort to RNNs or more traditional approaches, instead. $\endgroup$
    – Daniel B.
    Feb 6, 2021 at 14:51
  • $\begingroup$ It may be worthing linking to some research work that used CNNs for problems that involve time-series. $\endgroup$
    – nbro
    Feb 6, 2021 at 17:59
  • 1
    $\begingroup$ Previously, I had only heard of people sometimes applying CNNs to time series tasks. But judging from the abstract of this paper, the body of research on applying CNNs to time series tasks is not insignificant. Actually, searching on Google Scholar for "cnn for time series" yields quite some findings. $\endgroup$
    – Daniel B.
    Feb 6, 2021 at 18:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .