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!
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 feature, see DuttaA's comment below).
For example, in image, connection between pixels in some area give you another feature (e.g. edge) instead of 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 character (that form words) so you can use CNN for text classification in character level.
For Speech recognition, there are also connection between frequencies from one frame with some previous and next frames, so you can also use CNN for speech recognition.
If your data have spatial features, just reshape it to 1D array (for exammple in text) or 2D array (for example in Audio). Tensorflow's function conv1d and conv2d are general function that can be used on any data. It look the data as array of floating point, not as image/audio/text.
But if your data doesn't have spatial feature, for example your features are
status_marriage, etc. I think, you don't need CNN, and using CNN won't help.
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.