Plot the feature centers X Params: - X: a feature matrix has dims (num_classes, hidden_dims) - label_list: a list has dims (num_samples) and it represents the name of each class
(X, label_list)
| 304 | cmap=plt.cm.Spectral) |
| 305 | |
| 306 | def plot_centers(X, label_list): |
| 307 | ''' |
| 308 | Plot the feature centers X |
| 309 | |
| 310 | Params: |
| 311 | - X: a feature matrix has dims (num_classes, hidden_dims) |
| 312 | - label_list: a list has dims (num_samples) |
| 313 | and it represents the name of each class |
| 314 | ''' |
| 315 | plt.scatter(X[:,0], X[:,1], |
| 316 | c=[i+1 for i in range(X.shape[0])], |
| 317 | marker='*') |
| 318 | for i, l_name in enumerate(label_list): |
| 319 | plt.text(X[i,0], X[i,1], |
| 320 | s=str(l_name), |
| 321 | size=15) |
| 322 | |
| 323 | def plot_distribution(X, Y, label_list, class_center_matrix=None, sample_ratio=1.0, select_labels=None): |
| 324 | ''' |