Going from trainNetwork to trainnet

49 ビュー (過去 30 日間)
psousa
psousa 2024 年 11 月 21 日
コメント済み: psousa 2025 年 1 月 28 日 13:50
I've attached 3 files(see post below for latest version of these files):
  • trainNetworkEXAMPLE - my original trainNetwork implementation
  • trainnetEXAMPLE - the trainnet implementation
  • example.csv - data file with predictors and targets
The codes for the two examples are identical, the difference is only in the formatting of the input matrices.
trainNetworkEXAMPLE works as expected.
trainnetEXAMPLE works but convergence of the solver is different and solution is poor.
Both codes end with:
Training stopped: Met validation criterion
What am I getting wrong?
  2 件のコメント
Matt J
Matt J 2024 年 11 月 21 日
Seemingly nothing. Why do you think something is wrong?
psousa
psousa 2024 年 11 月 21 日
NMSE for training set and test set are considerably worse for version using trainnet.

サインインしてコメントする。

採用された回答

Sourabh
Sourabh 2025 年 1 月 28 日 9:05
編集済み: Sourabh 2025 年 1 月 28 日 9:06
I too encountered the similar issue when using “trainnet” and “trainNetwork” method.
The workaround that worked in my case was to:
  1. Use @mse as the loss function instead of "mse" in “trainnet”.
[net,info] = trainnet(XTrain,TTrain,layers,@mse,options);
2. Set 'GradientThreshold' to ‘Inf’ in ‘trainingOptions’ of both the programs.
options = trainingOptions('adam',
...
'GradientThreshold',Inf,
...
);
Kindly refer to the below image:
  1 件のコメント
psousa
psousa 2025 年 1 月 28 日 13:50
Matlab support got back to me within a couple weeks and that was the solution they offered.
Thanks for looking into it.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

タグ

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by