One dimensional data with CNN

浪子不回头ぞ 提交于 2019-12-19 05:53:08

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/40355288/one-dimensional-data-with-cnn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!