How to use TANSIG function for validation of data...???

I have used Neural Network for validation of data. And now I want to cross check NN simulated results with TANSIG simulated output, but I am not able to get the proper results. Here I am show you my both the *.m files for NN and TANSIG. Please help me to get out of it.
%NN*.m clc; clear all; lam = 10;
INPUT = load('Rrs_Zsd_400_700_10nm_Input.dat'); for i =1:31 INPUT(:,i) = INPUT(:,i)./INPUT(:,lam); end; inputs = INPUT';
TARGET = load('Zsd_Target.dat'); targets = TARGET';
VALIDATE = load('Rrs_Zsd_validate.dat'); for i =1:31 VALIDATE(:,i) = VALIDATE(:,i)./VALIDATE(:,lam); end; validates = VALIDATE';
% Create a Fitting Network hiddenLayerSize = 1; net = fitnet(hiddenLayerSize);
% Choose Input and Output Pre/Post-Processing Functions % For a list of all processing functions type: help nnprocess net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'}; net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};
net.trainParam.show = 50; % The result is shown at every 50th iteration (epoch) net.trainParam.lr = 0.05; % Learning rate used in some gradient schemes net.trainParam.epochs =1000; % Max number of iterations net.trainParam.goal = 1e-7; % Error tolerance; stopping criterion
% For help on training function 'trainlm' type: help trainlm % For a list of all training functions type: help nntrain net.trainFcn = 'trainlm'; % Levenberg-Marquardt
% Choose a Performance Function % For a list of all performance functions type: help nnperformance net.performFcn = 'mse'; % Mean squared error
% To remove Pre/Post-Processing Functions used by MATLAB net.inputs{1}.processFcns = {}; net.outputs{2}.processFcns = {};
% Train the Network [net,tr] = train(net,inputs,targets);
performance = 0.0; % Test the Network outputs = net(inputs); errors = gsubtract(targets,outputs); performance = perform(net,targets,outputs); %results = sim(net, inputs); RESULT = sim(net,validates);
view(net);
========================== % TANSIG.m for validation clc; clear all;
VALIDATE = load('Rrs_Zsd_validate.dat'); for i =1:31 VALIDATE(:,i) = VALIDATE(:,i)./VALIDATE(:,10); end; validates = VALIDATE';
VAL = load('D:\Paper\Zsd\DATA\Zsd_all\TAN\Zsd_WeightIP_NN_Norm_490.dat'); w1 = VAL';
BS = load('D:\Paper\Zsd\DATA\Zsd_all\TAN\Zsd_Bias_IPOP_NN_Norm_490.dat'); bs = BS'; bs1 = bs(1,:); bs2 = bs(2,:);
VALD = load('D:\Paper\Zsd\DATA\Zsd_all\TAN\Zsd_Weightotput_NN_Norm_490.dat'); w2 = VALD';
valid = validates;
% Dmin = min(valid) % Dmax = max(valid) % Rmax = 1.0; % Rmin = -1.0;
%valid = (valid*((Rmax-Rmin)/(Dmax-Dmin)))+(((Rmin*Dmax)-(Rmax*Dmin))/(Dmax - Dmin)) %valid = premnmx(valid)
for k=1:9
Y1 = (TOTAL(w1(:) * valid(k,:)) + bs1)
Y2 = 2./(1+exp(-2*Y1))-1;
in = (TOTAL(w2(:,1) * Y2) + bs2);
Yo = 2./(1+exp(-2*in))-1;
%Yo
%Zsd = (Yo*((Dmax-Dmin)/(Rmax-RMin)))+(((Dmin*Rmax)-(Dmax*Rmin))/(Rmax - Rmin))
end %Zsd = postmnmx(Yo) %dYo_dvalid = tansig(valid,Yo)

1 Comment

1. Please format
2. Do not use the same variable name on both sides of an equation (e.g., z = a*z' + b)
3. tansig is the name of a MATLAB function. Do not use it in any other way.

Sign in to comment.

Answers (0)

Categories

Find more on Sparse Matrices in Help Center and File Exchange

Asked:

on 11 Jun 2013

Community Treasure Hunt

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

Start Hunting!