Regression neural network, manual computation

2 visualizaciones (últimos 30 días)
robinson medina
robinson medina el 8 de Abr. de 2022
Comentada: robinson medina el 16 de Oct. de 2023
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!

Respuesta aceptada

Sai Pavan
Sai Pavan el 13 de Oct. de 2023
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

Más respuestas (0)

Categorías

Más información sobre Predictive Maintenance Toolbox en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by