Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

One dimensional data with CNN

Just wondering whether anybody has done this? I have a dataset that is one dimensional (not sure whether it's the right word choice though). Unlike the usual CNN inputs which are images (so 2D), my data only has one dimension. An example would be:

instance1 - feature1, feature2,...featureN

instance2 - feature1, feature2,...featureN

...

instanceM - feature1, feature2,...featureN

How do I use my dataset with CNNs? the ones I have looked at accepts images (like AlexNet and GoogleNet) in the form:

instance1 - 2d feature matrix

instance2 - 2d feature matrix2

...

instanceM - 2d feature matrixN

Appreciate any help on it.

Thanks!

like image 710
words_of_wisdom Avatar asked Nov 01 '16 06:11

words_of_wisdom


People also ask

Can CNN be used for 1D data?

1-Dimensional Convolutional Neural Networks1D Convolutional Neural Networks are used mainly used on text and 1D signals.

What is a 1 dimensional convolutional neural network?

1D CNN can perform activity recognition task from accelerometer data, such as if the person is standing, walking, jumping etc. This data has 2 dimensions. The first dimension is time-steps and other is the values of the acceleration in 3 axes. Following plot illustrate how the kernel will move on accelerometer data.

What type of data is used in CNN?

Convolutional Neural Networks (CNNs) are designed to map image data (or 2D multi-dimensional data) to an output variable (1 dimensional data). They have proven so effective that they are the ready to use method for any type of prediction problem involving image data as an input.

Can I use CNN on numerical data?

Yes, you can use a CNN. CNN's are not limited to just images. Use a 1D convolution, not a 2D convolution; you have 1D data, so a 1D convolution is more appropriate. A CNN is a reasonable thing to try, but the only way to find out if it actually works or not is to try it on some real data and evaluate its effectiveness.


1 Answers

If your data were spatially related (you said it isn't) then you'd feed it to a convnet (or, specifically, a conv2d layer) with shape 1xNx1 or Nx1x1 (rows x cols x channels).

If this isn't spatial data at all - you just have N non-spatially-related features, then the shape should be 1x1xN.

For completeness, I should point out that if your data really is non-spatial, then there's really no point in using a convolutional layer/net. You could shape it as 1x1xN and then use 1x1 convolutions, but since a 1x1 convolution does the exact same thing as a fully-connected (aka dense aka linear) layer, you might as well just use that instead.

like image 84
SpinyNormam Avatar answered Oct 17 '22 01:10

SpinyNormam