Input-Output Fitting problem with a Neural Network - Stock predication
Show older comments
Hi, I'm trying to predict stock values(in this case, the closing value). In the end I want to achieve the same result as this example, Example
I will use the "close price" and its corresponding date, but I cannot figure out how to use "input" and "target" and what they mean.
% This script assumes these variables are defined:
x = simplefitInput; //
t = simplefitTargets;
% 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);
% Test the Network
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y)
% View the Network
%view(net)
If understand it correctly, x is the input of the system. But what is t ? So Im wondering: What kind of values do I give to x and t ?
Accepted Answer
More Answers (1)
Greg Heath
on 5 Jun 2014
Edited: Greg Heath
on 5 Jun 2014
My previous answer is for regression and curve-fitting.
Unfortunately, I concentrated more on your given code than your written description.
You have a time-series problem and should be using the time-series function NARXNET; not the regression/fitting function FITNET.
help narxnet
doc narxnet
For MATLAB time-series example data
help nndatasets
doc nndatasets
I have posted tens of examples. Search the NEWSGROUP and ANSWERS using
greg narxnet
and
greg narxnet nncorr
For your case the output target is probably close or adjusted close. The inputs are the other tabulations. Try searching for
narxnet stock
narxnet forecasting
Hope this helps.
Thank you for formally accepting my answer
Greg
Categories
Find more on Linear Predictive Coding in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!