Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions docs/source/examples/tnad_latent/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def plot_losses_per_initializer(
# Plot for each bond dimension
for j, bond in enumerate(bond_dims):
# Create color spectrum for this bond dimension
cmap = plt.cm.get_cmap(color_maps[j % len(color_maps)])
cmap = plt.get_cmap(color_maps[j % len(color_maps)])

# Process each run
for run in range(1, nruns + 1):
Expand Down Expand Up @@ -443,7 +443,7 @@ def compare_anomaly_scores_per_embedding(

# Create a color dictionary with brighter colors (using 0.8 instead of 0.6)
bond_colors = {
bond: plt.cm.get_cmap(color_maps[i % len(color_maps)])(0.8)
bond: plt.get_cmap(color_maps[i % len(color_maps)])(0.8)
for i, bond in enumerate(bond_dims)
}

Expand Down Expand Up @@ -671,7 +671,7 @@ def compare_ROCs_per_bond( # noqa: N802

# Create a color dictionary with brighter colors for consistent coloring
bond_colors = {
bond: plt.cm.get_cmap(color_maps[i % len(color_maps)])(0.8)
bond: plt.get_cmap(color_maps[i % len(color_maps)])(0.8)
for i, bond in enumerate(bond_dim)
}

Expand Down Expand Up @@ -997,9 +997,7 @@ def compare_ROC_by_latent( # noqa: N802

if len(latent_spaces) > len(palette):
# Generate more colors if needed
from matplotlib.cm import get_cmap

cmap = get_cmap("tab10")
cmap = plt.get_cmap("tab10")
palette = [cmap(i) for i in np.linspace(0, 1, len(latent_spaces))]

fig, ax = plt.subplots(figsize=(7, 7))
Expand Down
4 changes: 2 additions & 2 deletions docs/source/examples/unsupervised/mnist_ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ def loss_combined(model, data, y_true=None, embedding=None): # noqa: D103
plt.figure(figsize=(8, 7))
plt.plot(fpr, tpr, label=f"AUC = {auc_value:0.3f}", color="darkblue")
plt.plot([0, 1], [0, 1], "k--") # Random guess line
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.05])
plt.xlim(0.0, 1.0)
plt.ylim(0.0, 1.05)
plt.xlabel("False Positive Rate")
plt.ylabel("True Positive Rate")
plt.title("ROC curve")
Expand Down
12 changes: 6 additions & 6 deletions tn4ml/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ def plot_ROC_curve_from_metrics( # noqa: N802
plt.figure(figsize=(8, 6))
plt.plot(fpr, tpr, color="blue", lw=2, label=f"ROC Curve (AUC = {auc_value:.2f})")
plt.plot([0, 1], [0, 1], color="red", linestyle="--", label="Random Guess")
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.05])
plt.xlim(0.0, 1.0)
plt.ylim(0.0, 1.05)
plt.xlabel("False Positive Rate")
plt.ylabel("True Positive Rate")
plt.title(title)
Expand Down Expand Up @@ -317,8 +317,8 @@ def plot_ROC_curve_from_data( # noqa: N802
plt.figure(figsize=(8, 6))
plt.plot(fpr, tpr, color="blue", lw=2, label=f"ROC Curve (AUC = {auc_value:.2f})")
plt.plot([0, 1], [0, 1], color="red", linestyle="--", label="Random Guess")
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.05])
plt.xlim(0.0, 1.0)
plt.ylim(0.0, 1.05)
plt.xlabel("False Positive Rate")
plt.ylabel("True Positive Rate")
plt.title(title)
Expand Down Expand Up @@ -370,8 +370,8 @@ def plot_PR_curve( # noqa: N802
plt.figure(figsize=(8, 6))
plt.plot(recall, precision, color="blue", lw=2, label=label)
plt.plot([0, 1], [0, 1], color="red", linestyle="--", label="Random Guess")
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.05])
plt.xlim(0.0, 1.0)
plt.ylim(0.0, 1.05)
plt.xlabel("False Positive Rate")
plt.ylabel("True Positive Rate")
plt.title(title)
Expand Down
Loading