Answers.Body: <p><strong>CNN vs RNN</strong></p>
  <ul>
  <li>A CNN will learn to recognize patterns across space while RNN is useful for solving temporal data problems.</li>
  <li>CNNs have become the go-to method for solving any image data challenge while RNN is used for ideal for text and speech analysis.</li>
  <li>In a very general way, a CNN will learn to recognize components of an image (e.g., lines, curves, etc.) and then learn to combine these components to recognize larger structures (e.g., faces, objects, etc.) while an RNN will similarly learn to recognize patterns across time. So a RNN that is trained to convert speech to text should learn first the low level features like characters, then higher level features like phonemes and then word detection in audio clip.</li>
  </ul>
  <hr />
  <p><strong>CNN</strong></p>
  <p>A  convolutional network (ConvNet) is made up of layers.
  In a convolutional network (ConvNet), there are basically three types of layers:</p>
  <ul>
  <li>Convolution layer</li>
  <li>Pooling layer</li>
  <li>Fully connected layer</li>
  </ul>
  <p>Of these, the convolution layer applies convolution operation on the input 3D tensor. Different filters extract different kinds of features from an image. The below GIF illustrates this point really well:</p>
  <p><img src="https://i.sstatic.net/6NqcU.gif" alt="Convolutional Filter in ConvNets" /></p>
  <p>Here the filter is the green 3x3 matrix while the image is the blue 7x7 matrix.</p>
  <p>Many such layers passes through filters in CNN to give an output layer that can again be a NN Fully connected layer or a 3D tensor.</p>
  <p><img src="https://i.sstatic.net/mmcsz.jpg" alt="CNN" /></p>
  <p>For example, in the above example, the input image passes through convolutional layer, then pooling layer, then convolutional layer, pooling layer, then the 3D tensor is flattened like a Neural Network 1D layer, then passed to a fully connected layer and finally a softmax layer. This makes a CNN.</p>
  <hr>
  <p><strong>RNN</strong> <br>
  Recurrent Neural Network(RNN) are a type of Neural Network where the output from previous step are fed as input to the current step.</p>
  <p><img src="https://i.sstatic.net/RAeF7.png" alt="RNN model" /></p>
  <p>Here, <span class="math-container">$x_{t-1}$</span>, , <span class="math-container">$x_{t}$</span> and <span class="math-container">$x_{t+1}$</span>  are the values of inputs data that occur at a specific time steps and are fed into the RNN that goes through the hidden layers namely <span class="math-container">$h_{t-1}$</span>, , <span class="math-container">$h_{t}$</span> and <span class="math-container">$h_{t+1}$</span> which further produces output <span class="math-container">$o_{t-1}$</span>, , <span class="math-container">$o_{t}$</span> and <span class="math-container">$o_{t+1}$</span> respectively.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-05T14:08:11.323Z
