Answers.Body: <p>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 <a href="https://www.tensorflow.org/guide/keras/rnn" rel="nofollow noreferrer">Recurrent Neural Nets</a>. They are specifically designed for working on time series-es of heterogeneous data.</p>
  <p><strong>Update:</strong></p>
  <p>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.</p>
  <p>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.</p>
  <p><a href="https://i.sstatic.net/50BGy.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/50BGy.png" alt="enter image description here" /></a></p>
  <p>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, <strong>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</strong> (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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-06T14:36:02.457Z
Answers.Text: 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.
Answers.UserDisplayName: nbro
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-06T14:51:35.200Z
Answers.Text: 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.
Answers.UserDisplayName: Daniel B.
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-06T17:59:48.643Z
Answers.Text: It may be worthing linking to some research work that used CNNs for problems that involve time-series.
Answers.UserDisplayName: nbro
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-06T18:59:40.583Z
Answers.Text: Previously, I had only heard of people sometimes applying CNNs to time series tasks. But judging from the abstract of this [paper](https://ieeexplore.ieee.org/abstract/document/7870510), the body of research on applying CNNs to time series tasks is not insignificant. Actually, searching on [Google Scholar for "cnn for time series"](https://scholar.google.com/scholar?hl=en&oq=cnn%20for%20time%20s&q=cnn%20for%20time%20series) yields quite some findings.
Answers.UserDisplayName: Daniel B.
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-22T22:04:04.613Z
Answers.LastActivityDate: 2021-02-06T13:05:48.093Z
Answers.LastEditDate: 2021-02-06T13:05:48.093Z
Answers.UserDisplayName: Daniel B.
Body: <p>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. <strong>I calculated the descriptive statistics of the time series, ie. mean, variance, skewness, kurtosis etc for each observation and added them to input data.</strong> </p>
  
  <p>My question: </p>
  
  <p>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</p>
  
Tags: <neural-networks><machine-learning><convolutional-neural-networks><keras>
Title: Is CNN capable of extracting the descriptive statistics features
UserDisplayName: nilsinelabore
ThreadText: # Is CNN capable of extracting the descriptive statistics features
  
  (Asked by: username_0 on 2019-12-10)
  
  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
  
  **Tags:** neural-networks, machine-learning, convolutional-neural-networks, keras
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-06-22. Score: 3 | Accepted answer
  
  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](https://www.tensorflow.org/guide/keras/rnn). They are specifically designed for working on time series-es of heterogeneous data.
  
  **Update:**
  
  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](https://i.sstatic.net/50BGy.png)](https://i.sstatic.net/50BGy.png)
  
  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.
  
  > **Comments:**
  > **username_2**: 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.  
  > **username_1**: 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.  
  > **username_2**: It may be worthing linking to some research work that used CNNs for problems that involve time-series.  
  > **username_1**: Previously, I had only heard of people sometimes applying CNNs to time series tasks. But judging from the abstract of this [paper](https://ieeexplore.ieee.org/abstract/document/7870510), the body of research on applying CNNs to time series tasks is not insignificant. Actually, searching on [Google Scholar for "cnn for time series"](https://scholar.google.com/scholar?hl=en&oq=cnn%20for%20time%20s&q=cnn%20for%20time%20series) yields quite some findings.  
  
  ---
  
  