Prediction of the Sinus Function using Neural Networks
조회 수: 16 (최근 30일)
이전 댓글 표시
My objective is to create a NN that is able to predict the sinus function. For that I tried using several types of networks, including feed-forward using the Fit Tool and NARX net using the time series tool.
The sinus has a period of 365.
Using Fiting Tool(default configurations except i give it 5 neurons)
%The input I give for training is:
input = linspace(1,270,100); % I used several variations of this
target = sin(2*pi*input/365);
%Results: Samples MSE R
%Training: 70 7.23e-7 9.9999e-1
%Validation: 15 6.84e-7 9.9999e-1
%Testing: 15 3.171e-6 9.99993e-1
Which I think look pretty good.
In the next step I try to predict the remaining function using the following sample:
pred_inp=linspace(271,365,100);
pred_targ= sin(2*pi*pred_inp/365);
% Results: Samples MSE R
% 100 1.33175e-0 -3.6286e-1
%And this is where it gets crazy, sometimes it gives a good prediction,
%other times it just goes down.
%It gets even worse if I try to predict for more than one period:
pred_inp=linspace(271,730,100);
I have no idea of what is going wrong. Anyone here could assist me? Or showing me another way to do this?
댓글 수: 0
채택된 답변
Greg Heath
2013년 5월 16일
The rule of thumb for predicting a sinusoid function is (I think) that you have to train on at least 1.5 periods with at least 8 points per period. If this turns out to be wrong, try training on 2 periods with 20 points per period. Then back off.
Hope this helps.
Greg
댓글 수: 0
추가 답변 (1개)
Pedro
2013년 5월 16일
편집: Pedro
2013년 5월 16일
댓글 수: 4
Greg Heath
2016년 3월 25일
1. There was no attempt to find the significant auto and cross correlation lags.
2. With smooth curves the minimum number of hidden nodes is equal to the number of local extrema
Hope this helps
Greg
참고 항목
카테고리
Help Center 및 File Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!