Answers.LastActivityDate: 2023-04-21T08:08:08.197Z
Answers.LastEditDate: 2023-04-21T08:08:08.197Z
Answers.UserDisplayName: Aishwarya Radhakrishnan
Answers.Body: <p><strong><a href="https://ai.stackexchange.com/a/12043/2444">Recurrent neural networks</a></strong> (RNNs) are artificial neural networks (ANNs) that have one or more recurrent (or cyclic) connections, as opposed to just having feed-forward connections, like a feed-forward neural network (FFNN). </p>
  
  <p>These cyclic connections are used to keep track of temporal relations or dependencies between the elements of a sequence. Hence, RNNs are suited for sequence prediction or related tasks.</p>
  
  <p>In the picture below, you can observe an RNN on the left (that contains only one hidden unit) that is equivalent to the RNN on the right, which is its "unfolded" version. For example, we can observe that <span class="math-container">$\bf h_1$</span> (the hidden unit at time step <span class="math-container">$t=1$</span>) receives both an input <span class="math-container">$\bf x_1$</span> and the value of the hidden unit at the previous time step, that is, <span class="math-container">$\bf h_0$</span>. </p>
  
  <p><a href="https://i.sstatic.net/7HI1R.png" rel="noreferrer"><img src="https://i.sstatic.net/7HI1R.png" alt="enter image description here"></a></p>
  
  <p>The cyclic connections (or the weights of the cyclic edges), like the feed-forward connections, are learned using an optimisation algorithm (like gradient descent) often combined with back-propagation (which is used to compute the gradient of the loss function).</p>
  
  <p><strong>Convolutional neural networks</strong> (CNNs) are ANNs that perform one or more <a href="https://en.wikipedia.org/wiki/Convolution" rel="noreferrer">convolution</a> (or <a href="https://en.wikipedia.org/wiki/Cross-correlation" rel="noreferrer">cross-correlation</a>) operations (often followed by a <a href="https://en.wikipedia.org/wiki/Downsampling_(signal_processing)" rel="noreferrer">down-sampling</a> operation). </p>
  
  <p>The convolution is an operation that takes two functions, <span class="math-container">$\bf f$</span> and <span class="math-container">$\bf h$</span>, as input and produces a third function, <span class="math-container">$\bf g = f \circledast h$</span>, where the symbol <span class="math-container">$\circledast$</span> denotes the convolution operation. In the context of CNNs, the input function <span class="math-container">$\bf f$</span> can e.g. be an image (which can be thought of as a function from 2D coordinates to RGB or grayscale values). The other function <span class="math-container">$\bf h$</span> is called the "kernel" (or filter), which can be thought of as (small and square) matrix (which contains the output of the function <span class="math-container">$\bf 
   h$</span>). <span class="math-container">$\bf f$</span> can also be thought of as a (big) matrix (which contains, for each cell, e.g. its grayscale value).</p>
  
  <p>In the context of CNNs, the <em>convolution</em> operation can be thought of as dot product between the kernel <span class="math-container">$\bf h$</span> (a matrix) and several parts of the input (a matrix).</p>
  
  <p>In the picture below, we perform an <a href="https://en.wikipedia.org/wiki/Hadamard_product_(matrices)" rel="noreferrer"><em>element-wise multiplication</em></a> between the kernel <span class="math-container">$\bf h$</span> and part of the input <span class="math-container">$\bf h$</span>, then we sum the elements of the resulting matrix, and that is the value of the convolution operation for that specific part of the input. </p>
  
  <p><a href="https://i.sstatic.net/EiujB.png" rel="noreferrer"><img src="https://i.sstatic.net/EiujB.png" alt="enter image description here"></a></p>
  
  <p>To be more concrete, in the picture above, we are performing the following operation</p>
  
  <p><span class="math-container">\begin{align}
  \sum_{ij}
  \left(
  \begin{bmatrix}
  1 &amp; 0 &amp; 0\\
  1 &amp; 1 &amp; 0\\
  1 &amp; 1 &amp; 1
  \end{bmatrix}
  \otimes
  \begin{bmatrix}
  1 &amp; 0 &amp; 1\\
  0 &amp; 1 &amp; 0\\
  1 &amp; 0 &amp; 1
  \end{bmatrix}
  \right)
  =
  \sum_{ij}
  \begin{bmatrix}
  1 &amp; 0 &amp; 0\\
  0 &amp; 1 &amp; 0\\
  1 &amp; 0 &amp; 1
  \end{bmatrix}
  = 4
  \end{align}</span></p>
  
  <p>where <span class="math-container">$\otimes$</span> is the element-wise multiplication and the summation <span class="math-container">$\sum_{ij}$</span> is over all rows <span class="math-container">$i$</span> and columns <span class="math-container">$j$</span> (of the matrices).</p>
  
  <p>To compute all elements of <span class="math-container">$\bf g$</span>, we can think of the kernel <span class="math-container">$\bf h$</span> as being slided over the matrix <span class="math-container">$\bf f$</span>.</p>
  
  <p>In general, the kernel function <span class="math-container">$\bf h$</span> can be fixed. However, in the context of CNNs, the kernel <span class="math-container">$\bf h$</span> represents the learnable parameters of the CNN: in other words, during the training procedure (using e.g. gradient descent and back-propagation), this kernel <span class="math-container">$\bf h$</span> (which thus can be thought of as a matrix of weights) changes. </p>
  
  <p>In the context of CNNs, there is often more than one kernel: in other words, it is often the case that a sequence of kernels <span class="math-container">$\bf h_1, h_2, \dots, h_k$</span> is applied to <span class="math-container">$\bf f$</span> to produce a sequence of convolutions <span class="math-container">$\bf g_1, g_2, \dots, g_k$</span>. Each kernel <span class="math-container">$\bf h_i$</span> is used to "detect different features of the input", so these kernels are different from each other.</p>
  
  <p>A <em>down-sampling</em> operation is an operation that reduces the input size while attempting to maintain as much information as possible. For example, if the input size is a <span class="math-container">$2 \times 2$</span> matrix <span class="math-container">$\bf f = \begin{bmatrix} 1 &amp; 2 \\ 3 &amp; 0 \end{bmatrix}$</span>, a common down-sampling operation is called the <em>max-pooling</em>, which, in the case of <span class="math-container">$\bf f$</span>, returns <span class="math-container">$3$</span> (the maximum element of <span class="math-container">$\bf f$</span>).</p>
  
  <p>CNNs are particularly suited to deal with high-dimensional inputs (e.g. images), because, compared to FFNNs, they use a smaller number of learnable parameters (which, in the context of CNNs, are the kernels). So, they are often used to e.g. classify images.</p>
  
  <p><strong>What is the fundamental difference between RNNs and CNNs?</strong> RNNs have recurrent connections while CNNs do not necessarily have them. The fundamental operation of a CNN is the convolution operation, which is not present in a standard RNN.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-13T21:21:24.660Z
