How to load value from deep learning experiment to custom metric

2 ビュー (過去 30 日間)
william pan
william pan 2022 年 3 月 29 日
回答済み: Avadhoot 2023 年 9 月 27 日
I'm attending a course about machine learning and I'm new to matlab. I've been working on a regression project that need Evaluate deep learning experiment by metric funtion , however I can't load the value from Experiment to other.Is there any way to recall the value or set the default to custom metric?

回答 (1 件)

Avadhoot
Avadhoot 2023 年 9 月 27 日
Hi William,
Since you have already written the metric function you want to use, you can pass the function handle to the "metrics" option in the input arguments of the "trainingOptions" function. Here's an example of how to do it:
function metricOutput = metric1(testY, predY)
% Perform the evaluation of custom metric
% You can implement your custom function here
metricOutput = sqrt(mean((testY predY).^2));
end
While specifying the input parameters for "trainingOptions", include the following line in your code:
trainingOptions("sgdm", ...
Metrics=@metricOutput)
Make sure to specify the inputs to the metric function correctly. There should be two inputs: "Y" and "T". The contents of the inputs should be as follows:
  • "Y": Array of predictions.
  • "T": Array of target values.
Note that the prediction part should not be done inside the metric function.
For more information about custom metric functions refer to the following link:
To understand how the “Metrics” parameter is used in trainingOptions follow the link below:
I hope it helps.
Regards,
Avadhoot.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by