How can I adjust a deep neural network input layer to use a matrix as the input layer?

4 ビュー (過去 30 日間)
Lynn Marciano
Lynn Marciano 2018 年 7 月 5 日
回答済み: Jahetbe 2022 年 2 月 9 日
I have a matrix of 419632 x 1420 doubles. I tried to create a custom deep neural network model but it seems as though the inputLayers that MATLAB provides are the imageInputLayer and sequenceInputLayer. I tried inputting my data as a sequenceInputLayer but when I did that, it wanted to make my model into a recurrent neural network; which is not what I want to do. Is there anyway to have basically a 'matrixInputLayer' or has anyone encountered this issue and could lead me in the right direction to get good insight to maybe create my custom input layer that handles matrices?
Thanks in advance.
  1 件のコメント
Alpha Bravo
Alpha Bravo 2018 年 7 月 7 日
A black and white image is basically a matrix. You could try to use [419632 1420 1] as the input dimension or somehow fool Matlab into thinking your matrix is a black and white image.

サインインしてコメントする。

回答 (2 件)

Samuel Louis Sudhof
Samuel Louis Sudhof 2019 年 12 月 18 日
I have the same question. Telling matlab that it's somehow image data when it's not seems hacked. Isn't there a cleaner way to insert raw matrix data into a neural network?
Seems to me like the most basic input layer of a neural network is missing, if that's the case. What gives?

Jahetbe
Jahetbe 2022 年 2 月 9 日
nFeatures = 20;
nExamples = 10000;
nOutputs = 1; % this example is for setting up a regression problem
x = rand(nExamples,nFeatures);
t = rand(nExamples, nOutputs);
XNew = reshape(x', [1,1,size(x,2),size(x,1)]);
layers = [ ...
imageInputLayer([1 1 nFeatures]); % this layer needs the first 3 dimensions of input "XNew"
fullyConnectedLayer(10);
fullyConnectedLayer(nOutputs); % this connected layer needs to have an output-size same as the number of responses (columns) in the output data set "t"
regressionLayer];
options = trainingOptions('sgdm');
trainedNet = trainNetwork(XNew, t, layers, options);

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by