Answers.LastActivityDate: 2019-06-04T17:20:10.343Z
Answers.LastEditDate: 2019-06-04T17:20:10.343Z
Answers.UserDisplayName: nbro
Answers.Body: <p>Basically, a CNN saves a set of weights and applies them spatially. For example, in a layer, I could have 32 sets of weights (also called feature maps). Each set of weights is a 3x3 block, meaning I have 3x3x32=288 weights for that layer. If you gave me an input image, for each 3x3 map, I slide it across all the pixels in the image, multiplying the regions together. I repeat this for all 32 feature maps, and pass the outputs on. So, I am learning a few weights that I can apply at a lot of locations.</p>
  
  <p>For an RNN, it is a set of weights applied temporally (through time). An input comes in, and is multiplied by the weight. The networks saves an internal state and puts out some sort of output. Then, the next piece of data comes in, and is multiplied by the weight. However, the internal state that was created from the last piece of data also comes in and is multiplied by a different weight. Those are added and the output comes from an activation applied to the sum, times another weight. The internal state is updated, and the process repeats.</p>
  
  <p>CNN's work really well for computer vision. At the low levels, you often want to find things like vertical and horizontal lines. Those kinds of things are going to be all over the images, so it makes sense to have weights that you can apply anywhere in the images.</p>
  
  <p>RNN's are really good for natural language processing. You can imagine that the next word in a sentence will be highly influenced by the ones that came before it, so it makes sense to carry that internal state forward and have a small set of weights that can apply to any input.</p>
  
  <p>However, there are many more applications. In addition, CNN's have performed well on NLP tasks. There are also more advanced versions of RNN's called LSTM's that you could check out.</p>
  
  <p>For an explanation of CNN's, go to the <a href="http://cs231n.stanford.edu/syllabus.html" rel="noreferrer">Stanford CS231n course</a>. Especially check out lecture 5. There are full class videos on YouTube.</p>
  
  <p>For an explanation of RNN's, go <a href="http://www.wildml.com/2015/09/recurrent-neural-networks-tutorial-part-1-introduction-to-rnns/" rel="noreferrer">here</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-13T21:46:09.027Z
