neural network problem in newff

2 views (last 30 days)
Dhandapani.S
Dhandapani.S on 28 Jan 2015
Answered: Greg Heath on 28 Jan 2015
eror shown was Error using newff (line 107) Input ranges is not a two column matrix. Error in concir1 (line 25) net=newff(input_n,target_n,12); >> wedinput.dat data has 24 * 98 and wedtarget.dat data has 24*1 double . matllab versionis 8.0.0.783 R2012B.
matlab version 10a gives the output for my collegaue. please help me in this regard.

Accepted Answer

Greg Heath
Greg Heath on 28 Jan 2015
close all ; clc; clf; clear all;
% Load the Closing stock index Data
load wedinput.dat; load wedtarget.dat;
% Input and Target Data
input1=wedinput(1:24,1:198); target1=wedtarget(1:24,1);
1. INCORRECT. INPUT AND TARGETS SHOULD HAVE THE SAME NUMBER OF COLUMNS.
2. INPUT DIMENSIONALITY REDUCTION RECOMMENDED
% Preprocessing the input and target data % y = (ymax-ymin)*(x-xmin)/(xmax-xmin) + ymin;[input_n,input_n_struct]=mapminmax(input1'); [target_n,target_n_struct]=mapminmax(target1');
3. INEFFICIENT. TRY MAPSTD ON INPUT WITH TANSIG HIDDEN NODES. REMOVE OR MODIFY OUTLIERS BEFORE TRAINING. IF NOT CLASSIFIER, USE MAPSTD ON OUTPUT ALSO.
P.S. EASIER TO USE ZSCORE
HELP ZSCORE
DOC ZSCORE
disp('Input versus target After Preprocessing this data used for NN training');
4. PLOT 198 INPUTS ?
%[input_n target_n]; % Stote MSE,RMSE,MAE,MAPE and THEIL'U value of Train/Val/T
5. SPELLING
net=newff(input_n,target_n,12);
6. minmax(input_n) FOR YOUR OBSOLETE VERSION?
7. WHY H = 12?
%training the network net. %net.trainParam.epochs=1 net.divideFcn='divideblock';
net.divideParam.trainRatio=80; net.divideParam.valRatio=10; net.divideParam.testRatio=10;
8. Divide above by 100. BUT WHY NOT ACCEPT DEFAULTS?
net.trainFcn='trainlm';
9. DELETE ABOVE. IS A DEFAULT.
[net tr Y E]=train(net,input_n,target_n);
10. NMSE = mse(E)/mean(var(target_n',1)
11. R2 = 1-NMSE
12. USE tr TO OBTAIN VALUES FOR TRN/VAL/TST
% Simulation disp('Simulation Output for the given input'); simoutput=sim(net,input_n);
13. REDUNDANT simoutput = Y
[input_n ; simoutput];
14. DELETE ABOVE LINE. USELESS FOR N = 198
15. I'M STOPPING HERE.
%Output Normalized Version
disp('Normalized Simulation Output'); Norm_input=mapminmax('reverse',input_n,input_n_struct); Norm_simoutput=mapminmax('reverse',simoutput',target_n_struct);
%[Norm_input Norm_simoutput]; [Norm_input]; [Norm_simoutput] [target1 Norm_simoutput]
% Calculating Mean Square Error
perfmse=mse(E); fprintf('Mean Square Error:%d \n',perfmse);

More Answers (0)

Community Treasure Hunt

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

Start Hunting!