Neural Network for Currency Forecast - How do I stop it from repeatedly training after I am happy with my NN performance?

1 visualización (últimos 30 días)
I have read a few papers on using a Neural Network to forecast a few periods ahead the price or trend in a Currency pair. I have subsequently designed a simple Neural Network function using NARX. I am passing through a number of times series for different currency pairs and storing the resultatn forecasts. With the code (below), each NN is trained for each currency pair. I would actually prefer to store the NN with optimal performance for each pair. How might I do this? How can I deploy, or keep the optimal NN for each currency pair. That is, I do not want to keep re training each NN for each currency pair time series. Surely I cannot merely comment out this part of the code?
[ neto, tro, Yo, Eo, Xof, Aof ] = train( neto, Xo, To, Xoi, Aoi );
function [ Yo ] = GregNARXf( X,T ) %GREGNARXF Summary of this function goes here
% Subscript "o" for "o"pen loop % Subscript "c" for "c"losed loop % close all, clear all, clc % [ X, T ] = simplenarx_dataset; N = length(T) neto = narxnet; [ Xo, Xoi, Aoi, To ] = preparets( neto, X, {}, T ); to = cell2mat( To ); MSE00o = mean(var(to',1)) % Normalization Reference rng('default') % Added for reproducibility [ neto, tro, Yo, Eo, Xof, Aof ] = train( neto, Xo, To, Xoi, Aoi ); % [ Yo Xof Aof ] = net(Xo,Xoi,Aoi); Eo = gsubtract(To,Yo); NMSEo = mse(Eo)/MSE00o R2o = 1 - NMSEo yo = cell2mat(Yo); figure(1), hold on plot( 3:N, to, 'LineWidth', 2) plot( 3:N, yo, 'ro', 'LineWidth', 2) legend( ' TARGET ', ' OUTPUT ' ) title( ' NARXNET EXAMPLE ' )
TrendYo =cell2mat(Yo(end-10:end));
end

Respuesta aceptada

Greg Heath
Greg Heath el 19 de Ag. de 2017
Editada: Greg Heath el 19 de Ag. de 2017
{1. The code you have posted is the open loop (OL) solution.
2. It is not a deployable network because it uses the desired
target to generate the output. This is just a step in designing
a deployable network to yield an output that sufficiently
approximates the target when it is deployed with the actual
output being fed back to the input (instead of the desired target).
This is the closed Loop (CL) solution.
3. Accordingly, after you have an acceptable OL solution, you
must close the loop to obtain a deployable network.
4. However, the difference between the desired target and the
actual output often causes the CL solution to have larger than
acceptable errors.
5. Then there are several options
a. Train the newly closed loop net
b. Continue training the OL net
c. Start over with different initial random weights.
d. Start anew with a CL net.
6. There are several MATLAB examples for which I have not been able
to obtain acceptable CL solutions. }
(I haven't given up, just need a summer break (;>) )
Hope this helps.
Thank you for formally accepting my answer
Greg

Más respuestas (0)

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by