Answers.Text: IMHO, this is a quite confusing explanation.
Answers.UserDisplayName: nbro
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-08T17:18:19.240Z
Answers.LastActivityDate: 2017-12-08T17:18:19.240Z
Answers.UserDisplayName: pshlady
Answers.Body: <p>On a basic level, an RNN is a neural network whose next state depends on its past state(s), while a CNN is a neural network that does dimensionality reduction (make large data smaller while preserving information) via convolution. <a href="https://en.wikipedia.org/wiki/Kernel_(image_processing)" rel="nofollow noreferrer">See this</a> for more info on convolutions </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-13T21:58:18.597Z
Answers.Text: This is misleading. CNNs are not strictly used for dimensionality reduction. Furthermore, it is the down-sampling operation that reduces the dimensions of the input (not necessarily the convolution).
Answers.UserDisplayName: nbro
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-08T18:54:08.843Z
Answers.LastActivityDate: 2017-12-08T18:54:08.843Z
Answers.UserDisplayName: k.c. sayz 'k.c sayz'
Answers.Body: <p>In the case of applying both to natural language, CNN's are good at extracting local and position-invariant features but it does not capture long range semantic dependencies. It just consider local key-phrasses. </p>
  
  <p>So when the result is determined by the entire sentence or a long-range semantic dependency CNN is not effective as shown in <a href="https://arxiv.org/abs/1702.01923" rel="nofollow noreferrer">this</a> paper where the authors compared both architechrures on NLP takss.</p>
  
  <p>This can be extended for general case. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-29T12:19:52.823Z
