使用CNN进行一维数据

使用CNN进行一维数据

本文介绍了使用CNN进行一维数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道是否有人这样做?我有一个一维的数据集(虽然不确定这是否是正确的单词选择).与通常的CNN输入是图像(即2D)不同,我的数据只有一维.一个例子是:

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

如何将我的数据集与CNN一起使用?我看过的图像接受以下形式的图像(例如AlexNet和GoogleNet):

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

感谢任何帮助.

谢谢!

推荐答案

如果您的数据在空间上相关(您说不相关),则可以使用以下方法将其提供给convnet(或具体来说是conv2d层)形状为1xNx1或Nx1x1(行x列x通道).

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).

如果这根本不是空间数据-您只有N个与空间无关的要素,则形状应为1x1xN.

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

为完整性起见,我应该指出,如果您的数据确实是非空间的,那么使用卷积层/网络真的没有意义.您可以将其整形为1x1xN,然后使用1x1卷积,但是由于1x1卷积的作用与完全连接的层(又称稠密的线性层)完全相同,因此您也可以使用它来代替

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.

这篇关于使用CNN进行一维数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 12:26