clc
clear
train_input=[56 57 57 57;
57 57 57 57;
57 57 57 57;
57 57 57 57;
57 57 57 58;
57 57 58 58;
57 58 58 58;
58 58 58 59;
58 58 59 59;
58 59 59 59;
59 59 59 60;
59 59 60 60;
59 60 60 60;
60 60 60 60;
60 60 60 60;
60 60 60 60;
60 60 60 60;
60 60 60 60;
60 60 60 60;
60 60 60 60;
60 60 60 61;
60 60 61 61;
60 61 61 61;
61 61 61 61;
61 61 61 62;
61 61 62 62;
61 62 62 62;
62 62 62 62;
62 62 62 62;
62 62 62 62;
62 62 62 63;
62 62 63 63;
62 63 63 63;
63 63 63 64;
63 63 64 65;
63 64 65 65;
64 65 65 65;
65 65 65 65;
65 65 65 66;
65 65 66 66;
65 66 66 66;
66 66 66 67;
66 66 67 67;
66 67 67 68;
67 67 68 68;
67 68 68 68;
68 68 68 68;
68 68 68 68;
68 68 68 68;
68 68 68 68;
68 68 68 68;
68 68 68 68;
68 68 68 68;
68 68 68 68;
68 68 68 68;
68 68 68 68];
train_input=train_input';
train_output=[57;
57;
57;
58;
58;
58;
59;
59;
59;
60;
60;
60;
60;
60;
60;
60;
60;
60;
60;
61;
61;
61;
61;
62;
62;
62;
62;
62;
62;
63;
63;
63;
64;
65;
65;
65;
65;
66;
66;
66;
67;
67;
68;
68;
68;
68;
68;
68;
68;
68;
68;
68;
68;
68;
68;
69];
train_output=train_output';
bpnet=newff(train_input,train_output,[10,1],{'tansig','purelin'},'traingd');
bpnet.trainparam.show=5;
bpnet.trainparam.epochs=500;
bpnet.trainparam.goal=0.0001;
bpnet.trainparam.lr=0.01;
[bpnet,tr]=train(bpnet,train_input,train_output);
A=sim(bpnet,train_input);
E=A-train_output;
figure(1)
plot(train_output,'k');
hold on
plot(A,'K.:');
legend('训练样本值','BP拟合值');xlabel('样本序号');ylabel('深基坑沉降量');
figure(2)
plot(train_output-A,'-');
legend('训练样本误差');ylabel('训练绝对误差');xlabel('样本序号');ylabel('深基坑沉降量')
grid;
test_input=[68 68 68 69;
68 68 69 69;
68 69 69 69;
69 69 69 70;
69 69 70 71;
69 70 71 72;
70 71 72 72;
71 72 72 72;
72 72 72 72;
72 72 72 73;
72 72 73 74;
72 73 74 75];
test_input=test_input';
test_output=[69;
69;
70;
71;
72;
72;
72;
72;
73;
74;
75;
75];
test_output=test_output';
a2n=sim(bpnet,test_input);
E=a2n-test_output;
figure(3)
plot(test_output,'K');
hold on
plot(a2n,'K.:');
legend('实际输出值','期望输出值');xlabel('样本序号');ylabel('深基坑施工风险评估值');
figure(4)
plot(test_output-a2n,'-');
legend('测试样本误差');ylabel('测试绝对误差');xlabel('样本序号');
a2n
请问BP神经网络怎么对未来的数据进行预测?感觉train_input和test_output这些都是已知的数据?是只用来训练模型的吗?那要预测未来的数据还需要怎么做呢?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
悬赏问题
- ¥20 腾讯企业邮箱邮件可以恢复么
- ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
- ¥15 错误 LNK2001 无法解析的外部符号
- ¥50 安装pyaudiokits失败
- ¥15 计组这些题应该咋做呀
- ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
- ¥15 让node服务器有自动加载文件的功能
- ¥15 jmeter脚本回放有的是对的有的是错的
- ¥15 r语言蛋白组学相关问题
- ¥15 Python时间序列如何拟合疏系数模型