Answers.LastActivityDate: 2019-10-29T12:19:52.823Z
Answers.UserDisplayName: Firas Omrane
Body: <p>What is the fundamental difference between convolutional neural networks and recurrent neural networks? Where are they applied?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-06-05T14:44:00.183Z
Comments.Text: Better do not think about RNN/CNN as different networks, but as different network capabilities: a network can be stateless or stateful ( as RNN, LSTM, deep ); a network can/cannot have spatial operators (as 2D convolution, like CNN); ...
Comments.UserDisplayName: pasaba por aqui
Tags: <neural-networks><convolutional-neural-networks><recurrent-neural-networks><comparison>
Title: What is the fundamental difference between CNN and RNN?
UserDisplayName: Pradeep BV
ThreadText: # What is the fundamental difference between CNN and RNN?
  
  (Asked by: username_0 on 2017-12-08)
  
  What is the fundamental difference between convolutional neural networks and recurrent neural networks? Where are they applied?
  
  **Tags:** neural-networks, convolutional-neural-networks, recurrent-neural-networks, comparison
  > **Comments:**
  > **username_1**: Better do not think about RNN/CNN as different networks, but as different network capabilities: a network can be stateless or stateful ( as RNN, LSTM, deep ); a network can/cannot have spatial operators (as 2D convolution, like CNN); ...  
  
  ---
  
  ## 5 answers
  
  ### Answer by username_3 on 2019-05-13. Score: 8
  
  **[Recurrent neural networks](https://ai.stackexchange.com/a/12043/2444)** (RNNs) are artificial neural networks (ANNs) that have one or more recurrent (or cyclic) connections, as opposed to just having feed-forward connections, like a feed-forward neural network (FFNN).
  
  These cyclic connections are used to keep track of temporal relations or dependencies between the elements of a sequence. Hence, RNNs are suited for sequence prediction or related tasks.
  
  In the picture below, you can observe an RNN on the left (that contains only one hidden unit) that is equivalent to the RNN on the right, which is its "unfolded" version. For example, we can observe that $\bf h\_1$ (the hidden unit at time step $t=1$) receives both an input $\bf x\_1$ and the value of the hidden unit at the previous time step, that is, $\bf h\_0$.
  
  [![enter image description here](https://i.sstatic.net/7HI1R.png)](https://i.sstatic.net/7HI1R.png)
  
  The cyclic connections (or the weights of the cyclic edges), like the feed-forward connections, are learned using an optimisation algorithm (like gradient descent) often combined with back-propagation (which is used to compute the gradient of the loss function).
  
  **Convolutional neural networks** (CNNs) are ANNs that perform one or more [convolution](https://en.wikipedia.org/wiki/Convolution) (or [cross-correlation](https://en.wikipedia.org/wiki/Cross-correlation)) operations (often followed by a [down-sampling](https://en.wikipedia.org/wiki/Downsampling_(signal_processing)) operation).
  
  The convolution is an operation that takes two functions, $\bf f$ and $\bf h$, as input and produces a third function, $\bf g = f \circledast h$, where the symbol $\circledast$ denotes the convolution operation. In the context of CNNs, the input function $\bf f$ can e.g. be an image (which can be thought of as a function from 2D coordinates to RGB or grayscale values). The other function $\bf h$ is called the "kernel" (or filter), which can be thought of as (small and square) matrix (which contains the output of the function $\bf
  h$). $\bf f$ can also be thought of as a (big) matrix (which contains, for each cell, e.g. its grayscale value).
  
  In the context of CNNs, the *convolution* operation can be thought of as dot product between the kernel $\bf h$ (a matrix) and several parts of the input (a matrix).
  
  In the picture below, we perform an [*element-wise multiplication*](https://en.wikipedia.org/wiki/Hadamard_product_(matrices)) between the kernel $\bf h$ and part of the input $\bf h$, then we sum the elements of the resulting matrix, and that is the value of the convolution operation for that specific part of the input.
  
  [![enter image description here](https://i.sstatic.net/EiujB.png)](https://i.sstatic.net/EiujB.png)
  
  To be more concrete, in the picture above, we are performing the following operation
  
  \begin{align}
  \sum\_{ij}
  \left(
  \begin{bmatrix}
  1 & 0 & 0\\
  1 & 1 & 0\\
  1 & 1 & 1
  \end{bmatrix}
  \otimes
  \begin{bmatrix}
  1 & 0 & 1\\
  0 & 1 & 0\\
  1 & 0 & 1
  \end{bmatrix}
  \right)
  =
  \sum\_{ij}
  \begin{bmatrix}
  1 & 0 & 0\\
  0 & 1 & 0\\
  1 & 0 & 1
  \end{bmatrix}
  = 4
  \end{align}
  
  where $\otimes$ is the element-wise multiplication and the summation $\sum\_{ij}$ is over all rows $i$ and columns $j$ (of the matrices).
  
  To compute all elements of $\bf g$, we can think of the kernel $\bf h$ as being slided over the matrix $\bf f$.
  
  In general, the kernel function $\bf h$ can be fixed. However, in the context of CNNs, the kernel $\bf h$ represents the learnable parameters of the CNN: in other words, during the training procedure (using e.g. gradient descent and back-propagation), this kernel $\bf h$ (which thus can be thought of as a matrix of weights) changes.
  
  In the context of CNNs, there is often more than one kernel: in other words, it is often the case that a sequence of kernels $\bf h\_1, h\_2, \dots, h\_k$ is applied to $\bf f$ to produce a sequence of convolutions $\bf g\_1, g\_2, \dots, g\_k$. Each kernel $\bf h\_i$ is used to "detect different features of the input", so these kernels are different from each other.
  
  A *down-sampling* operation is an operation that reduces the input size while attempting to maintain as much information as possible. For example, if the input size is a $2 \times 2$ matrix $\bf f = \begin{bmatrix} 1 & 2 \\ 3 & 0 \end{bmatrix}$, a common down-sampling operation is called the *max-pooling*, which, in the case of $\bf f$, returns $3$ (the maximum element of $\bf f$).
  
  CNNs are particularly suited to deal with high-dimensional inputs (e.g. images), because, compared to FFNNs, they use a smaller number of learnable parameters (which, in the context of CNNs, are the kernels). So, they are often used to e.g. classify images.
  
  **What is the fundamental difference between RNNs and CNNs?** RNNs have recurrent connections while CNNs do not necessarily have them. The fundamental operation of a CNN is the convolution operation, which is not present in a standard RNN.
  
  
  ---
  
  ### Answer by username_4 on 2017-12-08. Score: 7
  
  Basically, a CNN saves a set of weights and applies them spatially. For example, in a layer, I could have 32 sets of weights (also called feature maps). Each set of weights is a 3x3 block, meaning I have 3x3x32=288 weights for that layer. If you gave me an input image, for each 3x3 map, I slide it across all the pixels in the image, multiplying the regions together. I repeat this for all 32 feature maps, and pass the outputs on. So, I am learning a few weights that I can apply at a lot of locations.
  
  For an RNN, it is a set of weights applied temporally (through time). An input comes in, and is multiplied by the weight. The networks saves an internal state and puts out some sort of output. Then, the next piece of data comes in, and is multiplied by the weight. However, the internal state that was created from the last piece of data also comes in and is multiplied by a different weight. Those are added and the output comes from an activation applied to the sum, times another weight. The internal state is updated, and the process repeats.
  
  CNN's work really well for computer vision. At the low levels, you often want to find things like vertical and horizontal lines. Those kinds of things are going to be all over the images, so it makes sense to have weights that you can apply anywhere in the images.
  
  RNN's are really good for natural language processing. You can imagine that the next word in a sentence will be highly influenced by the ones that came before it, so it makes sense to carry that internal state forward and have a small set of weights that can apply to any input.
  
  However, there are many more applications. In addition, CNN's have performed well on NLP tasks. There are also more advanced versions of RNN's called LSTM's that you could check out.
  
  For an explanation of CNN's, go to the [Stanford CS231n course](http://cs231n.stanford.edu/syllabus.html). Especially check out lecture 5. There are full class videos on YouTube.
  
  For an explanation of RNN's, go [here](http://www.wildml.com/2015/09/recurrent-neural-networks-tutorial-part-1-introduction-to-rnns/).
  
  > **Comments:**
  > **username_3**: IMHO, this is a quite confusing explanation.  
  
  ---
  
  ### Answer by username_2 on 2019-06-05. Score: 3
  
  **CNN vs RNN**
  
  * A CNN will learn to recognize patterns across space while RNN is useful for solving temporal data problems.
  * CNNs have become the go-to method for solving any image data challenge while RNN is used for ideal for text and speech analysis.
  * In a very general way, a CNN will learn to recognize components of an image (e.g., lines, curves, etc.) and then learn to combine these components to recognize larger structures (e.g., faces, objects, etc.) while an RNN will similarly learn to recognize patterns across time. So a RNN that is trained to convert speech to text should learn first the low level features like characters, then higher level features like phonemes and then word detection in audio clip.
  
  ---
  
  **CNN**
  
  A convolutional network (ConvNet) is made up of layers.
  In a convolutional network (ConvNet), there are basically three types of layers:
  
  * Convolution layer
  * Pooling layer
  * Fully connected layer
  
  Of these, the convolution layer applies convolution operation on the input 3D tensor. Different filters extract different kinds of features from an image. The below GIF illustrates this point really well:
  
  ![Convolutional Filter in ConvNets](https://i.sstatic.net/6NqcU.gif)
  
  Here the filter is the green 3x3 matrix while the image is the blue 7x7 matrix.
  
  Many such layers passes through filters in CNN to give an output layer that can again be a NN Fully connected layer or a 3D tensor.
  
  ![CNN](https://i.sstatic.net/mmcsz.jpg)
  
  For example, in the above example, the input image passes through convolutional layer, then pooling layer, then convolutional layer, pooling layer, then the 3D tensor is flattened like a Neural Network 1D layer, then passed to a fully connected layer and finally a softmax layer. This makes a CNN.
  
  ---
  
  **RNN**   
  Recurrent Neural Network(RNN) are a type of Neural Network where the output from previous step are fed as input to the current step.
  
  ![RNN model](https://i.sstatic.net/RAeF7.png)
  
  Here, $x\_{t-1}$, , $x\_{t}$ and $x\_{t+1}$ are the values of inputs data that occur at a specific time steps and are fed into the RNN that goes through the hidden layers namely $h\_{t-1}$, , $h\_{t}$ and $h\_{t+1}$ which further produces output $o\_{t-1}$, , $o\_{t}$ and $o\_{t+1}$ respectively.
  
  
  ---
  
  ### Answer by username_5 on 2017-12-08. Score: 0
  
  On a basic level, an RNN is a neural network whose next state depends on its past state(s), while a CNN is a neural network that does dimensionality reduction (make large data smaller while preserving information) via convolution. [See this](https://en.wikipedia.org/wiki/Kernel_(image_processing)) for more info on convolutions
  
  > **Comments:**
  > **username_3**: This is misleading. CNNs are not strictly used for dimensionality reduction. Furthermore, it is the down-sampling operation that reduces the dimensions of the input (not necessarily the convolution).  
  
  ---
  
  ### Answer by username_6 on 2019-10-29. Score: 0
  
  In the case of applying both to natural language, CNN's are good at extracting local and position-invariant features but it does not capture long range semantic dependencies. It just consider local key-phrasses.
  
  So when the result is determined by the entire sentence or a long-range semantic dependency CNN is not effective as shown in [this](https://arxiv.org/abs/1702.01923) paper where the authors compared both architechrures on NLP takss.
  
  This can be extended for general case.
  
  
  ---
  
  