How do I extract a ann's resulting function?

3 visualizaciones (últimos 30 días)
Artur Boschi
Artur Boschi el 13 de Jul. de 2011
Respondida: TED MOSBY el 9 de Jun. de 2025
Hi. I have an ANN with 4 inputs, 10 neurons and 1 output. It's already trained and I would like to "extract" the resulting function. I don't want to use the command sim every time I need the results that the net would give me. Is there a way to do that?
Thanks!

Respuestas (1)

TED MOSBY
TED MOSBY el 9 de Jun. de 2025
Hi,
The Neural Network Toolbox includes "genFunction", which spits out an M-file you can call just like any other function:
% Suppose your trained network is called 'net' in your workspace:
genFunction(net, 'myNetFcn');
% This creates myNetFcn.m, containing something like:
% function y = myNetFcn(x)
% % AUTOGENERATED by Neural Network Toolbox
% .......
Then you can simple do:
y = myNetFcn(x); % x is your 4×N input matrix, y is 1×N output
Here is the documentation on "genfunction":
Hope this helps!

Categorías

Más información sobre Deep Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by