From 4558bbffe16df407ed8798be013546c040f9d834 Mon Sep 17 00:00:00 2001
From: BrianShen <96436972+brianshen3@users.noreply.github.com>
Date: Tue, 3 Dec 2024 15:02:44 -0500
Subject: [PATCH] created steps to generate confusion matrix, fixed tree struc
(#729)
* created steps to generate confusion matrix, fixed tree struc
* Updated to info and updated contact phrase
---
.../images/metrics-confusion-matrix-steps.gif | 3 ++
docs/metrics/confusion-matrix.md | 32 +++++++++++++------
2 files changed, 26 insertions(+), 9 deletions(-)
create mode 100644 docs/assets/images/metrics-confusion-matrix-steps.gif
diff --git a/docs/assets/images/metrics-confusion-matrix-steps.gif b/docs/assets/images/metrics-confusion-matrix-steps.gif
new file mode 100644
index 000000000..7599e6b79
--- /dev/null
+++ b/docs/assets/images/metrics-confusion-matrix-steps.gif
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7142ab8044ae3a180573b6ce643e2fe5b45b92c2c4242a1e062de86a1615e328
+size 1776414
diff --git a/docs/metrics/confusion-matrix.md b/docs/metrics/confusion-matrix.md
index 4845a8a0e..f6ee4a19d 100644
--- a/docs/metrics/confusion-matrix.md
+++ b/docs/metrics/confusion-matrix.md
@@ -23,10 +23,6 @@ Confusion matrices are used in classification workflows with only one class or w
object detection workflows, too. They help evaluate models by counting classification errors and visualizing class
imbalances.
-
-- :kolena-manual-16: API Reference: [`ConfusionMatrix` ↗][kolena.workflow.plot.ConfusionMatrix]
-
-
!!!example
To see an example of confusion matrix, checkout the
[CIFAR-10 on app.kolena.com/try.](https://app.kolena.io/try/dataset/debugger?datasetId=20&aggregations=N4IgNghgRgpmIC4QEEDGqCuAnCqCeIANCAM4D22qMiIWMJGYALkSBAObt3sRNlaJQHLjB58BSXJhz5WEAG4wc7AJYA7dgFkYTABZkAJjQC2uLGRABfYgAcIOYyUEguFNQYAqWDHoBiKuCMkVwx3AH0mbz0AOkhYeGJ1ADMlGDUqf0CaVEgSEhUklVReFTI1WOg4Vj06En0wILVGMET0sAwDGDCID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8QA&models=N4IglgJiBcDMA0IDGB7AdgMzAcwK4CcBDAFzHRlEhgFYBfWoA&plots=N4IgHiBcoM4PYFcBOBjAplES0wQGwBcQAaEAazQE9MU8BDGGASwDMmU6Cm4A7AOnoAjNHhIghIzNlyE%2BtBszYcuvAXWGjSAEyYx1eNFqgs6eGGgC%2BpatBDxk6TFs50ADnCY8ipCjZABzJEQeLQB9AiQEAgALNQ0xCVFIEGcCNw8vPkDgsIio2MSxHT1BAyNIEzNLCyA)
@@ -35,7 +31,25 @@ imbalances.
The implementation of a confusion matrix depends on whether the workflow concerns one or more classes.
-### Single-Class
+!!!info
+ The Confusion Matrix feature in Kolena supports visualizing comparisons
+ between a single predicted value and a single ground truth value. If you're
+ having trouble generating or customizing plots for these visualizations,
+ feel free to reach out to the Kolena team for support.
+
+![Steps To Generate Plot](../assets/images/metrics-confusion-matrix-steps.gif)
+
+**Steps to Generate a Custom Confusion Matrix Plot**:
+
+1. Go to the Debugger page.
+
+2. Add model results with predicted values.
+
+3. Scroll down to Custom Plots.
+
+4. Select the predicted results for the X-Axis and the ground truth for the Y-Axis.
+
+## Single-Class
Single-class confusion matrices are used for binary classification problems. After computing the number of TPs, FPs,
FNs, and TNs, a confusion matrix would look like this:
@@ -49,7 +63,7 @@ FNs, and TNs, a confusion matrix would look like this:
-#### Example: Single-Class
+### Example: Single-Class
Let's consider a simple binary classification example and plot a confusion matrix. The table below shows five samples'
(three positive and two negative) ground truth labels and inference labels.
@@ -74,7 +88,7 @@ A confusion matrix for this example can be plotted:
-### Multiclass
+## Multiclass
Multiclass confusion matrices, used for multiclass classification problems, outline counts of TPs, FPs, FNs, and TNs for
every unique pair of actual and predicted labels. A multiclass classification confusion matrix with three classes
@@ -94,7 +108,7 @@ And for example, if we are trying to calculate the counts of TP, FP, FN, and TN
| **Actual `Boat`** | False Negative | True Positive | False Negative |
| **Actual `Car`** | True Negative | False Positive | True Negative |
-**Example: Multiclass**
+### Example: Multiclass
Let's take a look at a multiclass classification example and plot a confusion matrix. In this example, we have three
classes: `Airplane`, `Boat`, and `Car`. The multiclass classifier outputs the following inferences:
@@ -140,7 +154,7 @@ it is incorrect, it has labeled the `Airplane` as a `Boat` or a `Car`.
Whenever there is an actual `Airplane` class, the model never predicts that there is a different transportation object.
-### Normalization
+## Normalization
Sometimes it is easier to focus on **class-level behavior** if you are using a normalized confusion matrix. If confusion
matrices are color-coded, normalizing can also create a better visual representation: