-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisualizer.py
26 lines (24 loc) · 946 Bytes
/
visualizer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""
Draw a line that can discriminate between the two learned classes.
You should also scatter the points of both classes to visualize the behavior of the line (IMPORTANT as We will use it later in documentation).
"""
# ANY plots
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
class Visualizer:
@staticmethod
def plot_scatter(X , y):
class_1 = X.loc[y == -1]
class_2 = X.loc[y == 1]
plt.Figure(figsize=(5, 4))
plt.scatter(class_1.iloc[:, 0], class_1.iloc[:, 1], color='blue', label='Class #1')
plt.scatter(class_2.iloc[:, 0], class_2.iloc[:, 1], color='red', label='Class #2')
# sns.scatterplot(x=X, y=y, hue=y,
# palette='viridis', style=y)
plt.title(f'{X.columns[0]} vs {X.columns[1]}')
plt.xlabel(X.columns[0])
plt.ylabel(X.columns[1])
plt.legend(title='Class')
plt.show()