evaluation on sentiment dataset
This commit is contained in:
parent
4cd15127ba
commit
953ca76e6b
321
Project/simple_approach/Evaluation_sentiment_dataset.ipynb
Normal file
321
Project/simple_approach/Evaluation_sentiment_dataset.ipynb
Normal file
File diff suppressed because one or more lines are too long
@ -68,7 +68,7 @@ def sentiment_score(s):
|
|||||||
#(pos, neg, neu)^T
|
#(pos, neg, neu)^T
|
||||||
return s[0] - s[1]
|
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
|
# sentiment score axis
|
||||||
top_X = np.array([sentiment_score(x) for x in top_sentiments])
|
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])
|
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])
|
plt.ylim([0,1])
|
||||||
for i in range(len(top_X)):
|
for i in range(len(top_X)):
|
||||||
plt.text(top_X[i], top_Y[i], top_emojis[i])
|
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')
|
plt.savefig("val-error_sentiment-plot" + str(datetime.datetime.now()) + ".png", bbox_inches='tight')
|
||||||
|
|
||||||
# sentiment score axis
|
# sentiment score axis
|
||||||
@ -104,7 +104,7 @@ def plot_sentiment_space(predicted_sentiment_vectors, top_sentiments, top_emojis
|
|||||||
plt.ylim([0,1])
|
plt.ylim([0,1])
|
||||||
for i in range(len(top_X)):
|
for i in range(len(top_X)):
|
||||||
plt.text(top_X[i], top_Y[i], top_emojis[i])
|
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.savefig("val-error_positive-negative-plot" + str(datetime.datetime.now()) + ".png", bbox_inches='tight')
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user