Regression neural network, manual computation

11 次查看(过去 30 天)
Hi all
I basically want to manually compute the response of a regression-based neural network.
To do so, I am using the command fitrnet, which generates a RegressionNeuralNetwork class. If I use the build in commands from maltab (i.e., predict) to calculate the response of the neural network, the response is very accurate.
Now, I want to manually calculate such a result (something like output = f(input*gain + offset)). I know that there is a normalization step automatically applied in matlab to the inputs, which uses the command mapminmax. However, I cannot find anywhere in the neural network class where the normalization limits are (i.e., the result of mapminmax). Can anyone help me with that?
This is the basic command I amusing:
regressionNeuralNetwork = fitrnet(...
trainingPredictors, ...
trainingResponse, ...
'LayerSizes', 1, ...
'Activations', 'relu', ...
'Lambda', 0, ...
'IterationLimit', 5000, ...
'Standardize', true, 'verbose', 1);
I guess that the predictors and the response are irrelevant for the question.
Thanks in advance!

采纳的回答

Sai Pavan
Sai Pavan 2023-10-13
Hi Robinson,
I understand that you are trying to access the normalization limits that are automatically generated while using the “fitrnetfunction so that you can manually get the response of the trained network on normalized test data inputs.
The normalization limits used by “mapminmax” are not directly accessible from the “RegressionNeuralNetwork” object created by the “fitrnet” function. However, you can manually calculate the normalization limits based on the input data following the below steps.
  • Before training the RegressionNeuralNetwork object, you can use the mapminmax function to normalize the input data. This function returns the normalization limits used for each input dimension.
[normalizedData, normalizationSettings] = mapminmax(trainingPredictors);
  • You can access the normalization limits for each input dimension using the normalizationSettings structure.
minLimits = normalizationSettings.xmin;
maxLimits = normalizationSettings.xmax;
  • If you want to normalize new, unseen data, you should use the same normalization limits obtained using “mapminmax, that are specific to the training data, to ensure consistency.
Please refer to the workflow mentioned in the below documentation to learn how to apply normalization manually on the test inputs using the “mapminmax” function:
Hope it helps.
Regards,
Sai Pavan

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Predictive Maintenance Toolbox 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by