disp('展示BP的训练集分类')
bp_train_accuracy=sum(J==J1)/length(J)
figure
stem(J,'bo');
grid on
hold on
plot(J1,'r*');
legend('网络训练输出','真实标签')
title('BP神经网络训练集')
xlabel('样本数')
ylabel('分类标签')
hold off
%% 测试集准确率
tn_bp_sim = sim(net_bp,P_test);%测试
[I J]=max(tn_bp_sim',[],2);
[I1 J1]=max(T_test',[],2);
disp('展示BP的测试集分类')
bp_test_accuracy=sum(J==J1)/length(J)
figure
stem(J,'bo');
grid on
hold on
plot(J1,'r*');
legend('测试输出','真实标签')
title('BP神经网络测试集')
xlabel('样本数')
ylabel('分类标签')
hold off