-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsom_plot.py
More file actions
33 lines (29 loc) · 1.32 KB
/
som_plot.py
File metadata and controls
33 lines (29 loc) · 1.32 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
import matplotlib.pyplot as plt
from pylab import plot,axis,show,pcolor,colorbar,bone
from matplotlib.pyplot import ion
# data need to be 2 dim
def som_plot_scatter(W,X,A):
#plt.plot(blobs[0],'bo')
cof = 5000 / A.max();
A = (A * cof)
plt.figure(7)
plt.scatter(X[:,0], X[:,1], color='red')
plt.scatter(W[:,0],W[:,1],color='blue',s=A.T/10 ,edgecolor='none')
for count, i in enumerate(W):
plt.annotate(count, xy = i, xytext = (0, 0), textcoords = 'offset points')
plt.show()
def som_plot_outlier_scatter(W,X,unit_saliency, inst_saliency, A):
plt.scatter(X[inst_saliency == True, 0], X[inst_saliency == True,1], color='yellow')
plt.scatter(X[inst_saliency == False, 0], X[inst_saliency == False, 1], color = 'orange')
plt.scatter(W[unit_saliency == True ,0],W[unit_saliency == True ,1],color='blue',s=20 ,edgecolor='none')
plt.scatter(W[unit_saliency == False ,0],W[unit_saliency == False ,1],color='red',s=20 ,edgecolor='none')
#for count, i in enumerate(W):
# plt.annotate(count, xy = i, xytext = (0, 0), textcoords = 'offset points')
plt.show()
def som_plot_mapping(distance_map):
bone()
pcolor(distance_map.T) # plotting the distance map as background
colorbar()
#axis([0,som.weights.shape[0],0,som.weights.shape[1]])
ion()
show() # show the figure