Answers.Body: <p>The convolutional models are a method of choice when your problem is translation invariant (or covariant). In image classification, the image should be classified into class 'cow' if a cow is present in any part of the image. In text classification, different orders of phrases and sentences result in related meaning. In speech recognition, the same syllable is used at different places to build different words.</p>
  
  <p>In your problem, you should check whether some subsequences of your 1791 columns give rise to the same meaning although they are located at different places within the sample. If the answer is positive, then convolutional layers are likely going to improve the performance.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-08T16:05:53.400Z
Answers.LastActivityDate: 2019-02-08T16:05:53.400Z
Answers.UserDisplayName: ssegvic
Answers.Body: <p>DeepInsight method has been used for converting tabular data into corresponding images which are then processed by CNN. Here is the link <a href="https://alok-ai-lab.github.io/DeepInsight/" rel="nofollow noreferrer">https://alok-ai-lab.github.io/DeepInsight/</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-08-17T08:34:56.977Z
Answers.LastActivityDate: 2021-08-17T08:34:56.977Z
Answers.UserDisplayName: Astha
Answers.Body: <p>You can use CNN on any data, but it's <strong>recommended</strong> to use CNN only on data that have spatial features (It might still work on data that doesn't have spatial features, see DuttaA's comment below).</p>
  <p>For example, in the image, the connection between pixels in some area gives you another feature (e.g. edge) instead of a feature from one pixel (e.g. color). So, as long as you can shaping your data, and your data have spatial features, you can use CNN.</p>
  <p>For Text classification, there are connections between characters (that form words) so you can use CNN for <a href="https://papers.nips.cc/paper/5782-character-level-convolutional-networks-for-text-classification.pdf" rel="noreferrer">text classification in character level</a>.</p>
  <p>For Speech recognition, there is also a connection between frequencies from one frame with some previous and next frames, so you can also use <a href="https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/CNN_ASLPTrans2-14.pdf" rel="noreferrer">CNN for speech recognition</a>.</p>
  <p>If your data have spatial features, just reshape it to a 1D array (for example in text) or 2D array (for example in Audio). Tensorflow's function <a href="https://www.tensorflow.org/api_docs/python/tf/nn/conv1d" rel="noreferrer">conv1d</a> and <a href="https://www.tensorflow.org/api_docs/python/tf/nn/conv2d" rel="noreferrer">conv2d</a> are general function that can be used on any data. It look the data as an array of floating-point, not as image/audio/text.</p>
  <p>But if your data doesn't have spatial features, for example, your features are <code>price</code>, <code>salary</code>, <code>status_marriage</code>, etc. I think you don't need CNN, and using CNN won't help.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-08T22:05:44.957Z
Answers.Text: hmm that's true, that's why I said "it's recommended to use CNN only on data that have spatial features", I think I'll add your comment to give more emphasis
Answers.UserDisplayName: malioboro
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-12T04:20:47.323Z
Answers.Text: @DuttaA I think "CNNs are just a special case of NNs" would be more correct. Unless you're thinking of 1x1 convolutions of a 1x1 input "image" of 1972 "channels"..
Answers.UserDisplayName: tsbertalan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-18T23:02:38.577Z
Answers.Text: @DuttA Yeah, I guess if filter size=image size, and you use "valid" padding, the output will be 1x1xM, after which further convolutions will just be 1x1xN, then 1x1xO, etc as I said, where M, N, O, etc. are equivalent to the widths of successive layers in a normal MLP. I mentioned 1x1 convolutions since this is a common way that MLP-like results are achieved with CNNs pointwise (e.g. in fully-convolutional NNs).
Answers.UserDisplayName: tsbertalan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-27T16:21:02.350Z
Answers.Text: Some websites claim that DeepL uses a CNN but I did not find this information on the company's website itself. Here is one website that makes this claim: https://blog.meinrad.cc/en/deepl-google-translate-not-all-machine-translation-engines-are-created-equal. This website: https://slator.com/inside-deepl-the-worlds-fastest-growing-most-secretive-machine-translation-company/ also mentions that DeepL seemed to use that in the past but later mentions someone that said “I’d be surprised if DeepL is still using CNNs,”
Answers.UserDisplayName: userrandrand
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-27T16:26:47.647Z
Answers.Text: The company website itself says the following: "... direct modifications of the Transformer architecture. Of course, the neural networks of DeepL also contain parts of this architecture, such as attention mechanisms. However, there are also significant differences in the topology of the networks". So a plausible guess is that they started with CNN's at some point and then made some architectural designs that integrate the attention layers.
Answers.UserDisplayName: userrandrand
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-08T00:52:25.103Z
Answers.LastActivityDate: 2021-04-13T15:54:51.953Z
Answers.LastEditDate: 2021-04-13T15:54:51.953Z
Answers.UserDisplayName: malioboro
Body: <p>I have a dataset which I have loaded as a data frame in Python. It consists of 21392 rows (the data instances, each row is one sample) and 1972 columns (the features). The last column i.e. column 1972 has string type labels (14 different categories of target labels). I would like to use a CNN to classify the data in this case and predict the target labels using the available features. This is a somewhat unconventional approach though it seems possible. However, I am very confused on how the methodology should be as I could not find any sample code/ pseudo code guiding on using CNN for Classifying non-image data, either in Tensorflow or Keras. Any help in this regard will be highly appreciated. Cheers!</p>
  
