利用Matlab DeepLearning Toolbox 训练模型,期望找到信号协方差矩阵信息和对应入射角度之间的关系。
训练数据:90 * 19800 double型矩阵,每个列向量是一个sample,代表了一个方向信号的协方差矩阵信息。
标记:0,1组成的矩阵120 * 19800(120 为 -60 到 60度角度,step为1),每个sample对应一个120长度的列向量(0表示该方向无信号,1表示有) 。
L = load('L.mat').L;
T = load('TReconstructed.mat').TReconstructed;
% L = categorical(L);
% L1 = {};
% for i = 1:19800
% L1{i} = L(:,i);
% end
miniBatchSize = 32;
maxEpochs = 500;
inputSize = 90;
numHiddenUnits = 30;
numClasses = 120;
options = trainingOptions('adam', ...
'MaxEpochs',maxEpochs, ...
'MiniBatchSize',miniBatchSize, ...
'Verbose',false, ...
'Plots','training-progress');
layers = [...
sequenceInputLayer(inputSize)
lstmLayer(100, 'OutputMode', 'last')
fullyConnectedLayer(numClasses)
tanhLayer
fullyConnectedLayer(numClasses)
softmaxLayer
classificationLayer];
net = trainNetwork(T,L,layers,options);
出现如下错误:
Error using trainNetwork (line 170)
Invalid training data. Responses must be a vector of categorical responses, or a cell array of categorical response sequences.
Error in Parallel _ Classifier (line 32)
net = trainNetwork(T,L,layers,options);
尝试:
如上注释部分,L = categorical(L)
包括重新把L每列组成一个元胞数组单元,再加上categorical,依然有如上错误。
求解决方法。是否网络构造不适合这种数据?