Merge branch 'master' of ssh://gogs@the-cake-is-a-lie.net:20022/jonas/NLP-LAB.git

This commit is contained in:
Carsten 2018-07-24 11:11:12 +02:00
commit 051c34ad5d
8 changed files with 665 additions and 112 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,61 @@
text;sent
I am so happy;p
i love my life;p
i really like this sunshine;p
while doing sport i feel free;p
i is terrible to learn when the weather is this good;n
i am almost crying when i run out of ice cream;n
fuck off;n
you are my best friend ever;p
i love my mommy;p
i prefer oral exams;p
best cocktail is the mojito especial;p
you got a beautiful wedding;p
you husband is this handsome;p
this is such a sneaky bitch;n
you're kidding;n
you are really too drunk;n
you start being annoying;n
i love my mac;p
but it would be better if they are less expensive;n
you are a bad friend;n
I am in love with my new laptop;p
You piss me off;n
I hate school;n
I'm so mad at you;n
Seeing you cry, makes me sad;n
You are so lovely;p
Fish is disgusting;n
At times I feel so depressed;n
Summer makes me happy;p
I want to dance and sing aloud;p
Everything will be ok;p
why are you upset?;n
I dont like it when it rains;n
I dont care at all;n
you are such a bitch;n
I dont understand what this is all about;n
give me a break, idiot!;n
please dont leave me;n
I love cuddling with my dog;p
I want to die;n
that is really sad!;n
why are you saying that, you moron!;n
OMG! i love that cat soo much!;p
can you feel the love tonight;p
i get so emotional when i watch lion king;p
i really hate you;n
that is disgusting;n
my heart is broken;n
i love these sunny days;p
this gave me positive feelings;p
i am sick;n
i am tired;n
are you sick or tired?;n
you are so cute and sweet;p
i just lost my mind;n
i hate all people;n
you are just dumb;n
i will get lucky;p
i like ice cream;p
go home you idiot;n
1 text sent
2 I am so happy p
3 i love my life p
4 i really like this sunshine p
5 while doing sport i feel free p
6 i is terrible to learn when the weather is this good n
7 i am almost crying when i run out of ice cream n
8 fuck off n
9 you are my best friend ever p
10 i love my mommy p
11 i prefer oral exams p
12 best cocktail is the mojito especial p
13 you got a beautiful wedding p
14 you husband is this handsome p
15 this is such a sneaky bitch n
16 you're kidding n
17 you are really too drunk n
18 you start being annoying n
19 i love my mac p
20 but it would be better if they are less expensive n
21 you are a bad friend n
22 I am in love with my new laptop p
23 You piss me off n
24 I hate school n
25 I'm so mad at you n
26 Seeing you cry, makes me sad n
27 You are so lovely p
28 Fish is disgusting n
29 At times I feel so depressed n
30 Summer makes me happy p
31 I want to dance and sing aloud p
32 Everything will be ok p
33 why are you upset? n
34 I dont like it when it rains n
35 I dont care at all n
36 you are such a bitch n
37 I dont understand what this is all about n
38 give me a break, idiot! n
39 please dont leave me n
40 I love cuddling with my dog p
41 I want to die n
42 that is really sad! n
43 why are you saying that, you moron! n
44 OMG! i love that cat soo much! p
45 can you feel the love tonight p
46 i get so emotional when i watch lion king p
47 i really hate you n
48 that is disgusting n
49 my heart is broken n
50 i love these sunny days p
51 this gave me positive feelings p
52 i am sick n
53 i am tired n
54 are you sick or tired? n
55 you are so cute and sweet p
56 i just lost my mind n
57 i hate all people n
58 you are just dumb n
59 i will get lucky p
60 i like ice cream p
61 go home you idiot n

Binary file not shown.

View File