Tags: <convolutional-neural-networks><tensorflow>
Title: How to use CNN for making predictions on non-image data?
UserDisplayName: JChat
ThreadText: # How to use CNN for making predictions on non-image data?
  
  (Asked by: username_0 on 2019-02-07)
  
  I have a dataset which I have loaded as a data frame in Python. It consists of 21392 rows (the data instances, each row is one sample) and 1972 columns (the features). The last column i.e. column 1972 has string type labels (14 different categories of target labels). I would like to use a CNN to classify the data in this case and predict the target labels using the available features. This is a somewhat unconventional approach though it seems possible. However, I am very confused on how the methodology should be as I could not find any sample code/ pseudo code guiding on using CNN for Classifying non-image data, either in Tensorflow or Keras. Any help in this regard will be highly appreciated. Cheers!
  
  **Tags:** convolutional-neural-networks, tensorflow
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_3 on 2019-02-08. Score: 12 | Accepted answer
  
  You can use CNN on any data, but it's **recommended** to use CNN only on data that have spatial features (It might still work on data that doesn't have spatial features, see DuttaA's comment below).
  
  For example, in the image, the connection between pixels in some area gives you another feature (e.g. edge) instead of a feature from one pixel (e.g. color). So, as long as you can shaping your data, and your data have spatial features, you can use CNN.
  
  For Text classification, there are connections between characters (that form words) so you can use CNN for [text classification in character level](https://papers.nips.cc/paper/5782-character-level-convolutional-networks-for-text-classification.pdf).
  
  For Speech recognition, there is also a connection between frequencies from one frame with some previous and next frames, so you can also use [CNN for speech recognition](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/CNN_ASLPTrans2-14.pdf).
  
  If your data have spatial features, just reshape it to a 1D array (for example in text) or 2D array (for example in Audio). Tensorflow's function [conv1d](https://www.tensorflow.org/api_docs/python/tf/nn/conv1d) and [conv2d](https://www.tensorflow.org/api_docs/python/tf/nn/conv2d) are general function that can be used on any data. It look the data as an array of floating-point, not as image/audio/text.
  
  But if your data doesn't have spatial features, for example, your features are `price`, `salary`, `status_marriage`, etc. I think you don't need CNN, and using CNN won't help.
  
  > **Comments:**
  > **username_3**: hmm that's true, that's why I said "it's recommended to use CNN only on data that have spatial features", I think I'll add your comment to give more emphasis  
  > **username_4**: @DuttaA I think "CNNs are just a special case of NNs" would be more correct. Unless you're thinking of 1x1 convolutions of a 1x1 input "image" of 1972 "channels"..  
  > **username_4**: @DuttA Yeah, I guess if filter size=image size, and you use "valid" padding, the output will be 1x1xM, after which further convolutions will just be 1x1xN, then 1x1xO, etc as I said, where M, N, O, etc. are equivalent to the widths of successive layers in a normal MLP. I mentioned 1x1 convolutions since this is a common way that MLP-like results are achieved with CNNs pointwise (e.g. in fully-convolutional NNs).  
  > **username_5**: Some websites claim that DeepL uses a CNN but I did not find this information on the company's website itself. Here is one website that makes this claim: https://blog.meinrad.cc/en/deepl-google-translate-not-all-machine-translation-engines-are-created-equal. This website: https://slator.com/inside-deepl-the-worlds-fastest-growing-most-secretive-machine-translation-company/ also mentions that DeepL seemed to use that in the past but later mentions someone that said “I’d be surprised if DeepL is still using CNNs,”  
  > **username_5**: The company website itself says the following: "... direct modifications of the Transformer architecture. Of course, the neural networks of DeepL also contain parts of this architecture, such as attention mechanisms. However, there are also significant differences in the topology of the networks". So a plausible guess is that they started with CNN's at some point and then made some architectural designs that integrate the attention layers.  
  
  ---
  
  ### Answer by username_1 on 2019-02-08. Score: 6
  
  The convolutional models are a method of choice when your problem is translation invariant (or covariant). In image classification, the image should be classified into class 'cow' if a cow is present in any part of the image. In text classification, different orders of phrases and sentences result in related meaning. In speech recognition, the same syllable is used at different places to build different words.
  
  In your problem, you should check whether some subsequences of your 1791 columns give rise to the same meaning although they are located at different places within the sample. If the answer is positive, then convolutional layers are likely going to improve the performance.
  
  
  ---
  
  ### Answer by username_2 on 2021-08-17. Score: 1
  
  DeepInsight method has been used for converting tabular data into corresponding images which are then processed by CNN. Here is the link <https://alok-ai-lab.github.io/DeepInsight/>
  
  
  ---
  
  