From 22c3f47653e4f33b3fad8640c6c7f41becf79b57 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 29 May 2024 16:54:30 +0200 Subject: [PATCH] fixed a few last issues in examples picked up by ruff --- example.py | 7 +++---- example_uncertainty.py | 6 +++--- tests/test_plot.py | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/example.py b/example.py index 6fc23fe..17cc92e 100644 --- a/example.py +++ b/example.py @@ -2,6 +2,9 @@ from sklearn.datasets import load_iris import matplotlib.pyplot as plt +from matplotlib.colors import ListedColormap +from sklearn.svm import SVC +from sklearn.ensemble import RandomForestClassifier import pandas as pd # Load iris dataset and convert to dataframe @@ -16,7 +19,6 @@ plt.show() # Key word arguments (like colormap) can be passed to the DataFrame.plot.area -from matplotlib.colors import ListedColormap colormap = ListedColormap(["red", "green", "blue"]) loreplot(data=iris_df, x="sepal width (cm)", y="species", colormap=colormap) @@ -54,9 +56,6 @@ plt.show() # Basic Lore Plot with default style but different classifier -from sklearn.svm import SVC -from sklearn.ensemble import RandomForestClassifier - fig, ax = plt.subplots(1, 2, sharex=False, sharey=True) svc = SVC(probability=True) diff --git a/example_uncertainty.py b/example_uncertainty.py index ed0dde6..4288a98 100644 --- a/example_uncertainty.py +++ b/example_uncertainty.py @@ -2,6 +2,8 @@ from sklearn.datasets import load_iris import matplotlib.pyplot as plt +from matplotlib.colors import ListedColormap +from sklearn.svm import SVC import pandas as pd # Load iris dataset and convert to dataframe @@ -27,7 +29,7 @@ plt.show() # Uncertainty plot with custom colors -from matplotlib.colors import ListedColormap + colormap = ListedColormap(["red", "green", "blue"]) uncertainty_plot( @@ -54,8 +56,6 @@ plt.show() # Uncertainty plot with a custom classifier -from sklearn.svm import SVC - svc = SVC(probability=True) uncertainty_plot( diff --git a/tests/test_plot.py b/tests/test_plot.py index 68fc6e2..bc5e30e 100644 --- a/tests/test_plot.py +++ b/tests/test_plot.py @@ -27,7 +27,7 @@ def test_loreplot_default(): # Test case for loreplot with confounder -def test_loreplot_default(): +def test_loreplot_confounder(): loreplot( df, "x", "y", confounders=[("z", 1)] ) # first test without specifying the axis