1个回答
展开全部
clr;
%%
v1 = [12 32 23 ];% 开盘价时间序列
v2 = [23 43 121];
v3 = [123 343 21];
v = [v1;v2;v3]
% 对应的结算价
p = [43 54 65];
%% 行数列数
[rowNum,clmNum] = size(v);
hide_ele_num = 2*rowNum+1;% 隐藏层神经元个数
%% 建网
net = feedforwardnet(hide_ele_num,'traingdm');
%% 训练参数
net.trainParam.epochs = 10000;% 最多训练多少次
net.trainParam.goal = 0.001;% 训练到什么程度才算成功
net.layers{1}.transferFcn = 'tansig';
net.layers{2}.transferFcn = 'purelin';
%% 开始训练
[net,tr] = train(net,v,p);
%% 使用网络
v_test=[21 45 54]';
p_test = [43];
result = net(v_test)
%% 查看误差
%E = p_test-result;
%MSE = mse(E);
%perf = perform(net,result,p_test)
感谢的话,接受比特币:1CmJdau9hmvHQgkw5ZhTq1zgTXJgxQEv64
https://blockchain.info/payment_request?address=1CmJdau9hmvHQgkw5ZhTq1zgTXJgxQEv64
😁
%%
v1 = [12 32 23 ];% 开盘价时间序列
v2 = [23 43 121];
v3 = [123 343 21];
v = [v1;v2;v3]
% 对应的结算价
p = [43 54 65];
%% 行数列数
[rowNum,clmNum] = size(v);
hide_ele_num = 2*rowNum+1;% 隐藏层神经元个数
%% 建网
net = feedforwardnet(hide_ele_num,'traingdm');
%% 训练参数
net.trainParam.epochs = 10000;% 最多训练多少次
net.trainParam.goal = 0.001;% 训练到什么程度才算成功
net.layers{1}.transferFcn = 'tansig';
net.layers{2}.transferFcn = 'purelin';
%% 开始训练
[net,tr] = train(net,v,p);
%% 使用网络
v_test=[21 45 54]';
p_test = [43];
result = net(v_test)
%% 查看误差
%E = p_test-result;
%MSE = mse(E);
%perf = perform(net,result,p_test)
感谢的话,接受比特币:1CmJdau9hmvHQgkw5ZhTq1zgTXJgxQEv64
https://blockchain.info/payment_request?address=1CmJdau9hmvHQgkw5ZhTq1zgTXJgxQEv64
😁
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询