Having issues going from trainNetwork to trainnet

59 ビュー (過去 30 日間)
psousa
psousa 2024 年 11 月 19 日 19:31
編集済み: Cris LaPierre 2024 年 11 月 20 日 16:44
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 training stops earlier.
Both codes end with
Training stopped: Met validation criterion
What am I getting wrong?
  1 件のコメント
Cris LaPierre
Cris LaPierre 2024 年 11 月 20 日 16:44
編集済み: Cris LaPierre 2024 年 11 月 20 日 16:44
You have changed the question. It is better to ask a new question.

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

回答 (1 件)

Cris LaPierre
Cris LaPierre 2024 年 11 月 19 日 22:29
編集済み: Cris LaPierre 2024 年 11 月 19 日 23:23
You have a vector sequence, so your layout should be s-by-c matrices, where s and c are the numbers of time steps and channels (features) of the sequences, respectively.
Withouth knowing more about your data, it looks like you have a vector sequence containing 1028 timesteps and 4 channels. You should therefore use the same code for creating XTrain, XValidation, TTrain, and TValidation as in your trainNetwork example. See here.
% Predictor values
XTrain = (XStandardized(1:numTimeStepsTrain,:));
XValidation = XStandardized(end-numTimeStepsTest+1:end,:);
% Target values
TTrain = (TStandardized(1:numTimeStepsTrain,:));
TValidation = TStandardized(end-numTimeStepsTest+1:end,:);
  3 件のコメント
Cris LaPierre
Cris LaPierre 2024 年 11 月 19 日 23:30
編集済み: Cris LaPierre 2024 年 11 月 19 日 23:30
I'd remove this unnecessary code in your trainnet example:
% Predictor values
XTrain = XTrain;
XValidation = XValidation;
% Target values
TTrain = TTrain;
TValidation = TValidation;
psousa
psousa 2024 年 11 月 20 日 1:46
I left that there so that codes are very similar when comparing side-by-side.
Did you run both codes and see the differences in results?
Thank you for your answers!

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

カテゴリ

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