for index, learning_decay in enumerate(learning_decays): (c1, c2) = color_couples[index] # prepare the scores array (y-axis) d = dict_learningDecay[str(learning_decay) + '_learning_decay'] train_scores = np.array(d['train_scores']) test_scores = np.array(d['test_scores']) train_perplexities = np.array(d['train_perplexities']) test_perplexities = np.array(d['test_perplexities']) alpha = 0.1 label = 'learning_decay ' + str(learning_decay) plot_scores(ax_1, x_axis, train_scores, n_splits, c1, title='train_scores', label=label) plot_scores(ax_2, x_axis, train_perplexities, n_splits, c1, title='train_perplexities', label=label) plot_scores(ax_3, x_axis, test_scores, n_splits, c2,
color_couples = [('#99c9eb', '#f998a5'), ('#4ca1dd', '#f77687'), ('#0079cf', '#f6546a'), ('#005490', '#c44354'), ('#003052', '#93323f'), ] x_axis = range(0, max_iter, valid_iter) plt.figure(figsize=(20, 16)) plt.suptitle('Tuning n_topic (learning decay = '+str(learning_decay)+')', fontsize=12) ax_1 = plt.subplot(221) ax_2 = plt.subplot(222) ax_3 = plt.subplot(223) ax_4 = plt.subplot(224) for index, n_component in enumerate(n_components): (c1, c2) = color_couples[index] d = dict_num_topic[str(n_component) + '_topics'] train_scores = np.array(d['train_scores']) test_scores = np.array(d['test_scores']) train_perplexities = np.array(d['train_perplexities']) test_perplexities = np.array(d['test_perplexities']) alpha = 0.1 label = 'topic_'+str(n_component) plot_scores(ax_1, x_axis, train_scores, n_splits, c1, title='train_scores', label=label) plot_scores(ax_2, x_axis, train_perplexities, n_splits, c1, title='train_perplexities', label=label) plot_scores(ax_3, x_axis, test_scores, n_splits, c2, title='test_scores', label=label) plot_scores(ax_4, x_axis, test_perplexities, n_splits, c2, title='test_perplexities', label=label) plt.savefig('converge_exploration_nTopic(learning decay'+str(learning_decay)+'_full.png') print "\nFinish Plotting within", time() - start_time, 'secends'