目录
一、数据集介绍
1.输入数据(XRHJDataInput.mat)
2.目标数据(XRHJDataTarget.mat)
3.预测数据(newdata_pre18.mat)
二、模型训练
1.训练过程
2.Matlab程序代码
三、网络训练
四、模型性能
五、泛化输出
1.newdata(开盘价,成交量)
2.BPoutput(收盘价、最高价、最低价)
一、数据集介绍
开盘价(1)、成交量(2),共641行,2列。
2.目标数据(XRHJDataTarget.mat)
收盘价(1)、最高价(2)、最低价(3),共641行,3列。
3.预测数据(newdata_pre18.mat)
开盘价(1)、成交量(2),共18行,2列。
数据集:https://pan.baidu.com/s/1JqCpsVGcRXHZS3tL31DREw
提取码:TTXS
二、模型训练
1.训练过程
2.Matlab程序代码
% Solve an Input-Output Fitting problem with a Neural Network
% Script generated by Neural Fitting app
% Created 07-Oct-2021 22:50:17
%
% This script assumes these variables are defined:
%
% data - input data.
% dataTarget - target data.
load XRHJDataInput.mat
load XRHJDataTarget.mat
x = data';
t = dataTarget';
% Choose a Training Function
% For a list of all training functions type: help nntrain
% 'trainlm' is usually fastest.
% 'trainbr' takes longer but may be better for challenging problems.
% 'trainscg' uses less memory. Suitable in low memory situations.
trainFcn = 'trainlm'; % Levenberg-Marquardt backpropagation.
% Create a Fitting Network
hiddenLayerSize = 10;
net = fitnet(hiddenLayerSize,trainFcn);
% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
% Train the Network
[net,tr] = train(net,x,t);
% Test the Network
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y)
% View the Network
view(net)
% Plots
% Uncomment these lines to enable various plots.
%figure, plotperform(tr)
%figure, plottrainstate(tr)
%figure, ploterrhist(e)
%figure, plotregression(t,y)
%figure, plotfit(net,x,t)
%泛化
load newdata_pre18.mat
x = newdata';%newdata
BPOutPut=sim(net,x)%
三、网络训练
四、模型性能
performance = 0.0023
五、泛化输出
1.newdata(开盘价,成交量)
2.BPoutput(收盘价、最高价、最低价)