some improvements
This commit is contained in:
		| @ -181,24 +181,6 @@ | ||||
|    "source": [ | ||||
|     "plot_emoji_list(sentiment_vectors=edist.list_sentiment_vectors, unicode_repr=edist.list_emojis, title=\"Full Emoji space\")" | ||||
|    ] | ||||
|   }, | ||||
|   { | ||||
|    "cell_type": "code", | ||||
|    "execution_count": null, | ||||
|    "metadata": { | ||||
|     "collapsed": true | ||||
|    }, | ||||
|    "outputs": [], | ||||
|    "source": [] | ||||
|   }, | ||||
|   { | ||||
|    "cell_type": "code", | ||||
|    "execution_count": null, | ||||
|    "metadata": { | ||||
|     "collapsed": true | ||||
|    }, | ||||
|    "outputs": [], | ||||
|    "source": [] | ||||
|   } | ||||
|  ], | ||||
|  "metadata": { | ||||
| @ -217,7 +199,7 @@ | ||||
|    "name": "python", | ||||
|    "nbconvert_exporter": "python", | ||||
|    "pygments_lexer": "ipython3", | ||||
|    "version": "3.6.3" | ||||
|    "version": "3.6.5" | ||||
|   } | ||||
|  }, | ||||
|  "nbformat": 4, | ||||
|  | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -68,7 +68,7 @@ def sentiment_score(s): | ||||
|     #(pos, neg, neu)^T | ||||
|     return s[0] - s[1] | ||||
|  | ||||
| def plot_sentiment_space(predicted_sentiment_vectors, top_sentiments, top_emojis, style='bo'): | ||||
| def plot_sentiment_space(predicted_sentiment_vectors, top_sentiments, top_emojis, style='bo', additional_patches = None): | ||||
|     # sentiment score axis | ||||
|     top_X = np.array([sentiment_score(x) for x in top_sentiments]) | ||||
|     pred_X = np.array([sentiment_score(x) for x in predicted_sentiment_vectors]) | ||||
| @ -86,6 +86,9 @@ def plot_sentiment_space(predicted_sentiment_vectors, top_sentiments, top_emojis | ||||
|     for i in range(len(top_X)): | ||||
|         plt.text(top_X[i], top_Y[i], top_emojis[i]) | ||||
|     plt.plot(pred_X, pred_Y, style) | ||||
|     for p_tuple in additional_patches: | ||||
|         ax_1.add_artist(p_tuple[0]) | ||||
|         p_tuple[0].set_alpha(0.4) | ||||
|     plt.savefig("val-error_sentiment-plot" + str(datetime.datetime.now()) +  ".png", bbox_inches='tight') | ||||
|  | ||||
|     # sentiment score axis | ||||
| @ -105,6 +108,9 @@ def plot_sentiment_space(predicted_sentiment_vectors, top_sentiments, top_emojis | ||||
|     for i in range(len(top_X)): | ||||
|         plt.text(top_X[i], top_Y[i], top_emojis[i]) | ||||
|     plt.plot(pred_X, pred_Y, style) | ||||
|     for p_tuple in additional_patches: | ||||
|         ax_2.add_artist(p_tuple[1]) | ||||
|         p_tuple[1].set_alpha(0.4) | ||||
|     plt.savefig("val-error_positive-negative-plot" + str(datetime.datetime.now()) + ".png", bbox_inches='tight') | ||||
|     plt.show() | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user