Answers.Body: <p>In Convolutional Neural Networks (CNNs) you have small kernels (or filters) that you slide over an input (e.g. image). The value resulting from the convolution of the filter with a subset of the image over which the filter is currently positioned is then put into its respective cell in the output of that layer. Essentially, training CNNs boils down to training small filters, for example for detecting edges or corners etc. in input data, which most frequently happens to be images indeed. The assumption here is that features can be detected <em>locally</em> in the input volume, which entails that the nature of the input data shall be coherent over the entire volume of input data.</p>
  <p>Recurrent Neural Networks (RNNs) do not work locally, but are applied to sequences of arbitrary input data, where one input node may receive sensor readings, while the next node receives the date on which the sensor reading was measured. Of such arbitrary data, you feed a sequence through the RNN, which always keeps its own internal state from processing the previous instance/sample in the sequence in memory while processing the next data point/sample in the sequence. Depending on the kind of recurrent cell type that is employed to construct a RNN layer, the memory of the previous internal state then affects the computation of the next internal state and/or output computed when working on the next data sample. So, information of past data points/samples is carried forward while iterating though a sequence.</p>
  <p>In short, CNNs are meant to detect local features in volume data, while RNNs preserve information over their previous internal state while processing the next data sample.</p>
  <p>Probably one of the best online resources walking you through all the related concepts step by step is the following <a href="https://www.youtube.com/playlist?list=PL3FW7Lu3i5JvHM8ljYj-zLfQRF3EO8sYv" rel="nofollow noreferrer">lecture series</a> offered by the Stanford University.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-18T00:49:40.253Z
Answers.LastActivityDate: 2020-06-18T00:55:31.880Z
Answers.LastEditDate: 2020-06-18T00:55:31.880Z
Answers.UserDisplayName: Daniel B.
Body: <p>I understand that in general an RNN is good for time series data and a CNN image data, and have noticed many blogs explaining the fundamental differences in the models.</p>
  <p>As a beginner in machine learning and coding, I would like to know from the code perspective, what the differences between an RNN and CNN are in a more practical way.</p>
  <p>For instance, I think most CNNs dealing with image data use <code>Conv1D</code>  or <code>Conv2D</code> and <code>MaxPooling2D</code> layers and require reshaping input data with code looks something like this <code>Input(shape=(64, 64, 1))</code>.</p>
  <p>What are some other things that distinguish CNNs from RNNs from a coding perspective?</p>
  
Tags: <deep-learning><convolutional-neural-networks><comparison><recurrent-neural-networks><implementation>
Title: From an implementation point of view, what are the main differences between an RNN and a CNN?
UserDisplayName: nilsinelabore
ThreadText: # From an implementation point of view, what are the main differences between an RNN and a CNN?
  
  (Asked by: username_0 on 2019-11-27)
  
  I understand that in general an RNN is good for time series data and a CNN image data, and have noticed many blogs explaining the fundamental differences in the models.
  
  As a beginner in machine learning and coding, I would like to know from the code perspective, what the differences between an RNN and CNN are in a more practical way.
  
  For instance, I think most CNNs dealing with image data use `Conv1D` or `Conv2D` and `MaxPooling2D` layers and require reshaping input data with code looks something like this `Input(shape=(64, 64, 1))`.
  
  What are some other things that distinguish CNNs from RNNs from a coding perspective?
  
  **Tags:** deep-learning, convolutional-neural-networks, comparison, recurrent-neural-networks, implementation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-06-18. Score: 0 | Accepted answer
  
  In Convolutional Neural Networks (CNNs) you have small kernels (or filters) that you slide over an input (e.g. image). The value resulting from the convolution of the filter with a subset of the image over which the filter is currently positioned is then put into its respective cell in the output of that layer. Essentially, training CNNs boils down to training small filters, for example for detecting edges or corners etc. in input data, which most frequently happens to be images indeed. The assumption here is that features can be detected *locally* in the input volume, which entails that the nature of the input data shall be coherent over the entire volume of input data.
  
  Recurrent Neural Networks (RNNs) do not work locally, but are applied to sequences of arbitrary input data, where one input node may receive sensor readings, while the next node receives the date on which the sensor reading was measured. Of such arbitrary data, you feed a sequence through the RNN, which always keeps its own internal state from processing the previous instance/sample in the sequence in memory while processing the next data point/sample in the sequence. Depending on the kind of recurrent cell type that is employed to construct a RNN layer, the memory of the previous internal state then affects the computation of the next internal state and/or output computed when working on the next data sample. So, information of past data points/samples is carried forward while iterating though a sequence.
  
  In short, CNNs are meant to detect local features in volume data, while RNNs preserve information over their previous internal state while processing the next data sample.
  
  Probably one of the best online resources walking you through all the related concepts step by step is the following [lecture series](https://www.youtube.com/playlist?list=PL3FW7Lu3i5JvHM8ljYj-zLfQRF3EO8sYv) offered by the Stanford University.
  
  
  ---
  
  