diff --git a/Project/simple_approach/simple_twitter_learning.ipynb b/Project/simple_approach/simple_twitter_learning.ipynb index 7b8661c..a091cf1 100644 --- a/Project/simple_approach/simple_twitter_learning.ipynb +++ b/Project/simple_approach/simple_twitter_learning.ipynb @@ -9,8 +9,6 @@ "name": "stderr", "output_type": "stream", "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" ] }, @@ -187,7 +185,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 7, "metadata": {}, "outputs": [], "source": [ @@ -322,7 +320,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -503,7 +501,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -527,7 +525,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -535,7 +533,7 @@ "output_type": "stream", "text": [ "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", " \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", "metadata": {}, @@ -566,7 +557,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -576,6 +567,14 @@ "['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": { "text/plain": [ @@ -601,7 +600,9 @@ } ], "source": [ - "pm.save('custom_classifier')" + "import __main__ as main\n", + "if not hasattr(main, '__file__'):\n", + " pm.save('custom_classifier')" ] }, { @@ -614,19 +615,19 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "array([[0.15801723, 0.11859037, 0.10975348],\n", - " [0.17035495, 0.10913695, 0.09354854],\n", - " [0.11777218, 0.06569621, 0.06620223],\n", + "array([[0.4423941 , 0.22976081, 0.26076168],\n", + " [0.75167173, 0.2919423 , 0.3423372 ],\n", + " [0.48943695, 0.21931192, 0.22773138],\n", " ...,\n", - " [0.14746301, 0.09480572, 0.08052498],\n", - " [0.15932804, 0.11895895, 0.10343507],\n", - " [0.17135939, 0.1061406 , 0.09402546]], dtype=float32)" + " [0.51003224, 0.26002786, 0.25588542],\n", + " [0.5808168 , 0.30632192, 0.2964917 ],\n", + " [0.39000767, 0.31723523, 0.24713083]], dtype=float32)" ] }, "metadata": {}, @@ -651,7 +652,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "prediction variance: 0.0006294687\n", + "prediction variance: 0.009700283\n", "teacher variance: 0.03341702104519965\n" ] }, @@ -676,79 +677,79 @@ " \n", " \n", " \n", - " predict\n", - " predicted_sentiment\n", + " text\n", " teacher\n", " teacher_sentiment\n", - " text\n", + " predict\n", + " predicted_sentiment\n", " \n", " \n", " \n", " \n", " 35671\n", - " 😒\n", - " [0.15801723301410675, 0.11859036982059479, 0.1...\n", + " i feel like i care so much more in everi situat\n", " πŸ˜‚\n", " [0.46813021474490496, 0.24716181096977158, 0.2...\n", - " i feel like i care so much more in everi situat\n", + " πŸ˜‚\n", + " [0.44239410758018494, 0.2297608107328415, 0.26...\n", " \n", " \n", " 25683\n", - " 😒\n", - " [0.1703549474477768, 0.10913695394992828, 0.09...\n", + " i did not meat to add that 2 there ... hav see...\n", " πŸ˜‚\n", " [0.46813021474490496, 0.24716181096977158, 0.2...\n", - " i did not meat to add that 2 there ... hav see...\n", + " 😌\n", + " [0.7516717314720154, 0.291942298412323, 0.3423...\n", " \n", " \n", " 8985\n", - " 😒\n", - " [0.1177721843123436, 0.06569620966911316, 0.06...\n", + " never…\n", " 😊\n", " [0.7040175768989329, 0.059322033898305086, 0.2...\n", - " never…\n", + " πŸ˜‚\n", + " [0.48943695425987244, 0.21931192278862, 0.2277...\n", " \n", " \n", " 5410\n", - " 😒\n", - " [0.18182337284088135, 0.12382747232913971, 0.0...\n", + " lmao on me ! ! ! wtf wa he suppos to say\n", " πŸ˜‚\n", " [0.46813021474490496, 0.24716181096977158, 0.2...\n", - " lmao on me ! ! ! wtf wa he suppos to say\n", + " 😒\n", + " [0.3661550283432007, 0.32579296827316284, 0.23...\n", " \n", " \n", " 62611\n", - " 😒\n", - " [0.1786666363477707, 0.11502400785684586, 0.10...\n", + " this dude alway help me get through my school ...\n", " 😊\n", " [0.7040175768989329, 0.059322033898305086, 0.2...\n", - " this dude alway help me get through my school ...\n", + " πŸ˜‚\n", + " [0.48689204454421997, 0.20729433000087738, 0.2...\n", " \n", " \n", "\n", "" ], "text/plain": [ - " predict predicted_sentiment teacher \\\n", - "35671 😒 [0.15801723301410675, 0.11859036982059479, 0.1... πŸ˜‚ \n", - "25683 😒 [0.1703549474477768, 0.10913695394992828, 0.09... πŸ˜‚ \n", - "8985 😒 [0.1177721843123436, 0.06569620966911316, 0.06... 😊 \n", - "5410 😒 [0.18182337284088135, 0.12382747232913971, 0.0... πŸ˜‚ \n", - "62611 😒 [0.1786666363477707, 0.11502400785684586, 0.10... 😊 \n", + " text teacher \\\n", + "35671 i feel like i care so much more in everi situat πŸ˜‚ \n", + "25683 i did not meat to add that 2 there ... hav see... πŸ˜‚ \n", + "8985 never… 😊 \n", + "5410 lmao on me ! ! ! wtf wa he suppos to say πŸ˜‚ \n", + "62611 this dude alway help me get through my school ... 😊 \n", "\n", - " teacher_sentiment \\\n", - "35671 [0.46813021474490496, 0.24716181096977158, 0.2... \n", - "25683 [0.46813021474490496, 0.24716181096977158, 0.2... \n", - "8985 [0.7040175768989329, 0.059322033898305086, 0.2... \n", - "5410 [0.46813021474490496, 0.24716181096977158, 0.2... \n", - "62611 [0.7040175768989329, 0.059322033898305086, 0.2... \n", + " teacher_sentiment predict \\\n", + "35671 [0.46813021474490496, 0.24716181096977158, 0.2... πŸ˜‚ \n", + "25683 [0.46813021474490496, 0.24716181096977158, 0.2... 😌 \n", + "8985 [0.7040175768989329, 0.059322033898305086, 0.2... πŸ˜‚ \n", + "5410 [0.46813021474490496, 0.24716181096977158, 0.2... 😒 \n", + "62611 [0.7040175768989329, 0.059322033898305086, 0.2... πŸ˜‚ \n", "\n", - " text \n", - "35671 i feel like i care so much more in everi situat \n", - "25683 i did not meat to add that 2 there ... hav see... \n", - "8985 never… \n", - "5410 lmao on me ! ! ! wtf wa he suppos to say \n", - "62611 this dude alway help me get through my school ... " + " predicted_sentiment \n", + "35671 [0.44239410758018494, 0.2297608107328415, 0.26... \n", + "25683 [0.7516717314720154, 0.291942298412323, 0.3423... \n", + "8985 [0.48943695425987244, 0.21931192278862, 0.2277... \n", + "5410 [0.3661550283432007, 0.32579296827316284, 0.23... \n", + "62611 [0.48689204454421997, 0.20729433000087738, 0.2... " ] }, "metadata": {}, @@ -758,9 +759,9 @@ "name": "stdout", "output_type": "stream", "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 prediction: [0.00053908 0.00024232 0.00021658]\n" + "Variance prediction: [0.0083875 0.00473354 0.00115709]\n" ] } ], @@ -807,9 +808,38 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "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": [ "import __main__ as main\n", "if not hasattr(main, '__file__'):\n", @@ -869,6 +899,13 @@ " display(t)\n", " display(widgets.VBox([b, out])) " ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {