just very little tweaks

This commit is contained in:
Jonas Weinz 2018-06-20 11:34:36 +02:00
parent 8425355783
commit a623322ebb

View File

@ -9,8 +9,6 @@
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"/home/jonas/.local/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
" from ._conv import register_converters as _register_converters\n",
"Using TensorFlow backend.\n" "Using TensorFlow backend.\n"
] ]
}, },
@ -187,7 +185,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -322,7 +320,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -503,7 +501,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -527,7 +525,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -535,7 +533,7 @@
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Epoch 1/1\n", "Epoch 1/1\n",
"100/100 [==============================] - 3s 27ms/step - loss: 0.1225\n" "10000/10000 [==============================] - 109s 11ms/step - loss: 0.0197\n"
] ]
} }
], ],
@ -546,16 +544,9 @@
" layers=[(2500, 'relu'),(3,None)], sdm=sdm)\n", " layers=[(2500, 'relu'),(3,None)], sdm=sdm)\n",
" \n", " \n",
" tr = trainer(sdm=sdm, pm=pm)\n", " tr = trainer(sdm=sdm, pm=pm)\n",
" tr.fit(100)" " tr.fit(10000)"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
@ -566,7 +557,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 13,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -576,6 +567,14 @@
"['keras_model']\n" "['keras_model']\n"
] ]
}, },
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/jonas/.local/lib/python3.6/site-packages/keras/engine/sequential.py:109: UserWarning: `Sequential.model` is deprecated. `Sequential` is a subclass of `Model`, you can just use your `Sequential` instance directly.\n",
" warnings.warn('`Sequential.model` is deprecated. '\n"
]
},
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
@ -601,6 +600,8 @@
} }
], ],
"source": [ "source": [
"import __main__ as main\n",
"if not hasattr(main, '__file__'):\n",
" pm.save('custom_classifier')" " pm.save('custom_classifier')"
] ]
}, },
@ -614,19 +615,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 33, "execution_count": 14,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"array([[0.15801723, 0.11859037, 0.10975348],\n", "array([[0.4423941 , 0.22976081, 0.26076168],\n",
" [0.17035495, 0.10913695, 0.09354854],\n", " [0.75167173, 0.2919423 , 0.3423372 ],\n",
" [0.11777218, 0.06569621, 0.06620223],\n", " [0.48943695, 0.21931192, 0.22773138],\n",
" ...,\n", " ...,\n",
" [0.14746301, 0.09480572, 0.08052498],\n", " [0.51003224, 0.26002786, 0.25588542],\n",
" [0.15932804, 0.11895895, 0.10343507],\n", " [0.5808168 , 0.30632192, 0.2964917 ],\n",
" [0.17135939, 0.1061406 , 0.09402546]], dtype=float32)" " [0.39000767, 0.31723523, 0.24713083]], dtype=float32)"
] ]
}, },
"metadata": {}, "metadata": {},
@ -651,7 +652,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"prediction variance: 0.0006294687\n", "prediction variance: 0.009700283\n",
"teacher variance: 0.03341702104519965\n" "teacher variance: 0.03341702104519965\n"
] ]
}, },
@ -676,79 +677,79 @@
" <thead>\n", " <thead>\n",
" <tr style=\"text-align: right;\">\n", " <tr style=\"text-align: right;\">\n",
" <th></th>\n", " <th></th>\n",
" <th>predict</th>\n", " <th>text</th>\n",
" <th>predicted_sentiment</th>\n",
" <th>teacher</th>\n", " <th>teacher</th>\n",
" <th>teacher_sentiment</th>\n", " <th>teacher_sentiment</th>\n",
" <th>text</th>\n", " <th>predict</th>\n",
" <th>predicted_sentiment</th>\n",
" </tr>\n", " </tr>\n",
" </thead>\n", " </thead>\n",
" <tbody>\n", " <tbody>\n",
" <tr>\n", " <tr>\n",
" <th>35671</th>\n", " <th>35671</th>\n",
" <td>😢</td>\n", " <td>i feel like i care so much more in everi situat</td>\n",
" <td>[0.15801723301410675, 0.11859036982059479, 0.1...</td>\n",
" <td>😂</td>\n", " <td>😂</td>\n",
" <td>[0.46813021474490496, 0.24716181096977158, 0.2...</td>\n", " <td>[0.46813021474490496, 0.24716181096977158, 0.2...</td>\n",
" <td>i feel like i care so much more in everi situat</td>\n", " <td>😂</td>\n",
" <td>[0.44239410758018494, 0.2297608107328415, 0.26...</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>25683</th>\n", " <th>25683</th>\n",
" <td>😢</td>\n", " <td>i did not meat to add that 2 there ... hav see...</td>\n",
" <td>[0.1703549474477768, 0.10913695394992828, 0.09...</td>\n",
" <td>😂</td>\n", " <td>😂</td>\n",
" <td>[0.46813021474490496, 0.24716181096977158, 0.2...</td>\n", " <td>[0.46813021474490496, 0.24716181096977158, 0.2...</td>\n",
" <td>i did not meat to add that 2 there ... hav see...</td>\n", " <td>😌</td>\n",
" <td>[0.7516717314720154, 0.291942298412323, 0.3423...</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>8985</th>\n", " <th>8985</th>\n",
" <td>😢</td>\n", " <td>never…</td>\n",
" <td>[0.1177721843123436, 0.06569620966911316, 0.06...</td>\n",
" <td>😊</td>\n", " <td>😊</td>\n",
" <td>[0.7040175768989329, 0.059322033898305086, 0.2...</td>\n", " <td>[0.7040175768989329, 0.059322033898305086, 0.2...</td>\n",
" <td>never…</td>\n", " <td>😂</td>\n",
" <td>[0.48943695425987244, 0.21931192278862, 0.2277...</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>5410</th>\n", " <th>5410</th>\n",
" <td>😢</td>\n", " <td>lmao on me ! ! ! wtf wa he suppos to say</td>\n",
" <td>[0.18182337284088135, 0.12382747232913971, 0.0...</td>\n",
" <td>😂</td>\n", " <td>😂</td>\n",
" <td>[0.46813021474490496, 0.24716181096977158, 0.2...</td>\n", " <td>[0.46813021474490496, 0.24716181096977158, 0.2...</td>\n",
" <td>lmao on me ! ! ! wtf wa he suppos to say</td>\n", " <td>😢</td>\n",
" <td>[0.3661550283432007, 0.32579296827316284, 0.23...</td>\n",
" </tr>\n", " </tr>\n",
" <tr>\n", " <tr>\n",
" <th>62611</th>\n", " <th>62611</th>\n",
" <td>😢</td>\n", " <td>this dude alway help me get through my school ...</td>\n",
" <td>[0.1786666363477707, 0.11502400785684586, 0.10...</td>\n",
" <td>😊</td>\n", " <td>😊</td>\n",
" <td>[0.7040175768989329, 0.059322033898305086, 0.2...</td>\n", " <td>[0.7040175768989329, 0.059322033898305086, 0.2...</td>\n",
" <td>this dude alway help me get through my school ...</td>\n", " <td>😂</td>\n",
" <td>[0.48689204454421997, 0.20729433000087738, 0.2...</td>\n",
" </tr>\n", " </tr>\n",
" </tbody>\n", " </tbody>\n",
"</table>\n", "</table>\n",
"</div>" "</div>"
], ],
"text/plain": [ "text/plain": [
" predict predicted_sentiment teacher \\\n", " text teacher \\\n",
"35671 😢 [0.15801723301410675, 0.11859036982059479, 0.1... 😂 \n", "35671 i feel like i care so much more in everi situat 😂 \n",
"25683 😢 [0.1703549474477768, 0.10913695394992828, 0.09... 😂 \n", "25683 i did not meat to add that 2 there ... hav see... 😂 \n",
"8985 😢 [0.1177721843123436, 0.06569620966911316, 0.06... 😊 \n", "8985 never… 😊 \n",
"5410 😢 [0.18182337284088135, 0.12382747232913971, 0.0... 😂 \n", "5410 lmao on me ! ! ! wtf wa he suppos to say 😂 \n",
"62611 😢 [0.1786666363477707, 0.11502400785684586, 0.10... 😊 \n", "62611 this dude alway help me get through my school ... 😊 \n",
"\n", "\n",
" teacher_sentiment \\\n", " teacher_sentiment predict \\\n",
"35671 [0.46813021474490496, 0.24716181096977158, 0.2... \n", "35671 [0.46813021474490496, 0.24716181096977158, 0.2... 😂 \n",
"25683 [0.46813021474490496, 0.24716181096977158, 0.2... \n", "25683 [0.46813021474490496, 0.24716181096977158, 0.2... 😌 \n",
"8985 [0.7040175768989329, 0.059322033898305086, 0.2... \n", "8985 [0.7040175768989329, 0.059322033898305086, 0.2... 😂 \n",
"5410 [0.46813021474490496, 0.24716181096977158, 0.2... \n", "5410 [0.46813021474490496, 0.24716181096977158, 0.2... 😢 \n",
"62611 [0.7040175768989329, 0.059322033898305086, 0.2... \n", "62611 [0.7040175768989329, 0.059322033898305086, 0.2... 😂 \n",
"\n", "\n",
" text \n", " predicted_sentiment \n",
"35671 i feel like i care so much more in everi situat \n", "35671 [0.44239410758018494, 0.2297608107328415, 0.26... \n",
"25683 i did not meat to add that 2 there ... hav see... \n", "25683 [0.7516717314720154, 0.291942298412323, 0.3423... \n",
"8985 never… \n", "8985 [0.48943695425987244, 0.21931192278862, 0.2277... \n",
"5410 lmao on me ! ! ! wtf wa he suppos to say \n", "5410 [0.3661550283432007, 0.32579296827316284, 0.23... \n",
"62611 this dude alway help me get through my school ... " "62611 [0.48689204454421997, 0.20729433000087738, 0.2... "
] ]
}, },
"metadata": {}, "metadata": {},
@ -758,9 +759,9 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Mean Squared Error: [0.14140389 0.04240099 0.02944344]\n", "Mean Squared Error: [0.02340565 0.02344435 0.00374819]\n",
"Variance teacher: [0.02183094 0.02513847 0.00285735]\n", "Variance teacher: [0.02183094 0.02513847 0.00285735]\n",
"Variance prediction: [0.00053908 0.00024232 0.00021658]\n" "Variance prediction: [0.0083875 0.00473354 0.00115709]\n"
] ]
} }
], ],
@ -807,9 +808,38 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 15,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "2ca4e06fcd4f41c2bfd161f9f16ca594",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Text(value='')"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a39abb79d70e4ae1952b2d928cfab174",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(Button(description='get emoji', icon='check', style=ButtonStyle(), tooltip='Click me'), Output(…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [ "source": [
"import __main__ as main\n", "import __main__ as main\n",
"if not hasattr(main, '__file__'):\n", "if not hasattr(main, '__file__'):\n",
@ -869,6 +899,13 @@
" display(t)\n", " display(t)\n",
" display(widgets.VBox([b, out])) " " display(widgets.VBox([b, out])) "
] ]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {