How to save network obtained from a loop to use it for prediction?
조회 수: 8 (최근 30일)
이전 댓글 표시
Dear MATLAB users,
I trained my data in a loop (N=10), and I found that network{2} provides the best results. How do I save this specific network so that I can use it for prediction later with test data.
Thank you
댓글 수: 1
Manas
2023년 10월 4일
please refer to this MATLAB Answer: how to save and reuse a trained neural network - MATLAB Answers - MATLAB Central (mathworks.com)
답변 (1개)
VINAYAK LUHA
2024년 1월 4일
편집: VINAYAK LUHA
2024년 1월 4일
Hello Nurliana,
I understand that you're training a series of neural networks within MATLAB and you wish to preserve one particular network—namely network{2}—for subsequent predictions using test data.
Here is the step by step explanation to achieve the above objective -
1.To store network{2}, you can apply the MATLAB "save" function in the following manner:
bestNetwork = network{2};
save('DestinationFolderPath\bestNetwork.mat', 'bestNetwork');
2.To retrieve the saved network back into your workspace, use the MATLAB "load" function:
load('bestNetwork.mat', 'bestNetwork');
3. For making predictions with your test data - testX , the syntax would be
testY = bestNetwork(testX');
You can refer to the following documentation for more details about the MATLAB "save" and "load" functions-
- https://www.mathworks.com/help/matlab/ref/save.html
- https://www.mathworks.com/help/matlab/ref/load.html
Hope this helps you to understand how to save and reuse trained neural network in MATLAB.
Regards,
Vinayak Luha
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!