I want to extract a equation from neural network (in MATLAB) which is function of the weights, biases and activation function, (for example, y=ax+b). please use a simple code and explain step by step.
Reza:
Lets suppose that you want to train a NN for regression, some inputs and one target like this:
hiddenLayerSize = [6 2]; %two hidden layers with 6 and 2 hidden units
net = fitnet(hiddenLayerSize);
[net,tr] = train(net,inputs,targets);
The following code in MATLAB should print the NN configuration, weights, activation function and bias. Then you can build your equation...
clc;
fprintf('Network Configuration\n');
fprintf('Internal weights for each layer\n\n');
fprintf(':::: Input Layer/Hidden1 ::::\n');
for R=1:net.inputs{1}.size
fprintf('X%d\n',R)
for S=1:hiddenLayerSize(1)
fprintf('W(%d,%d)=%f\n',R,S,net.IW{1}(S,R));
end
fprintf('-------\n');
fprintf('Node Bias\n');
for R=1:net.layers{1}.dimensions
fprintf('b(%d)=%f\n',R,net.b{1}(R));
fprintf('Activation function: %s\n',net.layers{1}.transferFcn);
fprintf('*********************************\n');
for R=2:net.numLayers-1
fprintf(':::: Input Hidden %d ::::\n',R);
%fprintf('%d,%d\n',R,R-1);
[NODES,IN_NODES]=size(net.LW{R,R-1});
for K=1:IN_NODES
fprintf('Node %d \n',K)
for S=1:NODES
fprintf('W(%d,%d)=%f\n',K,S,net.LW{R,R-1}(S,K));
for m=1:net.layers{R}.dimensions
fprintf('b(%d)=%f\n',m,net.b{R}(m));
fprintf('Activation function: %s\n',net.layers{R}.transferFcn);
fprintf('---------------------------------\n');
fprintf(':::: Output Layer ::::\n');
R=R+1;
fprintf('Output bias\n');
fprintf('b=%f\n',net.b{net.numLayers}(1));
fprintf('Done...!\n');
Thanks for your good response.
There are good methods for modeling of water to water, Water to Air and Air to Air Heat pump, like parameter estimation and equation fit, but I couldn't find any method for modeling this Air To...
05 June 2014 8,768 4 View
If you know free software or method, share your experience.
02 March 2014 5,704 8 View
Photovoltaic Cells, solar heating, cooling and etc , in your opinion ,are they reliable especially in Autumn and Winter? Please share your experiences with this, in home or your office.
01 February 2014 2,198 14 View
There are a lot of researchers that have trouble like this. Please tell me your experiences and your efforts with this or introduce some references.
31 December 2013 1,656 62 View
I have one parameter that is dependent to other parameter (like a(T) ) the value of T in my before written m-file is obtained by solving some nonlinear equation and I cannot update value of 'a(T)"...
31 December 2013 5,466 6 View
I want to model predict output power from pv cells.
31 December 2013 2,361 12 View
We only know the entering temperature to the heat exchanger (T_in=0), it doesn't change with time, and also we have an analytical relation (see attached schematic).
11 December 2013 5,066 7 View
In computing temperature changes in wall of the borehole when i use the fast Fourier transform, values obtained from this are very large, for example they should be: 0
10 November 2013 5,580 3 View
I am reaching out to seek your valuable advice and recommendations regarding the best software tools to use for this research. Specifically, I am looking for software with a user-friendly...
22 July 2024 3,794 1 View
There exists a neural network model designed to predict a specific output, detailed in a published article. The model comprises 14 inputs, each normalized with minimum and maximum parameters...
14 July 2024 2,714 3 View
I would like to perform a literature review at this time on augmented learning and learning augmented algorithms to enhance performance-guided surgery
06 July 2024 246 1 View
Hi everyone, I've been working on differentiating human iPSCs to derive a pure and uniform culture of neural progenitor cells (NPCs). However, I'm encountering a significant issue during the...
01 July 2024 1,012 1 View
Forecasting within neural Network
24 June 2024 6,800 1 View
Please give answer. Also explain mathematical equations behind this.
22 June 2024 6,869 2 View
In CNN(convolution neural network), can the feature map obtained determinately by a random initialization convolution kernel? if not, how to decide the weights in convolution kernel to obtain the...
20 June 2024 6,418 6 View
Context In the realm of cybersecurity, Transport Layer Security (TLS) is widely used to secure communications over a computer network. Despite its robust encryption mechanisms, TLS is still...
19 June 2024 6,595 3 View
I'm trying to use reinforcement learning with live EEG measurements. However, just 2000 measurements/iterations take 16.6 minutes to measure and it seems I need at least 10 hours of live...
12 June 2024 2,884 3 View
Can SHAPELY (SHAP) values be used to explain the importance of different features being fed to a Neural Network ? I know they are used in Traditional ML on Tabular data
10 June 2024 2,054 2 View