Icon

20210501 Pikairos How I can de-normalize a predictive value generated using the NN

Normalization before and after Regression based on iris dataset with a KERAS ANN 4-3-1

The goal of this workflow is to show how to apply normalization & denormalization of target and predicted variables before and after the regresion prediction using KERAS NN nodes (Mulltilayer Perceptron with 4-8-3 layers, using BackPropagation).

This is a only a minimalist workflow which can be used as example and reference for doing the same (Normalization & Denormalisation) on more complicated regression problems in general.





Training thenetwork100 epochsBatch size 5Adam optimizerapply trained network75% for training 25 % for testinghidden layer8 unitsReLUoutput layer1 unitSoftmaxreading the iris datasetin view to predictingPetal Lengthbased o the other flower measuresNormalizeTraining SetInput columnsto [0,1]input layer 3 unitsApplysame normalizationto Test SetInput ColumnsNumerical Scorerdirectly on normalized variables(target Petal Lengthandpredicted Petal Length)Now you candenormalize ;-)Keep onlythe NN predictionwhich needs to bedenormalizedif compared to the originalPetal Length valuesRenameprediction to petal length:This is the only wayto denormalizethe predicted petal lengthrename predicted columnto petal length (Prediction)Keep onlythe column to predictpetal lengthNumerical Scorerafter denormalized variables(target Petal Lengthandpredicted Petal Length)Append the originalpetal length columnto the denormalizedNN predicted petal lengthto later plotting & scoringPlease be aware thatappart R^2 which implicitlynormalizes the variables,Numeric Scorer resultsare not necessarily the samewith and without normalization(Just in case you wonderwhy they are different :)Scatter Plot onNormalized petal length(Target and Predicted)Scatter Plot onDenormalized petal length(Target and Predicted)Keep onlyNormalized petal length(Target and Predicted)Keep onlyNN prediction andthe normalized petal lengthfor plotting and scoringKeep onlyNormalized petal length(Target and Predicted)Show differenceson Numeric Scorer resultswith and without NormalizationKeras NetworkLearner Keras NetworkExecutor Partitioning Keras Dense Layer Keras Dense Layer Table Reader Normalizer Keras Input Layer Normalizer (Apply) Numeric Scorer Denormalizer Column Filter Column Rename Column Rename Column Filter Numeric Scorer Column Appender Column Appender Scatter Plot(local) Scatter Plot(local) Column Filter Column Rename Column Filter InteractiveTable (local) Training thenetwork100 epochsBatch size 5Adam optimizerapply trained network75% for training 25 % for testinghidden layer8 unitsReLUoutput layer1 unitSoftmaxreading the iris datasetin view to predictingPetal Lengthbased o the other flower measuresNormalizeTraining SetInput columnsto [0,1]input layer 3 unitsApplysame normalizationto Test SetInput ColumnsNumerical Scorerdirectly on normalized variables(target Petal Lengthandpredicted Petal Length)Now you candenormalize ;-)Keep onlythe NN predictionwhich needs to bedenormalizedif compared to the originalPetal Length valuesRenameprediction to petal length:This is the only wayto denormalizethe predicted petal lengthrename predicted columnto petal length (Prediction)Keep onlythe column to predictpetal lengthNumerical Scorerafter denormalized variables(target Petal Lengthandpredicted Petal Length)Append the originalpetal length columnto the denormalizedNN predicted petal lengthto later plotting & scoringPlease be aware thatappart R^2 which implicitlynormalizes the variables,Numeric Scorer resultsare not necessarily the samewith and without normalization(Just in case you wonderwhy they are different :)Scatter Plot onNormalized petal length(Target and Predicted)Scatter Plot onDenormalized petal length(Target and Predicted)Keep onlyNormalized petal length(Target and Predicted)Keep onlyNN prediction andthe normalized petal lengthfor plotting and scoringKeep onlyNormalized petal length(Target and Predicted)Show differenceson Numeric Scorer resultswith and without NormalizationKeras NetworkLearner Keras NetworkExecutor Partitioning Keras Dense Layer Keras Dense Layer Table Reader Normalizer Keras Input Layer Normalizer (Apply) Numeric Scorer Denormalizer Column Filter Column Rename Column Rename Column Filter Numeric Scorer Column Appender Column Appender Scatter Plot(local) Scatter Plot(local) Column Filter Column Rename Column Filter InteractiveTable (local)

Nodes

Extensions

Links