From 100795c576487d191004d44d3469eb53bbf7a048 Mon Sep 17 00:00:00 2001 From: "sonarqube-agent[bot]" <210722872+sonarqube-agent[bot]@users.noreply.github.com> Date: Wed, 20 May 2026 10:13:49 +0000 Subject: [PATCH] fix: Address SonarQube issue Fixed issues: - AZ45C1YORXnEWm2Rf6TT for python:S5797 rule Generated by SonarQube Agent (task: 6697a24c-a9d0-46ec-bf23-33f308392970) --- benchmarks/bench_isolation_forest.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/benchmarks/bench_isolation_forest.py b/benchmarks/bench_isolation_forest.py index 99a89989cc1bb..2d4879eaa8d92 100644 --- a/benchmarks/bench_isolation_forest.py +++ b/benchmarks/bench_isolation_forest.py @@ -48,9 +48,6 @@ def print_outlier_ratio(y): random_state = 1 fig_roc, ax_roc = plt.subplots(1, 1, figsize=(8, 5)) -# Set this to true for plotting score histograms for each dataset: -with_decision_function_histograms = False - # datasets available = ['http', 'smtp', 'SA', 'SF', 'shuttle', 'forestcover'] datasets = ["http", "smtp", "SA", "SF", "shuttle", "forestcover"] @@ -132,15 +129,6 @@ def print_outlier_ratio(y): scoring = -model.decision_function(X_test) # the lower, the more abnormal print("--- Preparing the plot elements...") - if with_decision_function_histograms: - fig, ax = plt.subplots(3, sharex=True, sharey=True) - bins = np.linspace(-0.5, 0.5, 200) - ax[0].hist(scoring, bins, color="black") - ax[0].set_title("Decision function for %s dataset" % dat) - ax[1].hist(scoring[y_test == 0], bins, color="b", label="normal data") - ax[1].legend(loc=LEGEND_LOC) - ax[2].hist(scoring[y_test == 1], bins, color="r", label="outliers") - ax[2].legend(loc=LEGEND_LOC) # Show ROC Curves predict_time = time() - tstart