-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot.py
More file actions
118 lines (86 loc) · 3.84 KB
/
plot.py
File metadata and controls
118 lines (86 loc) · 3.84 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import matplotlib.pyplot as plt
def slicing_points(X1, X2):
X1_0_1 = X1[:,[2,4]] # X1 - X2
X1_0_2 = X1[:,[2,4]] # X1 - X3
X2_0_1 = X2[:,[2,4]]
X2_0_2 = X2[:,[2,4]]
return X1_0_1,X1_0_2,X2_0_1,X2_0_2
#plotting 200 training points before diagonalization
def generate_plot_for_X(plotX1,plotX2):
X1_0_1, X1_0_2, X2_0_1, X2_0_2 = slicing_points(plotX1, plotX2)
# To plot X1_X2 domain of X
plt.scatter(X1_0_1[:, [0]], X1_0_1[:, [1]], c='red')
plt.scatter(X2_0_1[:, [0]], X2_0_1[:, [1]], c='blue')
plt.xlabel("X1")
plt.ylabel("X2")
plt.title("Before Diagonalization(X1 - X2) domain")
plt.show()
# To plot X1_X3 domain of X
plt.scatter(X1_0_2[:, 0], X1_0_2[:, 1], c='red')
plt.scatter(X2_0_2[:, 0], X2_0_2[:, 1], c='blue')
plt.xlabel("X1")
plt.ylabel("X3")
plt.title("Before Diagonalization(X1 - X3) domain")
plt.show()
def generate_plot_for_HoKashyap(class1,class2,plot_x,plot_y, string):
X1_0_1, X1_0_2, X2_0_1, X2_0_2 = slicing_points(class1, class2)
# To plot X1_X2 domain of X
plt.scatter(X1_0_1[:, [0]], X1_0_1[:, [1]], c='red')
plt.scatter(X2_0_1[:, [0]], X2_0_1[:, [1]], c='blue')
plt.scatter(plot_x, plot_y, c='green')
plt.xlabel("X1")
plt.ylabel("X2")
plt.title("Discriminant Function for HoKashyap" + str(string) + "diagonalization")
plt.show()
def generate_plot_for_discriminantFunc(plotX1,plotX2,Points_X1_X2,Root4,Root3,Points_X1_X3,Root1,Root2):
X1_0_1, X1_0_2, X2_0_1, X2_0_2 = slicing_points(plotX1, plotX2)
# To plot X1_X2 domain of X
plt.scatter(X1_0_1[:, [0]], X1_0_1[:, [1]], c='red')
plt.scatter(X2_0_1[:, [0]], X2_0_1[:, [1]], c='blue')
#plt.scatter(Points_X1_X2[:], Root4[:], c='green')
plt.scatter(Points_X1_X2[:], Root3[:], c='green')
#plt.text( 2, 2, 'red= first, blue = second')
plt.xlabel("X1")
plt.ylabel("X2")
plt.title("Discriminant function before diagonalized points(X1 - X2) domain")
plt.show()
plt.scatter(X1_0_2[:, 0], X1_0_2[:, 1], c='red')
plt.scatter(X2_0_2[:, 0], X2_0_2[:, 1], c='blue')
#plt.scatter(Points_X1_X3[:], Root1[:], c='green')
plt.scatter(Points_X1_X3[:], Root2[:], c='green')
plt.xlabel("X1")
plt.ylabel("X3")
plt.title("Discriminant function before diagonalized points(X1 - X3) domain")
plt.show()
def generate_plot_for_discriminantFunc_V(plotX1,plotX2,Points_X1_X2,Root4,Root3,Points_X1_X3,Root1,Root2):
X1_0_1, X1_0_2, X2_0_1, X2_0_2 = slicing_points(plotX1, plotX2)
# To plot X1_X2 domain of X
plt.scatter(X1_0_1[:, [0]], X1_0_1[:, [1]], c='red')
plt.scatter(X2_0_1[:, [0]], X2_0_1[:, [1]], c='blue')
#plt.scatter(Points_X1_X2[:], Root4[:], c='green')
plt.scatter(Points_X1_X2[:], Root3[:], c='green')
#plt.text( 2, 2, 'red= first, blue = second')
plt.xlabel("X1")
plt.ylabel("X2")
plt.title("Discriminant function after diagonalized points(V1 - V2) domain")
plt.show()
plt.scatter(X1_0_2[:, 0], X1_0_2[:, 1], c='red')
plt.scatter(X2_0_2[:, 0], X2_0_2[:, 1], c='blue')
#plt.scatter(Points_X1_X3[:], Root1[:], c='green')
plt.scatter(Points_X1_X3[:], Root2[:], c='green')
plt.xlabel("X1")
plt.ylabel("X3")
plt.title("Discriminant function after diagonalized points(V1 - V3) domain")
plt.show()
def generate_plot_for_parzen_class1(random_points,f_class):
plt.title("Final learned distribution(number of MA founds) in class 1")
plt.xlabel("random points for class 1")
plt.ylabel("estimated contribution for each random point")
plt.scatter(random_points, f_class)
plt.show()
def generate_plot_for_parzen_class2(random_points,f_class):
plt.title("Final learned distribution(number of MA founds) in class 2")
plt.xlabel("random points for class 2")
plt.ylabel("estimated contribution for each random point")
plt.scatter(random_points, f_class)
plt.show()