How do I extract a ann's resulting function?
조회 수: 3 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
답변 (1개)
TED MOSBY
2025년 6월 9일
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!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!