How to load value from deep learning experiment to custom metric

2 vues (au cours des 30 derniers jours)
william pan
william pan le 29 Mar 2022
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?

Réponses (1)

Avadhoot
Avadhoot le 27 Sep 2023
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.

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by