From b9ea7d22c6a87331c6c12edf3b62f495019a6182 Mon Sep 17 00:00:00 2001 From: Florin Andrei <901867+FlorinAndrei@users.noreply.github.com> Date: Thu, 7 Dec 2023 14:28:06 -0800 Subject: [PATCH] Update logistic_visualize.py With the current version of Matplotlib, I get white dots for the 0 class, which are hard to see. This change uses the standard Matplotlib color palette for the classes, shifted by 1. --- logistic_regression_class/logistic_visualize.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/logistic_regression_class/logistic_visualize.py b/logistic_regression_class/logistic_visualize.py index 65289535..ba84ffe7 100644 --- a/logistic_regression_class/logistic_visualize.py +++ b/logistic_regression_class/logistic_visualize.py @@ -44,7 +44,10 @@ def sigmoid(z): z = Xb.dot(w) Y = sigmoid(z) -plt.scatter(X[:,0], X[:,1], c=T, s=100, alpha=0.5) +# make colors more visible +plt_colors = [f'C{i+1}' for i in T] + +plt.scatter(X[:,0], X[:,1], c=plt_colors, s=100, alpha=0.5) x_axis = np.linspace(-6, 6, 100) y_axis = -x_axis