From df70860246534a8c60e41c847cb06f47c6a91d4d Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 26 Sep 2017 09:08:01 +0000 Subject: [PATCH] Add missing import --- lstm_word2vec_archive.ipynb | 61 ++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/lstm_word2vec_archive.ipynb b/lstm_word2vec_archive.ipynb index 5b7ad05..330282f 100644 --- a/lstm_word2vec_archive.ipynb +++ b/lstm_word2vec_archive.ipynb @@ -12,21 +12,13 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": { "collapsed": false, "deletable": true, "editable": true }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Using CNTK backend\n" - ] - } - ], + "outputs": [], "source": [ "import numpy as np\n", "import os\n", @@ -37,7 +29,7 @@ "os.environ['KERAS_BACKEND']='cntk'\n", "from keras.preprocessing import sequence\n", "from keras.preprocessing.text import Tokenizer, text_to_word_sequence\n", - "from keras.models import Sequential\n", + "from keras.models import Sequential, load_model\n", "from keras import regularizers\n", "from keras.optimizers import SGD\n", "from keras.layers import Dense, Dropout, Embedding, LSTM, Bidirectional\n", @@ -96,7 +88,9 @@ "cell_type": "code", "execution_count": 13, "metadata": { - "collapsed": true + "collapsed": true, + "deletable": true, + "editable": true }, "outputs": [], "source": [ @@ -107,7 +101,9 @@ "cell_type": "code", "execution_count": 17, "metadata": { - "collapsed": false + "collapsed": false, + "deletable": true, + "editable": true }, "outputs": [], "source": [ @@ -117,7 +113,10 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "deletable": true, + "editable": true + }, "source": [ "Extract scores and review texts from file " ] @@ -126,7 +125,9 @@ "cell_type": "code", "execution_count": 60, "metadata": { - "collapsed": false + "collapsed": false, + "deletable": true, + "editable": true }, "outputs": [], "source": [ @@ -140,7 +141,9 @@ "cell_type": "code", "execution_count": 74, "metadata": { - "collapsed": true + "collapsed": true, + "deletable": true, + "editable": true }, "outputs": [], "source": [ @@ -151,7 +154,10 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "deletable": true, + "editable": true + }, "source": [ "Remove medium rating and convert to binary classification (high vs. low rating). " ] @@ -160,7 +166,9 @@ "cell_type": "code", "execution_count": 80, "metadata": { - "collapsed": false + "collapsed": false, + "deletable": true, + "editable": true }, "outputs": [], "source": [ @@ -183,7 +191,10 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "deletable": true, + "editable": true + }, "source": [ "Extract a balanced subsample and split into training and test sets." ] @@ -208,7 +219,9 @@ "cell_type": "code", "execution_count": 124, "metadata": { - "collapsed": false + "collapsed": false, + "deletable": true, + "editable": true }, "outputs": [ { @@ -232,7 +245,9 @@ "cell_type": "code", "execution_count": 118, "metadata": { - "collapsed": false + "collapsed": false, + "deletable": true, + "editable": true }, "outputs": [ { @@ -667,7 +682,9 @@ "cell_type": "code", "execution_count": 152, "metadata": { - "collapsed": false + "collapsed": false, + "deletable": true, + "editable": true }, "outputs": [ {