evaluation on sentiment dataset

This commit is contained in:
Jonas Weinz 2018-07-23 09:23:17 +02:00
parent 4cd15127ba
commit 953ca76e6b
2 changed files with 324 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -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):
def plot_sentiment_space(predicted_sentiment_vectors, top_sentiments, top_emojis, style='bo'):
# 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])
@ -85,7 +85,7 @@ def plot_sentiment_space(predicted_sentiment_vectors, top_sentiments, top_emojis
plt.ylim([0,1])
for i in range(len(top_X)):
plt.text(top_X[i], top_Y[i], top_emojis[i])
plt.plot(pred_X, pred_Y, 'bo')
plt.plot(pred_X, pred_Y, style)
plt.savefig("val-error_sentiment-plot" + str(datetime.datetime.now()) + ".png", bbox_inches='tight')
# sentiment score axis
@ -104,7 +104,7 @@ def plot_sentiment_space(predicted_sentiment_vectors, top_sentiments, top_emojis
plt.ylim([0,1])
for i in range(len(top_X)):
plt.text(top_X[i], top_Y[i], top_emojis[i])
plt.plot(pred_X, pred_Y, 'bo')
plt.plot(pred_X, pred_Y, style)
plt.savefig("val-error_positive-negative-plot" + str(datetime.datetime.now()) + ".png", bbox_inches='tight')
plt.show()