Manually reproduce results from a neural network generated from Matlab

Technical Source
2 min readJul 30, 2021

--

I’ve tried to reproduce the results I got from a trained network but was unable. Here’s my script:

load 'C:\Users\ZA\Documents\cosjacorr.mat'
inputs = cosjacorr(:, 1:9)';
targets = cosjacorr(:, 10:13)';
numHiddenNeurons = 2; % Adjust as desired
net = newpr(inputs,targets,numHiddenNeurons);
net.divideParam.trainRatio = 75/100; % Adjust as desired
net.divideParam.valRatio = 15/100; % Adjust as desired
net.divideParam.testRatio = 10/100; % Adjust as desired
net.inputs{1}.processFcns = {};
net.outputs{2}.processFcns = {};
% Train and Apply Network
[net,tr] = train(net,inputs,targets);
outputs = sim(net,inputs);
% Plotplotconfusion(targets,outputs)

I removed all pre and post processing hoping that I would be able to reproduce the results but was unsuccessful.

Here’s what I did in terms of replicating the network’s output:

y1 = tansig(net.IW{1} * input + net.b{1});      Results = tansig(net.LW{2} * y1 + net.b{2});

ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

Type “whos” to see the dimensionality of all variables and parameters.

% help newpr
% doc newpr
% Obsoleted in R2010b NNET 7.0. Last used in R2010a
close all, clear all, clc
[x t ] = simpleclass_dataset;
[ I N ] = size(x) % [ 2 1000 ]
[O N ] = size(t) % [ 4 1000]
H = 2
net = newpr(x,t,H);
net = train(net,x,t);
y = net(x);
IW = net.IW{1,1};
b1 = net.b{1};
b2 = net.b{2};
LW = net.LW{2,1};

SEE COMPLETE ANSWER CLICK THE LINK

https://www.matlabsolutions.com/resources/manually-reproduce-results-from-a-neural-network-generated-from-matlab.php

--

--

Technical Source
Technical Source

Written by Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

No responses yet