How to fix mircrosoft fabrics not displaying all values for the confusion matrix

Daniel Tobi 0 Reputation points
2024-12-03T08:29:54.2866667+00:00
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
def plot(cm):
    """
    Plot the confusion matrix with adjusted annotations.
    """
    sns.set(rc={"figure.figsize": (6, 4)})  # Adjusted figure size for clarity
    ax = sns.heatmap(cm, annot=True, fmt='g', cmap="Blues", cbar=True, annot_kws={"size": 14})
    ax.set_title("Confusion Matrix")
    ax.set_xlabel("Predicted label")
    ax.set_ylabel("True label")
    
    # Explicitly set the axis limits to avoid any cutoffs
    ax.set_ylim(len(cm), 0)
    
    plt.show()
# Test with a simpler example (use integer values)
cm = np.array([[42586, 63], [54, 19]], dtype=int)  # Converted floating-point to integers for clarity
plot(cm)

I'm new to using Microsoft Fabric enviroment. However, I'm facing an issues with the FN and FP values not showing in the plot.
cc_image2

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
40,162 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.