How do I extract a ann's resulting function?

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!

回答 (1 件)

TED MOSBY
TED MOSBY 2025 年 6 月 9 日

0 投票

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!

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

質問済み:

2011 年 7 月 13 日

回答済み:

2025 年 6 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by