Products
GG网络技术分享 2025-11-13 15:30 1
根据上文,
用nntool或feedforwardnet函数构建神经网络。指定网络的层数、每层的节点数、激活函数等参数。

matlab
net = feedforwardnet;
设置训练参数, 如学率、训练迭代次数等。
matlab
net.divideParam.trainRatio = 0.8;
net.divideParam.valRatio = 0.1;
net.divideParam.testRatio = 0.1;
net.trainParam.epochs = 100;
用train函数进行训练。
matlab
= train;
用confusionmat、 roc、crossvalind等函数评估网络的性Neng。
matlab
y_pred = net;
= confusion;
acc = sum) / sum);
= perfcurve;
plot;
调整学率、 处罚项、正则化等参数,搞优良网络性Neng。
matlab
net.trainParam.eta = 0.01;
net.performParam.normalization = 'zscore';
net.performParam.earlyStopping = true;
用训练优良的网络进行预测。
matlab
outputs = net;
Demand feedback