def mplot(x, mat): m, n = mat.shape # linestyles = ['_', '-', '--', ':', '-.'] linestyles = ['-', '--', '-.'] # styles = ['+', '*', 'x'] styles = [''] colors = ('b', 'g', 'r', 'c', 'm', 'y', 'k') for i in range(n): color = colors[i % len(colors)] style = styles[i % len(styles)] ls = linestyles[i % len(linestyles)] plt.plot(x, mat[:, i], linestyle=ls, marker=style, color=color, markersize=4)
for i in xrange(m): D[i, j] = I_rec[i][j, seq_map[args.entro]] x = HeuristicRefinePL(D, args.lamb, 50, 0.5, 0.01) if x is None: print('No feasible selection') # import sys sys.exit(0) print('solution: ', x) select_D = D[:, np.nonzero(x)[0]] org_entro = np.nanmin(D, axis=1) select_entro = np.nanmin(select_D, axis=1) plt.subplot(411) plt.plot(D) plt.title('divergence between traffic and all candidate PLs') plt.setp(plt.gca().get_xticklabels(), visible=False) plt.ylabel('divergence') plt.subplot(412) # plt.plot(select_D) mplot(range(m), select_D) plt.title('divergence between traffic and selected PLs') plt.setp(plt.gca().get_xticklabels(), visible=False) plt.ylabel('divergence') ##### plot selected model id with PL Identification ####### plt.subplot(413) selected_model = []