Neural Network Symbolic expression
Given a neural network object, this function returns the closed, symbolic, expression implemented by the network (as a string).
This allows you to use a neural network model without relying on the neural network toolbox.
Note I only implemented for feed forward nets (MLPs) and not all possible transfer functions are supported. However, it should be very straightforward to do this.
Example:
>> net = newff([-1 1; -1 1],[3 1]);
>> getNeuralNetExpression(net)
ans =
(2/(1+exp(-2*((2/(1+exp(-2*(x1*1.728941e+00 + x2*1.700224e+00 + -2.424871e+00)))-1)*-9.045580e-01 + (2/(1+exp(-2*(x1*-2.422662e+00 + x2*-1.034790e-01 + 000000)))-1)*-1.976229e-01 + (2/(1+exp(-2*(x1*2.044171e+00 + x2*1.304364e+00 + 2.424871e+00)))-1)*1.050105e+00 + 000000)))-1)
>>
This function originates from the Surrogate Modeling (SUMO) Toolbox : http://www.sumo.intec.ugent.be
Cite As
Dirk Gorissen (2024). Neural Network Symbolic expression (https://www.mathworks.com/matlabcentral/fileexchange/19176-neural-network-symbolic-expression), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- Mathematics and Optimization > Symbolic Math Toolbox >
- AI, Data Science, and Statistics > Deep Learning Toolbox > Function Approximation, Clustering, and Control > Function Approximation and Clustering >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.