Confusion Matrix with Normalization

Core Metrics DS practice problem on Onlearn.

Difficulty: medium.

Topics: Confusion Matrix with Normalization, Confusion Matrix, Row-wise Normalization, True Positive Rate, Class Imbalance, Heatmap Visualization, Model Evaluation, Statistical Inference, Data Preprocessing, Supervised Learning, Information Theory, Classification Metrics, Error Analysis, Probability Distributions, Feature Scaling, Performance Visualization.

Implement a function to compute a confusion matrix for multi class classification with optional normalization. The function should support three normalization modes: by true labels (row wise), by predicted labels (column wise), and by all samples (global). When normalization is enabled, round the outputs to a configurable number of decimal places.