Denormalization of predicted data in neural networks
ML System Design practice on Codemia
Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.
In the context of neural networks, data normalization is a commonly used preprocessing step that aims to bring all input features onto a similar scale. This is critical to the efficient training of neural networks. However, after training and when the network is used for prediction, it is often necessary to convert these predictions back to their original scale—a process known as denormalization. Understanding denormalization is crucial when deploying models for real-world applications where the interpretability of the predicted results is necessary.
Understanding Denormalization
Denormalization is the process of reverting normalized values to their original range or distribution. In the realm of neural networks, data normalization techniques such as Min-Max Scaling, Z-Score Normalization, and others, transform input data into a specified range (often [0, 1] or with zero mean and unit variance). Denormalization reverses this transformation after the network has generated its output.
Necessity of Denormalization
- Interpretability: Predictions produced by neural networks are typically in a scaled form (e.g., within [0, 1]). These values are often not suitable for direct human interpretation or consumption.
- Accuracy in Real-world Applications: Real-world implementations often rely on the original data scale. For instance, in financial forecasting, one must convert predicted revenue back to its original dollar scale to make accurate and actionable decisions.
- Result Evaluation: Denormalization is critical for evaluating the model’s performance in terms that are meaningful within the dataset’s context, such as error metrics like Mean Absolute Error (MAE) or Root Mean Squared Error (RMSE) that are sensibly computed in the original scales.
Common Normalization Techniques and Their Denormalization
Min-Max Scaling
- Normalization Formula:
- Denormalization Formula:
Z-Score Normalization
- Normalization Formula:
- Denormalization Formula:
Example
Consider a dataset where values are scaled using Min-Max Scaling. The denormalization of a prediction can be demonstrated with the following Python code snippet:
Related reading
- ''Dense'' object has no attribute ''op''
- ''Dense'' object has no attribute ''op''
- Deploying Keras Models via Google Cloud ML
- DEPRECATION WARNING How to remove tf.keras warning calling VarianceScaling.__init__ with dtype is deprecated...
- Deprecation warnings when using internal Keras library in Tensorflow 1.15.0
- Derivative of activation function and use in backpropagation
- Derivative of sigmoid
- Description of TF Lite's Toco converter args for quantization aware training
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
ML System Design practice on Codemia
Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.