<>数据格式

样本一列数据存入cell的一行
标签为一列 categorical类型
网络设置时分类为last,回归为sequence

<>代码
%数据参数 inputSize = 784; numClasses = 10; %结构 layers = [ ...
sequenceInputLayer(inputSize) lstmLayer(125,'OutputMode','sequence')
lstmLayer(125,'OutputMode','last') fullyConnectedLayer(numClasses)
softmaxLayer() classificationLayer() ]; %参数 options = trainingOptions('adam',
... 'MaxEpochs',8000, ... 'MiniBatchSize',7000, ... 'Verbose',true, ...
'InitialLearnRate',0.02, ... 'L2Regularization',0.0010, ...
'LearnRateDropPeriod',4, ... 'LearnRateDropFactor',0.04, ...
'plots','training-progress'); %训练 net =
trainNetwork(TrainData,TrainLabels,layers,options); %测试 YPred =
classify(net,TestData, ... 'MiniBatchSize',7000, ...
'SequenceLength','longest'); %准确率 acc = sum(YPred ==
TestLabels)./numel(TestLabels)

技术
友情链接
码工具
Toolsou
API参考文档
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信