@ -157,7 +157,7 @@
{ {
"data": { "data": {
"application/vnd.jupyter.widget-view+json": { "application/vnd.jupyter.widget-view+json": {
"model_id": "233f744d595f4b81a362faef6b148fe7", "model_id": "e508c9a1f8634b7ba790cf2f291e215a",
"version_major": 2, "version_major": 2,
"version_minor": 0 "version_minor": 0
}, },
@ -263,7 +263,8 @@
" [\n", " [\n",
" [\n", " [\n",
" (widgets.Text(),\"test_input\"),\n", " (widgets.Text(),\"test_input\"),\n",
" (widgets.HTML(),\"prediction\")\n", " (widgets.HTML(),\"prediction\"),\n",
" (widgets.Text(value=\"😳😋😀😌😏😔😒😎😢😅😁😉🙌🙏😘😊😩😍😭😂\"),\"prediction_ground_set\")\n",
" ],\n", " ],\n",
" [\n", " [\n",
" (widgets.Checkbox(),\"show_sorted_list\"),\n", " (widgets.Checkbox(),\"show_sorted_list\"),\n",
@ -760,9 +761,10 @@
" return\n", " return\n",
" X = shown_widgets[\"test_input\"].value\n", " X = shown_widgets[\"test_input\"].value\n",
" pred = pm.predict([X])\n", " pred = pm.predict([X])\n",
" shown_widgets[\"prediction\"].value = \"<h1> \" + str(stl.sent2emoji(pred)[0]) + \"</h1>\"\n", " target_list=list(shown_widgets[\"prediction_ground_set\"].value)\n",
" shown_widgets[\"prediction\"].value = \"<h1> \" + str(stl.sent2emoji(pred,custom_target_emojis=target_list)[0]) + \"</h1>\"\n",
" if shown_widgets[\"show_sorted_list\"].value:\n", " if shown_widgets[\"show_sorted_list\"].value:\n",
" mp(\"## \" + \"\".join(stl.edist.sentiment_vector_to_emoji(pred, only_emoticons=True, n_results=100)))\n", " mp(\"## \" + \"\".join(stl.edist.sentiment_vector_to_emoji(pred, only_emoticons=True, n_results=100, custom_target_emojis=target_list)))\n",
" \n", " \n",
"\n", "\n",
"\n", "\n",

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 #(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, style='bo'): def plot_sentiment_space(predicted_sentiment_vectors, top_sentiments, top_emojis, style='bo', additional_patches = None):
# 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])
@ -86,6 +86,9 @@ def plot_sentiment_space(predicted_sentiment_vectors, top_sentiments, top_emojis
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, style) 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') plt.savefig("val-error_sentiment-plot" + str(datetime.datetime.now()) + ".png", bbox_inches='tight')
# sentiment score axis # 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)): 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, style) 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.savefig("val-error_positive-negative-plot" + str(datetime.datetime.now()) + ".png", bbox_inches='tight')
plt.show() plt.show()

15
error_log.csv Normal file
View File

@ -0,0 +1,15 @@
Train-loss;Train-loss-vector;Valid-loss;Valid-loss-vector;;mean
0.0148;;0.014416503049941666;[0.01842055, 0.02187643, 0.00295252];5;
0.0142;;0.013990323407227162;[0.01740025, 0.02176314, 0.00280759];15;
0.0139;;0.013894867185370585;[0.01726196, 0.02160899, 0.00281365];25;
0.0134;;0.01334701536721269;[0.01694769 0.02043927 0.00265409];52;[0.5124894, 0.238578, 0.26411116]
;;;;;
0.0123;;0.01220267935790051;[0.01521431, 0.01880048, 0.00259325];e2;
;;;;;
d2v:;;;;;
0.0158;;0.015347190550520631;[0.0196343, 0.02333904, 0.00306823];5;
0.0152;;0.015070546146473468;[0.01918779, 0.02310013, 0.00292371];15;
0.0150;;0.014911320278768741;[0.01871091, 0.02312384, 0.00289921];25;
0.0145;;0.014387327237701005;[0.01834857, 0.02200531, 0.0028081 ];52;
;;;;;
0.0144;;0.014354445251258958;[0.0182326, 0.0220324, 0.00279834];e2;
1 Train-loss Train-loss-vector Valid-loss Valid-loss-vector mean
2 0.0148 0.014416503049941666 [0.01842055, 0.02187643, 0.00295252] 5
3 0.0142 0.013990323407227162 [0.01740025, 0.02176314, 0.00280759] 15
4 0.0139 0.013894867185370585 [0.01726196, 0.02160899, 0.00281365] 25
5 0.0134 0.01334701536721269 [0.01694769 0.02043927 0.00265409] 52 [0.5124894, 0.238578, 0.26411116]
6
7 0.0123 0.01220267935790051 [0.01521431, 0.01880048, 0.00259325] e2
8
9 d2v:
10 0.0158 0.015347190550520631 [0.0196343, 0.02333904, 0.00306823] 5
11 0.0152 0.015070546146473468 [0.01918779, 0.02310013, 0.00292371] 15
12 0.0150 0.014911320278768741 [0.01871091, 0.02312384, 0.00289921] 25
13 0.0145 0.014387327237701005 [0.01834857, 0.02200531, 0.0028081 ] 52
14
15 0.0144 0.014354445251258958 [0.0182326, 0.0220324, 0.00279834] e2

BIN
error_log.ods Normal file

Binary file not shown.