How to load value from deep learning experiment to custom metric

2 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by