From 4ea5bba9a1bffff5beb9f71435ba863d310fd230 Mon Sep 17 00:00:00 2001 From: mkalimeri <77448283+mkalimeri@users.noreply.github.com> Date: Tue, 10 Dec 2024 10:18:17 +0100 Subject: [PATCH] Update gmm_outlier_detector.py Applied changes from review --- sklego/mixture/gmm_outlier_detector.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/sklego/mixture/gmm_outlier_detector.py b/sklego/mixture/gmm_outlier_detector.py index 45e8d57f..62ff7f8b 100644 --- a/sklego/mixture/gmm_outlier_detector.py +++ b/sklego/mixture/gmm_outlier_detector.py @@ -44,7 +44,6 @@ class GMMOutlierDetector(OutlierMixin, BaseEstimator): ```python import numpy as np - import matplotlib.pyplot as plt from sklego.mixture import GMMOutlierDetector # Generate datset, it consists of two clusters @@ -61,17 +60,11 @@ class GMMOutlierDetector(OutlierMixin, BaseEstimator): # Classify a new point as outlier or not p = np.array([[4.5, 0.5]]) - p_pred= gmm.predict(p) # predict the probabilities p belongs to each cluster + p_pred = gmm.predict(p) # predict the probabilities p belongs to each cluster print('The point is an outlier if the score is -1, inlier if the score is 1') - print(f'The score for this point is {p_pred}.') - - plt.scatter(data[:,0], data[:,1], c='y', label='train set') - plt.scatter(p[:,0], p[:,1], c='black', marker='x', label='new datapoint') - plt.title('Distribution of dataset') - plt.legend() - plt.show() - ### The point is an outlier if the score is -1, inlier if the score is 1 + + print(f'The score for this point is {p_pred}.') ### The score for this point is [-1]. ``` """