From 467ee0b3c82e7f8f7a8394c10dca5a0ed075f513 Mon Sep 17 00:00:00 2001 From: Stefan Kennedy Date: Sun, 9 Dec 2018 17:09:36 +0000 Subject: [PATCH 1/5] Added comparison of convolutional networks --- LUCAS/notebooks/neuralnet_comparison.ipynb | 860 +++++++++++++++++++++ 1 file changed, 860 insertions(+) create mode 100644 LUCAS/notebooks/neuralnet_comparison.ipynb diff --git a/LUCAS/notebooks/neuralnet_comparison.ipynb b/LUCAS/notebooks/neuralnet_comparison.ipynb new file mode 100644 index 0000000..6088756 --- /dev/null +++ b/LUCAS/notebooks/neuralnet_comparison.ipynb @@ -0,0 +1,860 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Comparison of neural Models\n", + "This notebook creates a comparison of how our neural models perform. We will try each model with and without word embeddings, and produce visualisations of model performance. \n", + "\n", + "# Feed-Forward Neural Networks\n", + "First we will find this difference for Feed-Forward Neural Networks (FFNN):" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "\n", + "from tensorflow.keras import Sequential\n", + "from tensorflow.keras.layers import Conv2D, Dense, Dropout, Embedding, Flatten, MaxPooling2D\n", + "from tensorflow.keras.activations import relu, sigmoid\n", + "from tensorflow.keras.preprocessing.sequence import pad_sequences\n", + "from tensorflow.keras.preprocessing.text import text_to_word_sequence, Tokenizer\n", + "from tensorflow.keras.regularizers import l2\n", + "from tensorflow.keras.callbacks import EarlyStopping\n", + "from tensorflow.keras.utils import to_categorical\n", + "from scripts import training_helpers\n", + "from sklearn.model_selection import train_test_split, StratifiedKFold\n", + "\n", + "from gensim.models import KeyedVectors\n", + "from seaborn import boxplot\n", + "from pandas import DataFrame" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We will cross validate our model, so lets create a function to handle this for us. It will use StratifiedKFold splitting:" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [], + "source": [ + "def run_cross_validate(get_model, X, y, cv=5, categorical=False):\n", + " skfSplitter = StratifiedKFold(n_splits=cv, shuffle=True)\n", + " metrics = {\n", + " \"accuracies\": [],\n", + " }\n", + " \n", + " for train_indices, test_indices in skfSplitter.split(X, y):\n", + " training_X = np.array([X[x] for x in train_indices])\n", + " training_y = [y[x] for x in train_indices]\n", + " test_X = np.array([X[x] for x in test_indices])\n", + " test_y = [y[x] for x in test_indices]\n", + " \n", + " if categorical:\n", + " training_y = to_categorical(training_y)\n", + " test_y = to_categorical(test_y)\n", + " \n", + " model = get_model()\n", + " model.fit(np.array(training_X), training_y, epochs=12, batch_size=16, validation_split=0.3,\n", + " callbacks=[EarlyStopping(monitor='val_loss', patience=4)])\n", + " metrics[\"accuracies\"].append(model.evaluate(np.array(test_X), test_y)[1])\n", + " return metrics" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "First we find results for our Bag of Words (BoW) model:" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "data_frame = training_helpers.get_data_frame()\n", + "\n", + "predictors_raw = data_frame['review']\n", + "num_words = 20000\n", + "\n", + "tokenizer = Tokenizer(num_words)\n", + "tokenizer.fit_on_texts(predictors_raw)\n", + "bow_predictors = tokenizer.texts_to_matrix(predictors_raw, mode='tfidf')\n", + "labels = [x for x in data_frame['deceptive']]" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Train on 560 samples, validate on 240 samples\n", + "Epoch 1/12\n", + "560/560 [==============================] - 1s 3ms/step - loss: 0.8071 - acc: 0.6446 - val_loss: 0.6504 - val_acc: 0.8208\n", + "Epoch 2/12\n", + "560/560 [==============================] - 0s 804us/step - loss: 0.4659 - acc: 0.9321 - val_loss: 0.5257 - val_acc: 0.8625\n", + "Epoch 3/12\n", + "560/560 [==============================] - 0s 805us/step - loss: 0.3024 - acc: 0.9732 - val_loss: 0.4687 - val_acc: 0.8750\n", + "Epoch 4/12\n", + "560/560 [==============================] - 0s 856us/step - loss: 0.2227 - acc: 0.9929 - val_loss: 0.4506 - val_acc: 0.8625\n", + "Epoch 5/12\n", + "560/560 [==============================] - 0s 886us/step - loss: 0.2027 - acc: 0.9929 - val_loss: 0.4386 - val_acc: 0.8583\n", + "Epoch 6/12\n", + "560/560 [==============================] - 0s 849us/step - loss: 0.1701 - acc: 0.9982 - val_loss: 0.4258 - val_acc: 0.8708\n", + "Epoch 7/12\n", + "560/560 [==============================] - 0s 794us/step - loss: 0.1639 - acc: 0.9946 - val_loss: 0.4257 - val_acc: 0.8750\n", + "Epoch 8/12\n", + "560/560 [==============================] - 1s 896us/step - loss: 0.1509 - acc: 0.9982 - val_loss: 0.4388 - val_acc: 0.8667\n", + "Epoch 9/12\n", + "560/560 [==============================] - 0s 891us/step - loss: 0.1435 - acc: 1.0000 - val_loss: 0.4350 - val_acc: 0.8792\n", + "Epoch 10/12\n", + "560/560 [==============================] - 1s 977us/step - loss: 0.1358 - acc: 0.9946 - val_loss: 0.4369 - val_acc: 0.8708\n", + "Epoch 11/12\n", + "560/560 [==============================] - 0s 845us/step - loss: 0.1376 - acc: 0.9964 - val_loss: 0.4608 - val_acc: 0.8417\n", + "800/800 [==============================] - 0s 196us/step\n", + "Train on 560 samples, validate on 240 samples\n", + "Epoch 1/12\n", + "560/560 [==============================] - 1s 2ms/step - loss: 0.8048 - acc: 0.6268 - val_loss: 0.6342 - val_acc: 0.8333\n", + "Epoch 2/12\n", + "560/560 [==============================] - 0s 842us/step - loss: 0.3943 - acc: 0.9429 - val_loss: 0.5230 - val_acc: 0.8333\n", + "Epoch 3/12\n", + "560/560 [==============================] - 0s 809us/step - loss: 0.2257 - acc: 0.9893 - val_loss: 0.4977 - val_acc: 0.8458\n", + "Epoch 4/12\n", + "560/560 [==============================] - 0s 864us/step - loss: 0.1886 - acc: 0.9946 - val_loss: 0.4853 - val_acc: 0.8583\n", + "Epoch 5/12\n", + "560/560 [==============================] - 1s 908us/step - loss: 0.1710 - acc: 0.9911 - val_loss: 0.5166 - val_acc: 0.8083\n", + "Epoch 6/12\n", + "560/560 [==============================] - 0s 866us/step - loss: 0.1555 - acc: 1.0000 - val_loss: 0.4783 - val_acc: 0.8542\n", + "Epoch 7/12\n", + "560/560 [==============================] - 0s 863us/step - loss: 0.1413 - acc: 0.9982 - val_loss: 0.4799 - val_acc: 0.8667\n", + "Epoch 8/12\n", + "560/560 [==============================] - 0s 852us/step - loss: 0.1355 - acc: 0.9982 - val_loss: 0.4918 - val_acc: 0.8458\n", + "Epoch 9/12\n", + "560/560 [==============================] - 0s 832us/step - loss: 0.1286 - acc: 0.9982 - val_loss: 0.4684 - val_acc: 0.8667\n", + "Epoch 10/12\n", + "560/560 [==============================] - 0s 841us/step - loss: 0.1211 - acc: 0.9982 - val_loss: 0.4659 - val_acc: 0.8667\n", + "Epoch 11/12\n", + "560/560 [==============================] - 0s 855us/step - loss: 0.1186 - acc: 1.0000 - val_loss: 0.4657 - val_acc: 0.8708\n", + "Epoch 12/12\n", + "560/560 [==============================] - 0s 882us/step - loss: 0.1183 - acc: 0.9982 - val_loss: 0.5181 - val_acc: 0.8417\n", + "800/800 [==============================] - 0s 211us/step\n" + ] + } + ], + "source": [ + "def get_ff_bow_model():\n", + " model = Sequential([\n", + " Dense(16, activation=relu, input_shape=(num_words,), kernel_regularizer=l2(0.01)),\n", + " Dropout(0.25),\n", + " Dense(8, activation=relu, kernel_regularizer=l2(0.01)),\n", + " Dense(1, activation=sigmoid)\n", + " ])\n", + " model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])\n", + " return model\n", + "\n", + "ff_bow_scores = run_cross_validate(get_ff_bow_model, bow_predictors, labels, cv=2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "And for our word vector method. First we must create our word vectors using a word vectorizing model generated in another experiment:" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "word_vectors = KeyedVectors.load(\"opspam_w2v.kv\", mmap=\"r\")\n", + "\n", + "predictors_sequences = pad_sequences(tokenizer.texts_to_sequences(predictors_raw))\n", + "max_sequence_length = max([len(x) for x in predictors_sequences])" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "embedding_length = word_vectors.vector_size\n", + "\n", + "corpus_words = tokenizer.word_index\n", + "corpus_vocab_size = len(corpus_words)+1\n", + "vectorizer_words = word_vectors.wv\n", + "embedding_matrix = np.zeros((corpus_vocab_size, embedding_length))\n", + "for word, idx in corpus_words.items():\n", + " if word in vectorizer_words.vocab:\n", + " embedding_matrix[idx] = np.array(vectorizer_words[word], dtype=np.float32)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 4s 4ms/step - loss: 0.8892 - acc: 0.5114 - val_loss: 0.8111 - val_acc: 0.5681\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7886 - acc: 0.5968 - val_loss: 0.7751 - val_acc: 0.6189\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7564 - acc: 0.6216 - val_loss: 0.7772 - val_acc: 0.6005\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7434 - acc: 0.6504 - val_loss: 0.7879 - val_acc: 0.6143\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6938 - acc: 0.6862 - val_loss: 0.7597 - val_acc: 0.6189\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6735 - acc: 0.6951 - val_loss: 0.7771 - val_acc: 0.6328\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6624 - acc: 0.7051 - val_loss: 0.7744 - val_acc: 0.6005\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6650 - acc: 0.6892 - val_loss: 0.7679 - val_acc: 0.6374\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6427 - acc: 0.7001 - val_loss: 0.7927 - val_acc: 0.6074\n", + "160/160 [==============================] - 0s 501us/step\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 4s 4ms/step - loss: 0.8793 - acc: 0.5174 - val_loss: 0.8131 - val_acc: 0.4850\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7761 - acc: 0.5084 - val_loss: 0.7622 - val_acc: 0.5358\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7892 - acc: 0.5521 - val_loss: 0.7899 - val_acc: 0.4850\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7456 - acc: 0.5462 - val_loss: 0.7498 - val_acc: 0.5196\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7224 - acc: 0.6097 - val_loss: 0.7618 - val_acc: 0.5312\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7098 - acc: 0.6137 - val_loss: 0.7470 - val_acc: 0.5935\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7114 - acc: 0.6385 - val_loss: 0.7482 - val_acc: 0.5889\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6977 - acc: 0.6415 - val_loss: 0.7432 - val_acc: 0.5982\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6865 - acc: 0.6504 - val_loss: 0.7682 - val_acc: 0.5681\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6843 - acc: 0.6395 - val_loss: 0.7978 - val_acc: 0.5612\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6784 - acc: 0.6723 - val_loss: 0.7464 - val_acc: 0.6305\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6675 - acc: 0.6614 - val_loss: 0.7450 - val_acc: 0.6351\n", + "160/160 [==============================] - 0s 378us/step\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 4s 4ms/step - loss: 0.9339 - acc: 0.4965 - val_loss: 0.8415 - val_acc: 0.5266\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.8042 - acc: 0.5243 - val_loss: 0.7882 - val_acc: 0.5058\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7702 - acc: 0.5948 - val_loss: 0.7674 - val_acc: 0.5450\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7445 - acc: 0.6137 - val_loss: 0.7869 - val_acc: 0.5058\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7464 - acc: 0.6068 - val_loss: 0.7683 - val_acc: 0.5797\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7240 - acc: 0.6296 - val_loss: 0.7488 - val_acc: 0.5820\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7101 - acc: 0.6643 - val_loss: 0.7541 - val_acc: 0.5727\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7180 - acc: 0.6455 - val_loss: 0.7520 - val_acc: 0.6328\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6834 - acc: 0.6961 - val_loss: 0.7522 - val_acc: 0.5958\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6734 - acc: 0.6991 - val_loss: 0.7758 - val_acc: 0.5866\n", + "160/160 [==============================] - 0s 300us/step\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 4s 4ms/step - loss: 0.8810 - acc: 0.5144 - val_loss: 0.8163 - val_acc: 0.5012\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.8084 - acc: 0.5611 - val_loss: 0.8017 - val_acc: 0.5473\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7666 - acc: 0.5859 - val_loss: 0.7694 - val_acc: 0.5404\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7510 - acc: 0.5740 - val_loss: 0.7846 - val_acc: 0.5012\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7396 - acc: 0.5501 - val_loss: 0.7544 - val_acc: 0.5242\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7215 - acc: 0.5809 - val_loss: 0.7358 - val_acc: 0.5427\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7173 - acc: 0.5819 - val_loss: 0.7329 - val_acc: 0.6097\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7073 - acc: 0.6207 - val_loss: 0.7324 - val_acc: 0.5843\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7008 - acc: 0.6286 - val_loss: 0.7331 - val_acc: 0.6097\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7005 - acc: 0.6435 - val_loss: 0.7295 - val_acc: 0.5727\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6953 - acc: 0.6216 - val_loss: 0.7563 - val_acc: 0.5589\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6889 - acc: 0.6435 - val_loss: 0.7501 - val_acc: 0.5635\n", + "160/160 [==============================] - 0s 323us/step\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 4s 4ms/step - loss: 0.8440 - acc: 0.4737 - val_loss: 0.7721 - val_acc: 0.4988\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7584 - acc: 0.5333 - val_loss: 0.7625 - val_acc: 0.5035\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7466 - acc: 0.5392 - val_loss: 0.7526 - val_acc: 0.5797\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7296 - acc: 0.5730 - val_loss: 0.7233 - val_acc: 0.5566\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7142 - acc: 0.5631 - val_loss: 0.7198 - val_acc: 0.5843\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7068 - acc: 0.5899 - val_loss: 0.7166 - val_acc: 0.6120\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7006 - acc: 0.6236 - val_loss: 0.7357 - val_acc: 0.5058\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7066 - acc: 0.5938 - val_loss: 0.7147 - val_acc: 0.6028\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6984 - acc: 0.6306 - val_loss: 0.7115 - val_acc: 0.5751\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6867 - acc: 0.6187 - val_loss: 0.7070 - val_acc: 0.6490\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6780 - acc: 0.6534 - val_loss: 0.7261 - val_acc: 0.6028\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6897 - acc: 0.6514 - val_loss: 0.7084 - val_acc: 0.6051\n", + "160/160 [==============================] - 0s 331us/step\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 4s 4ms/step - loss: 0.9152 - acc: 0.5005 - val_loss: 0.8182 - val_acc: 0.4919\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.8013 - acc: 0.5025 - val_loss: 0.7734 - val_acc: 0.4919\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Epoch 3/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7586 - acc: 0.4975 - val_loss: 0.7512 - val_acc: 0.5358\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7373 - acc: 0.4965 - val_loss: 0.7273 - val_acc: 0.5081\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7221 - acc: 0.4777 - val_loss: 0.7171 - val_acc: 0.5081\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7135 - acc: 0.4965 - val_loss: 0.7101 - val_acc: 0.5081\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7077 - acc: 0.4965 - val_loss: 0.7053 - val_acc: 0.5081\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7036 - acc: 0.4995 - val_loss: 0.7020 - val_acc: 0.4919\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7007 - acc: 0.5035 - val_loss: 0.6996 - val_acc: 0.4919\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6987 - acc: 0.5035 - val_loss: 0.6980 - val_acc: 0.4919\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6973 - acc: 0.5035 - val_loss: 0.6968 - val_acc: 0.4919\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6964 - acc: 0.5035 - val_loss: 0.6961 - val_acc: 0.4919\n", + "160/160 [==============================] - 0s 296us/step\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 5s 5ms/step - loss: 0.8823 - acc: 0.5074 - val_loss: 0.8056 - val_acc: 0.5681\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7783 - acc: 0.5402 - val_loss: 0.7581 - val_acc: 0.5797\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7892 - acc: 0.5144 - val_loss: 0.7879 - val_acc: 0.4988\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7573 - acc: 0.5432 - val_loss: 0.7567 - val_acc: 0.5358\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7561 - acc: 0.5829 - val_loss: 0.7791 - val_acc: 0.5658\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7518 - acc: 0.5521 - val_loss: 0.7613 - val_acc: 0.4896\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7306 - acc: 0.6048 - val_loss: 0.7492 - val_acc: 0.5774\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7213 - acc: 0.6137 - val_loss: 0.7645 - val_acc: 0.5173\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7238 - acc: 0.6058 - val_loss: 0.7305 - val_acc: 0.6282\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7110 - acc: 0.6097 - val_loss: 0.7268 - val_acc: 0.6028\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7180 - acc: 0.6008 - val_loss: 0.7249 - val_acc: 0.5289\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6984 - acc: 0.6336 - val_loss: 0.7228 - val_acc: 0.6166\n", + "160/160 [==============================] - 0s 440us/step\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 4s 4ms/step - loss: 0.8812 - acc: 0.4826 - val_loss: 0.8145 - val_acc: 0.4850\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.8048 - acc: 0.5233 - val_loss: 0.7943 - val_acc: 0.5035\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7643 - acc: 0.5283 - val_loss: 0.7436 - val_acc: 0.5704\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7417 - acc: 0.5750 - val_loss: 0.7334 - val_acc: 0.5751\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7324 - acc: 0.5581 - val_loss: 0.7337 - val_acc: 0.5958\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7260 - acc: 0.6167 - val_loss: 0.7470 - val_acc: 0.6074\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7200 - acc: 0.6127 - val_loss: 0.7555 - val_acc: 0.5242\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7075 - acc: 0.6465 - val_loss: 0.7231 - val_acc: 0.6674\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7135 - acc: 0.6346 - val_loss: 0.7582 - val_acc: 0.5958\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6950 - acc: 0.6614 - val_loss: 0.7344 - val_acc: 0.6143\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6913 - acc: 0.6723 - val_loss: 0.7260 - val_acc: 0.6282\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6762 - acc: 0.6783 - val_loss: 0.7787 - val_acc: 0.5266\n", + "160/160 [==============================] - 0s 423us/step\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 5s 5ms/step - loss: 0.8875 - acc: 0.5174 - val_loss: 0.8045 - val_acc: 0.5751\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7872 - acc: 0.5482 - val_loss: 0.7768 - val_acc: 0.5727\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7536 - acc: 0.5839 - val_loss: 0.7668 - val_acc: 0.6074\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7258 - acc: 0.6415 - val_loss: 0.7642 - val_acc: 0.6005\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7147 - acc: 0.6336 - val_loss: 0.7606 - val_acc: 0.6166\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6841 - acc: 0.6852 - val_loss: 0.7601 - val_acc: 0.6236\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6749 - acc: 0.6852 - val_loss: 0.7843 - val_acc: 0.6189\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6623 - acc: 0.7080 - val_loss: 0.7861 - val_acc: 0.6028\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6589 - acc: 0.6912 - val_loss: 0.7743 - val_acc: 0.5912\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6491 - acc: 0.7090 - val_loss: 0.8071 - val_acc: 0.5935\n", + "160/160 [==============================] - 0s 366us/step\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 5s 5ms/step - loss: 0.9038 - acc: 0.5402 - val_loss: 0.8186 - val_acc: 0.5797\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7911 - acc: 0.5621 - val_loss: 0.7799 - val_acc: 0.5035\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7673 - acc: 0.5899 - val_loss: 0.7556 - val_acc: 0.5820\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7397 - acc: 0.5958 - val_loss: 0.7490 - val_acc: 0.5843\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7373 - acc: 0.6226 - val_loss: 0.7429 - val_acc: 0.6282\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7195 - acc: 0.6276 - val_loss: 0.7544 - val_acc: 0.5612\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7004 - acc: 0.6544 - val_loss: 0.7304 - val_acc: 0.5612\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6969 - acc: 0.6544 - val_loss: 0.7300 - val_acc: 0.6189\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6897 - acc: 0.6584 - val_loss: 0.7637 - val_acc: 0.5497\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6793 - acc: 0.6961 - val_loss: 0.7344 - val_acc: 0.6443\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6638 - acc: 0.7249 - val_loss: 0.7727 - val_acc: 0.5727\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6700 - acc: 0.7130 - val_loss: 0.7682 - val_acc: 0.5889\n", + "160/160 [==============================] - 0s 361us/step\n" + ] + } + ], + "source": [ + "def get_ff_wv_model():\n", + " model_ff_wv = Sequential([\n", + " Embedding(corpus_vocab_size, embedding_length, weights=[embedding_matrix], trainable=False,\n", + " input_length=max_sequence_length),\n", + " Flatten(),\n", + " Dense(16, activation=relu, kernel_regularizer=l2(0.01)), #, input_shape=(num_words,)\n", + " Dropout(0.25),\n", + " Dense(8, activation=relu, kernel_regularizer=l2(0.01)),\n", + " Dense(1, activation=sigmoid)\n", + " ])\n", + " model_ff_wv.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])\n", + " return model_ff_wv\n", + "\n", + "ff_wv_scores = run_cross_validate(get_ff_wv_model, predictors_sequences, labels, cv=10)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Bag of words: [0.84375, 0.89375, 0.8625, 0.90625, 0.85, 0.8375, 0.875, 0.8625, 0.875, 0.8875]\n", + "Word vectors: [0.64375, 0.625, 0.59375, 0.54375, 0.6, 0.5, 0.56875, 0.53125, 0.575, 0.56875]\n" + ] + } + ], + "source": [ + "print (\"Bag of words: \", ff_bow_scores['accuracies'])\n", + "print (\"Word vectors: \", ff_wv_scores['accuracies'])\n", + "\n", + "ff_scores_entries =[('Bag of Words', x) for x in ff_bow_scores['accuracies']] + [('Word Vectors', x) for x in ff_wv_scores['accuracies']]\n", + "ff_scores_data_frame = DataFrame(ff_scores_entries, columns=['input type', 'accuracy'])" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvDW2N/gAAHXRJREFUeJzt3XuYXVWZ5/Hvj0JIEIFgSh6tUCRQhYC2D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/roqr8iG7oasg/7l6XlxtFN84ba9jXg/wL9aRTXuplpJOFXkg0J3w8sAz6QRhdGUpdenObWrBTuWZg1b+80+u4evDi0+qXAtZJuJxsSuz4a6l3AFkl3Apc1XLfYbltErJT0OPD1hmPeDvyQbGa6CyNiI7BR0pHAinT9/Umyobt/N8q/r9kLPDaUWRMk/Qqo5IbgHu39vwa4CTgiXS9B0gXAkxHxT2Uc02xH+DSUWYtJ+huyyaM+XU8UZu3GPQszMyvknoWZmRVysjAzs0JOFmZmVsjJwszMCjlZmJlZIScLMzMr9P8BKRZqKSHpQUQAAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "boxplot(x='input type', y='accuracy', data=ff_scores_data_frame)\n", + "plt.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The results are very strange! How could word vectors be less accurate than bag of words? This is known to occur when two conditions are met:\n", + " \n", + "* The dataset is small\n", + "* The dataset is very domain specific\n", + "\n", + "It is possible that these conditions actually are met here. The problem however is that running these models over our full dataset will take much longer, and will require a commited experiment to complete the investigation." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Convolutional Network" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(1600, 20000)" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bow_predictors.shape" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(1600, 1, 20000, 1)" + ] + }, + "execution_count": 75, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "batches = 1600\n", + "convolutional_data = np.array(np.split(np.array([[[y] for y in z] for z in bow_predictors]), batches))\n", + "convolutional_data.shape" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": {}, + "outputs": [], + "source": [ + "def get_conv_bow_model():\n", + " model = Sequential([\n", + " Conv2D(\n", + " filters=50,\n", + " kernel_size=(1, 10),\n", + " data_format=\"channels_last\",\n", + " input_shape=(1, 20000, 1),\n", + " activation=relu),\n", + " MaxPooling2D(pool_size=(1, 10)),\n", + " Dropout(0.2),\n", + " Flatten(),\n", + " Dense(2, activation='softmax')\n", + " ])\n", + " model.compile(\n", + " loss='binary_crossentropy',\n", + " optimizer='adam',\n", + " metrics=['accuracy'])\n", + " return model" + ] + }, + { + "cell_type": "code", + "execution_count": 77, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Train on 560 samples, validate on 240 samples\n", + "Epoch 1/12\n", + "560/560 [==============================] - 13s 23ms/step - loss: 0.5304 - acc: 0.7357 - val_loss: 0.6516 - val_acc: 0.6667\n", + "Epoch 2/12\n", + "560/560 [==============================] - 11s 19ms/step - loss: 0.1653 - acc: 0.9589 - val_loss: 0.7696 - val_acc: 0.6292\n", + "Epoch 3/12\n", + "560/560 [==============================] - 10s 18ms/step - loss: 0.0820 - acc: 0.9804 - val_loss: 0.7386 - val_acc: 0.6708\n", + "Epoch 4/12\n", + "560/560 [==============================] - 11s 20ms/step - loss: 0.0499 - acc: 0.9946 - val_loss: 0.9655 - val_acc: 0.5708\n", + "Epoch 5/12\n", + "560/560 [==============================] - 13s 23ms/step - loss: 0.0282 - acc: 0.9964 - val_loss: 0.9687 - val_acc: 0.6167\n", + "800/800 [==============================] - 7s 8ms/step\n", + "Train on 560 samples, validate on 240 samples\n", + "Epoch 1/12\n", + "560/560 [==============================] - 13s 24ms/step - loss: 0.5012 - acc: 0.7679 - val_loss: 0.6617 - val_acc: 0.6292\n", + "Epoch 2/12\n", + "560/560 [==============================] - 9s 16ms/step - loss: 0.1410 - acc: 0.9696 - val_loss: 0.7467 - val_acc: 0.6292\n", + "Epoch 3/12\n", + "560/560 [==============================] - 10s 18ms/step - loss: 0.0662 - acc: 0.9893 - val_loss: 0.8208 - val_acc: 0.6292\n", + "Epoch 4/12\n", + "560/560 [==============================] - 10s 18ms/step - loss: 0.0360 - acc: 0.9982 - val_loss: 0.9100 - val_acc: 0.6333\n", + "Epoch 5/12\n", + "560/560 [==============================] - 12s 22ms/step - loss: 0.0225 - acc: 1.0000 - val_loss: 0.9885 - val_acc: 0.6208\n", + "800/800 [==============================] - 6s 7ms/step\n" + ] + } + ], + "source": [ + "conv_bow_scores = run_cross_validate(get_conv_bow_model, convolutional_data, labels, cv=2, categorical=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "def vectorize_review(review_words):\n", + " sentence = []\n", + " for word in review_words:\n", + " if word in word_vectors.wv:\n", + " sentence.append(word_vectors.wv['dog'])\n", + " return np.array(sentence, np.float64)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "def pad_vectorized_review(vectorized_review, length):\n", + " return np.concatenate((vectorized_review, np.zeros((length - len(vectorized_review), 100))))" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [], + "source": [ + "vectorized_reviews = [vectorize_review(text_to_word_sequence(x)) for x in predictors_raw]\n", + "pad_length = max([x.shape[0] for x in vectorized_reviews])\n", + "vectorized_reviews = np.array([[pad_vectorized_review(x, pad_length)] for x in vectorized_reviews])" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(1600, 1, 381, 100)\n" + ] + } + ], + "source": [ + "print(vectorized_reviews.shape)" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "metadata": {}, + "outputs": [], + "source": [ + "def get_conv_wv_model():\n", + " model = Sequential([\n", + " Conv2D(\n", + " filters=50,\n", + " kernel_size=(10, 100),\n", + " data_format=\"channels_first\",\n", + " input_shape=(1, 381, 100),\n", + " activation=relu),\n", + " MaxPooling2D(strides=(1, 1), pool_size=(2, 1), data_format=\"channels_first\"),\n", + " Dropout(0.2),\n", + " Flatten(),\n", + " Dense(2, activation='softmax')\n", + " ])\n", + " model.compile(\n", + " loss='binary_crossentropy',\n", + " optimizer='adam',\n", + " metrics=['accuracy'])\n", + " return model" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Train on 560 samples, validate on 240 samples\n", + "Epoch 1/12\n", + "560/560 [==============================] - 5s 9ms/step - loss: 0.7025 - acc: 0.4911 - val_loss: 0.6932 - val_acc: 0.4917\n", + "Epoch 2/12\n", + "560/560 [==============================] - 3s 5ms/step - loss: 0.6923 - acc: 0.5429 - val_loss: 0.6993 - val_acc: 0.4625\n", + "Epoch 3/12\n", + "560/560 [==============================] - 3s 5ms/step - loss: 0.6823 - acc: 0.5571 - val_loss: 0.6747 - val_acc: 0.5792\n", + "Epoch 4/12\n", + "560/560 [==============================] - 3s 5ms/step - loss: 0.6699 - acc: 0.6304 - val_loss: 0.6840 - val_acc: 0.5833\n", + "Epoch 5/12\n", + "560/560 [==============================] - 3s 5ms/step - loss: 0.6463 - acc: 0.6589 - val_loss: 0.6832 - val_acc: 0.5667\n", + "Epoch 6/12\n", + "560/560 [==============================] - 3s 5ms/step - loss: 0.6338 - acc: 0.6393 - val_loss: 0.6863 - val_acc: 0.5875\n", + "Epoch 7/12\n", + "560/560 [==============================] - 3s 5ms/step - loss: 0.6156 - acc: 0.6821 - val_loss: 0.6981 - val_acc: 0.5667\n", + "800/800 [==============================] - 1s 2ms/step\n", + "Train on 560 samples, validate on 240 samples\n", + "Epoch 1/12\n", + "560/560 [==============================] - 5s 9ms/step - loss: 0.6998 - acc: 0.4714 - val_loss: 0.6930 - val_acc: 0.5208\n", + "Epoch 2/12\n", + "560/560 [==============================] - 3s 5ms/step - loss: 0.6932 - acc: 0.5018 - val_loss: 0.6941 - val_acc: 0.4875\n", + "Epoch 3/12\n", + "560/560 [==============================] - 3s 5ms/step - loss: 0.6897 - acc: 0.5554 - val_loss: 0.7010 - val_acc: 0.4542\n", + "Epoch 4/12\n", + "560/560 [==============================] - 3s 5ms/step - loss: 0.6855 - acc: 0.5643 - val_loss: 0.7088 - val_acc: 0.4542\n", + "Epoch 5/12\n", + "560/560 [==============================] - 4s 6ms/step - loss: 0.6791 - acc: 0.5750 - val_loss: 0.7192 - val_acc: 0.4542\n", + "800/800 [==============================] - 2s 2ms/step\n" + ] + } + ], + "source": [ + "conv_wv_scores = run_cross_validate(get_conv_wv_model, vectorized_reviews, labels, cv=2, categorical=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 78, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Bag of words: [0.82125, 0.7775]\n", + "Word vectors: [0.48, 0.51625]\n" + ] + } + ], + "source": [ + "print (\"Bag of words: \", conv_bow_scores['accuracies'])\n", + "print (\"Word vectors: \", conv_wv_scores['accuracies'])\n", + "\n", + "conv_scores_entries =[('Bag of Words', x) for x in conv_bow_scores['accuracies']] + [('Word Vectors', x) for x in conv_wv_scores['accuracies']]\n", + "conv_scores_data_frame = DataFrame(conv_scores_entries, columns=['input type', 'accuracy'])" + ] + }, + { + "cell_type": "code", + "execution_count": 79, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvDW2N/gAAGp1JREFUeJzt3X20XXV95/H3h4s8WIpiSV0aiEETBduxUG5xkGqxLZixVew4o9B2FWw1fQLRmdqRaUcdnFasnVpGWY7Iora2gk9VY2WkQaRVHkpuJIpEkGsUSWI1EqogQUz4zh97Xzi5uck+geyck+T9Wuuue/bev733N8nJ+ZzffvjtVBWSJO3IfqMuQJI0/gwLSVInw0KS1MmwkCR1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bB/TPt69uimg+Zadgnwf4AV7SiuM05rRxL+MZoh4VcAVwK/2Y4uTJL5efgxt1Iv7FlIwzuwHX13Px4eWv09wMeT3EgzJPbMaKhfBDYn+QLw3lnnLbZZVlUrk3wP+KtZ+7wR+CTNk+neXFXrgfVJjgGub8+/30szdPe3d/GfV3qIY0NJQ0jydWByYAjuXb39JwPXAEe350tI8ibg3qr68z72Ke0MD0NJI5bkN2geHvVHM0EhjRt7FpKkTvYsJEmdDAtJUifDQpLUybCQJHUyLCRJnQwLSVKn/w8obWijne89IwAAAABJRU5ErkJggg==\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "boxplot(x='input type', y='accuracy', data=conv_scores_data_frame)\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.6" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} From ed115a2894c4ed6246c9b168b9593636f19bc777 Mon Sep 17 00:00:00 2001 From: Stefan Kennedy Date: Sun, 9 Dec 2018 23:08:03 +0000 Subject: [PATCH 2/5] Finished comparison pre-run --- LUCAS/notebooks/neuralnet_comparison.ipynb | 930 +++++++++++++++------ 1 file changed, 657 insertions(+), 273 deletions(-) diff --git a/LUCAS/notebooks/neuralnet_comparison.ipynb b/LUCAS/notebooks/neuralnet_comparison.ipynb index 6088756..cc0bfef 100644 --- a/LUCAS/notebooks/neuralnet_comparison.ipynb +++ b/LUCAS/notebooks/neuralnet_comparison.ipynb @@ -21,7 +21,7 @@ "import matplotlib.pyplot as plt\n", "\n", "from tensorflow.keras import Sequential\n", - "from tensorflow.keras.layers import Conv2D, Dense, Dropout, Embedding, Flatten, MaxPooling2D\n", + "from tensorflow.keras.layers import Conv2D, Dense, Dropout, Embedding, Flatten, LSTM, MaxPooling2D\n", "from tensorflow.keras.activations import relu, sigmoid\n", "from tensorflow.keras.preprocessing.sequence import pad_sequences\n", "from tensorflow.keras.preprocessing.text import text_to_word_sequence, Tokenizer\n", @@ -45,11 +45,11 @@ }, { "cell_type": "code", - "execution_count": 64, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ - "def run_cross_validate(get_model, X, y, cv=5, categorical=False):\n", + "def run_cross_validate(get_model, X, y, cv=5, categorical=False, add_target_dim=False):\n", " skfSplitter = StratifiedKFold(n_splits=cv, shuffle=True)\n", " metrics = {\n", " \"accuracies\": [],\n", @@ -57,15 +57,19 @@ " \n", " for train_indices, test_indices in skfSplitter.split(X, y):\n", " training_X = np.array([X[x] for x in train_indices])\n", - " training_y = [y[x] for x in train_indices]\n", + " training_y = np.array([y[x] for x in train_indices])\n", " test_X = np.array([X[x] for x in test_indices])\n", - " test_y = [y[x] for x in test_indices]\n", + " test_y = np.array([y[x] for x in test_indices])\n", " \n", " if categorical:\n", " training_y = to_categorical(training_y)\n", " test_y = to_categorical(test_y)\n", + " if add_target_dim:\n", + " training_y = np.array([[y] for y in training_y])\n", + " test_y = np.array([[y] for y in test_y])\n", " \n", " model = get_model()\n", + " print(\"Fitting with: \", np.array(training_X).shape, \"labels\", np.array(training_y).shape)\n", " model.fit(np.array(training_X), training_y, epochs=12, batch_size=16, validation_split=0.3,\n", " callbacks=[EarlyStopping(monitor='val_loss', patience=4)])\n", " metrics[\"accuracies\"].append(model.evaluate(np.array(test_X), test_y)[1])\n", @@ -81,7 +85,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -98,63 +102,243 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Train on 560 samples, validate on 240 samples\n", + "Fitting with: (1440, 20000) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6841 - acc: 0.7299 - val_loss: 0.4919 - val_acc: 0.8753\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 979us/step - loss: 0.3207 - acc: 0.9533 - val_loss: 0.4375 - val_acc: 0.8845\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 954us/step - loss: 0.2247 - acc: 0.9861 - val_loss: 0.4551 - val_acc: 0.8684\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 846us/step - loss: 0.1878 - acc: 0.9921 - val_loss: 0.4220 - val_acc: 0.8799\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 996us/step - loss: 0.1701 - acc: 0.9921 - val_loss: 0.4326 - val_acc: 0.8845\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1619 - acc: 0.9960 - val_loss: 0.4388 - val_acc: 0.8707\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 942us/step - loss: 0.1410 - acc: 0.9970 - val_loss: 0.4325 - val_acc: 0.8776\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 1s 995us/step - loss: 0.1366 - acc: 0.9950 - val_loss: 0.4526 - val_acc: 0.8730\n", + "160/160 [==============================] - 0s 289us/step\n", + "Fitting with: (1440, 20000) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "560/560 [==============================] - 1s 3ms/step - loss: 0.8071 - acc: 0.6446 - val_loss: 0.6504 - val_acc: 0.8208\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7056 - acc: 0.7279 - val_loss: 0.5265 - val_acc: 0.8868\n", "Epoch 2/12\n", - "560/560 [==============================] - 0s 804us/step - loss: 0.4659 - acc: 0.9321 - val_loss: 0.5257 - val_acc: 0.8625\n", + "1007/1007 [==============================] - 1s 829us/step - loss: 0.3381 - acc: 0.9434 - val_loss: 0.4575 - val_acc: 0.8799\n", "Epoch 3/12\n", - "560/560 [==============================] - 0s 805us/step - loss: 0.3024 - acc: 0.9732 - val_loss: 0.4687 - val_acc: 0.8750\n", + "1007/1007 [==============================] - 1s 990us/step - loss: 0.2363 - acc: 0.9831 - val_loss: 0.4420 - val_acc: 0.8915\n", "Epoch 4/12\n", - "560/560 [==============================] - 0s 856us/step - loss: 0.2227 - acc: 0.9929 - val_loss: 0.4506 - val_acc: 0.8625\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1894 - acc: 0.9960 - val_loss: 0.4378 - val_acc: 0.8915\n", "Epoch 5/12\n", - "560/560 [==============================] - 0s 886us/step - loss: 0.2027 - acc: 0.9929 - val_loss: 0.4386 - val_acc: 0.8583\n", + "1007/1007 [==============================] - 1s 924us/step - loss: 0.1702 - acc: 0.9940 - val_loss: 0.4364 - val_acc: 0.8845\n", "Epoch 6/12\n", - "560/560 [==============================] - 0s 849us/step - loss: 0.1701 - acc: 0.9982 - val_loss: 0.4258 - val_acc: 0.8708\n", + "1007/1007 [==============================] - 1s 983us/step - loss: 0.1517 - acc: 0.9980 - val_loss: 0.4367 - val_acc: 0.8915\n", "Epoch 7/12\n", - "560/560 [==============================] - 0s 794us/step - loss: 0.1639 - acc: 0.9946 - val_loss: 0.4257 - val_acc: 0.8750\n", + "1007/1007 [==============================] - 1s 807us/step - loss: 0.1410 - acc: 0.9940 - val_loss: 0.4323 - val_acc: 0.8730\n", "Epoch 8/12\n", - "560/560 [==============================] - 1s 896us/step - loss: 0.1509 - acc: 0.9982 - val_loss: 0.4388 - val_acc: 0.8667\n", + "1007/1007 [==============================] - 1s 904us/step - loss: 0.1376 - acc: 0.9960 - val_loss: 0.4444 - val_acc: 0.8776\n", "Epoch 9/12\n", - "560/560 [==============================] - 0s 891us/step - loss: 0.1435 - acc: 1.0000 - val_loss: 0.4350 - val_acc: 0.8792\n", + "1007/1007 [==============================] - 1s 816us/step - loss: 0.1390 - acc: 0.9980 - val_loss: 0.4466 - val_acc: 0.8845\n", "Epoch 10/12\n", - "560/560 [==============================] - 1s 977us/step - loss: 0.1358 - acc: 0.9946 - val_loss: 0.4369 - val_acc: 0.8708\n", + "1007/1007 [==============================] - 1s 804us/step - loss: 0.1469 - acc: 0.9921 - val_loss: 0.4863 - val_acc: 0.8661\n", "Epoch 11/12\n", - "560/560 [==============================] - 0s 845us/step - loss: 0.1376 - acc: 0.9964 - val_loss: 0.4608 - val_acc: 0.8417\n", - "800/800 [==============================] - 0s 196us/step\n", - "Train on 560 samples, validate on 240 samples\n", + "1007/1007 [==============================] - 1s 843us/step - loss: 0.1403 - acc: 0.9960 - val_loss: 0.4829 - val_acc: 0.8730\n", + "160/160 [==============================] - 0s 227us/step\n", + "Fitting with: (1440, 20000) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7498 - acc: 0.7071 - val_loss: 0.5638 - val_acc: 0.8799\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 815us/step - loss: 0.4170 - acc: 0.9126 - val_loss: 0.4938 - val_acc: 0.8499\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 840us/step - loss: 0.2676 - acc: 0.9722 - val_loss: 0.4810 - val_acc: 0.8637\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.2140 - acc: 0.9891 - val_loss: 0.4444 - val_acc: 0.8799\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1829 - acc: 0.9950 - val_loss: 0.4518 - val_acc: 0.8822\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 975us/step - loss: 0.1756 - acc: 0.9901 - val_loss: 0.4546 - val_acc: 0.8753\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1630 - acc: 0.9960 - val_loss: 0.4691 - val_acc: 0.8845\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1602 - acc: 0.9970 - val_loss: 0.4792 - val_acc: 0.8891\n", + "160/160 [==============================] - 0s 255us/step\n", + "Fitting with: (1440, 20000) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 3s 3ms/step - loss: 0.6894 - acc: 0.7358 - val_loss: 0.5138 - val_acc: 0.8545\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.3196 - acc: 0.9523 - val_loss: 0.4592 - val_acc: 0.8799\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.2174 - acc: 0.9891 - val_loss: 0.4649 - val_acc: 0.8637\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1838 - acc: 0.9940 - val_loss: 0.4599 - val_acc: 0.8707\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.1663 - acc: 0.9960 - val_loss: 0.4437 - val_acc: 0.8799\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1553 - acc: 0.9950 - val_loss: 0.4822 - val_acc: 0.8614\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1593 - acc: 0.9950 - val_loss: 0.5086 - val_acc: 0.8637\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1509 - acc: 0.9970 - val_loss: 0.4692 - val_acc: 0.8730\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 1s 987us/step - loss: 0.1471 - acc: 0.9940 - val_loss: 0.4755 - val_acc: 0.8753\n", + "160/160 [==============================] - 0s 206us/step\n", + "Fitting with: (1440, 20000) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "560/560 [==============================] - 1s 2ms/step - loss: 0.8048 - acc: 0.6268 - val_loss: 0.6342 - val_acc: 0.8333\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7318 - acc: 0.7080 - val_loss: 0.5465 - val_acc: 0.8753\n", "Epoch 2/12\n", - "560/560 [==============================] - 0s 842us/step - loss: 0.3943 - acc: 0.9429 - val_loss: 0.5230 - val_acc: 0.8333\n", + "1007/1007 [==============================] - 1s 927us/step - loss: 0.3468 - acc: 0.9643 - val_loss: 0.4573 - val_acc: 0.8822\n", "Epoch 3/12\n", - "560/560 [==============================] - 0s 809us/step - loss: 0.2257 - acc: 0.9893 - val_loss: 0.4977 - val_acc: 0.8458\n", + "1007/1007 [==============================] - 1s 916us/step - loss: 0.2312 - acc: 0.9921 - val_loss: 0.4483 - val_acc: 0.8753\n", "Epoch 4/12\n", - "560/560 [==============================] - 0s 864us/step - loss: 0.1886 - acc: 0.9946 - val_loss: 0.4853 - val_acc: 0.8583\n", + "1007/1007 [==============================] - 1s 728us/step - loss: 0.1951 - acc: 0.9960 - val_loss: 0.4571 - val_acc: 0.8753\n", "Epoch 5/12\n", - "560/560 [==============================] - 1s 908us/step - loss: 0.1710 - acc: 0.9911 - val_loss: 0.5166 - val_acc: 0.8083\n", + "1007/1007 [==============================] - 1s 779us/step - loss: 0.1763 - acc: 0.9960 - val_loss: 0.4494 - val_acc: 0.8753\n", "Epoch 6/12\n", - "560/560 [==============================] - 0s 866us/step - loss: 0.1555 - acc: 1.0000 - val_loss: 0.4783 - val_acc: 0.8542\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1657 - acc: 0.9990 - val_loss: 0.4440 - val_acc: 0.8822\n", "Epoch 7/12\n", - "560/560 [==============================] - 0s 863us/step - loss: 0.1413 - acc: 0.9982 - val_loss: 0.4799 - val_acc: 0.8667\n", + "1007/1007 [==============================] - 1s 977us/step - loss: 0.1584 - acc: 0.9980 - val_loss: 0.4273 - val_acc: 0.8799\n", "Epoch 8/12\n", - "560/560 [==============================] - 0s 852us/step - loss: 0.1355 - acc: 0.9982 - val_loss: 0.4918 - val_acc: 0.8458\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1548 - acc: 0.9960 - val_loss: 0.4505 - val_acc: 0.8730\n", "Epoch 9/12\n", - "560/560 [==============================] - 0s 832us/step - loss: 0.1286 - acc: 0.9982 - val_loss: 0.4684 - val_acc: 0.8667\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1544 - acc: 0.9921 - val_loss: 0.4302 - val_acc: 0.8938\n", "Epoch 10/12\n", - "560/560 [==============================] - 0s 841us/step - loss: 0.1211 - acc: 0.9982 - val_loss: 0.4659 - val_acc: 0.8667\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1580 - acc: 0.9940 - val_loss: 0.4619 - val_acc: 0.8707\n", "Epoch 11/12\n", - "560/560 [==============================] - 0s 855us/step - loss: 0.1186 - acc: 1.0000 - val_loss: 0.4657 - val_acc: 0.8708\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1466 - acc: 0.9980 - val_loss: 0.4619 - val_acc: 0.8730\n", + "160/160 [==============================] - 0s 225us/step\n", + "Fitting with: (1440, 20000) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 3s 3ms/step - loss: 0.7268 - acc: 0.6941 - val_loss: 0.5627 - val_acc: 0.8776\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 837us/step - loss: 0.3848 - acc: 0.9325 - val_loss: 0.4620 - val_acc: 0.8822\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 972us/step - loss: 0.2405 - acc: 0.9881 - val_loss: 0.4566 - val_acc: 0.8868\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 873us/step - loss: 0.1955 - acc: 0.9970 - val_loss: 0.4575 - val_acc: 0.8845\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1771 - acc: 0.9940 - val_loss: 0.4582 - val_acc: 0.8915\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 920us/step - loss: 0.1674 - acc: 0.9940 - val_loss: 0.4646 - val_acc: 0.8776\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 863us/step - loss: 0.1607 - acc: 0.9940 - val_loss: 0.4594 - val_acc: 0.8730\n", + "160/160 [==============================] - 0s 219us/step\n", + "Fitting with: (1440, 20000) labels (1440,)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7634 - acc: 0.6634 - val_loss: 0.5894 - val_acc: 0.8822\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.4324 - acc: 0.9166 - val_loss: 0.4643 - val_acc: 0.8938\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.2883 - acc: 0.9742 - val_loss: 0.4305 - val_acc: 0.8776\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.2227 - acc: 0.9841 - val_loss: 0.4194 - val_acc: 0.8938\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1930 - acc: 0.9911 - val_loss: 0.4176 - val_acc: 0.8799\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1785 - acc: 0.9911 - val_loss: 0.4234 - val_acc: 0.8707\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1646 - acc: 0.9940 - val_loss: 0.4333 - val_acc: 0.8822\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1583 - acc: 0.9960 - val_loss: 0.4301 - val_acc: 0.8730\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 1s 965us/step - loss: 0.1568 - acc: 0.9940 - val_loss: 0.4599 - val_acc: 0.8707\n", + "160/160 [==============================] - 0s 195us/step\n", + "Fitting with: (1440, 20000) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 3s 3ms/step - loss: 0.7641 - acc: 0.6872 - val_loss: 0.5579 - val_acc: 0.8822\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.3955 - acc: 0.9355 - val_loss: 0.5036 - val_acc: 0.8522\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.2586 - acc: 0.9791 - val_loss: 0.4740 - val_acc: 0.8868\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.2081 - acc: 0.9921 - val_loss: 0.4843 - val_acc: 0.8845\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1824 - acc: 0.9921 - val_loss: 0.4691 - val_acc: 0.8730\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1643 - acc: 0.9970 - val_loss: 0.4535 - val_acc: 0.8707\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1504 - acc: 0.9980 - val_loss: 0.4490 - val_acc: 0.8891\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1529 - acc: 0.9950 - val_loss: 0.4477 - val_acc: 0.8753\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1434 - acc: 0.9940 - val_loss: 0.4441 - val_acc: 0.8776\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1440 - acc: 0.9950 - val_loss: 0.4579 - val_acc: 0.8707\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1499 - acc: 0.9940 - val_loss: 0.4817 - val_acc: 0.8684\n", "Epoch 12/12\n", - "560/560 [==============================] - 0s 882us/step - loss: 0.1183 - acc: 0.9982 - val_loss: 0.5181 - val_acc: 0.8417\n", - "800/800 [==============================] - 0s 211us/step\n" + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1531 - acc: 0.9940 - val_loss: 0.5193 - val_acc: 0.8661\n", + "160/160 [==============================] - 0s 230us/step\n", + "Fitting with: (1440, 20000) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 3s 3ms/step - loss: 0.7052 - acc: 0.7130 - val_loss: 0.5127 - val_acc: 0.8753\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 736us/step - loss: 0.3357 - acc: 0.9305 - val_loss: 0.4500 - val_acc: 0.8845\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 724us/step - loss: 0.2225 - acc: 0.9871 - val_loss: 0.4319 - val_acc: 0.8868\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 718us/step - loss: 0.1869 - acc: 0.9871 - val_loss: 0.4384 - val_acc: 0.8799\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 709us/step - loss: 0.1713 - acc: 0.9911 - val_loss: 0.4498 - val_acc: 0.8661\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 718us/step - loss: 0.1615 - acc: 0.9940 - val_loss: 0.4233 - val_acc: 0.8961\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 690us/step - loss: 0.1433 - acc: 0.9970 - val_loss: 0.4405 - val_acc: 0.8799\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 1s 704us/step - loss: 0.1467 - acc: 0.9921 - val_loss: 0.4298 - val_acc: 0.8868\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 1s 708us/step - loss: 0.1292 - acc: 0.9980 - val_loss: 0.4451 - val_acc: 0.8868\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 1s 715us/step - loss: 0.1257 - acc: 0.9950 - val_loss: 0.4153 - val_acc: 0.8799\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 1s 711us/step - loss: 0.1256 - acc: 0.9970 - val_loss: 0.4726 - val_acc: 0.8776\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 1s 687us/step - loss: 0.1233 - acc: 0.9970 - val_loss: 0.4450 - val_acc: 0.8637\n", + "160/160 [==============================] - 0s 161us/step\n", + "Fitting with: (1440, 20000) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7709 - acc: 0.6614 - val_loss: 0.6258 - val_acc: 0.8476\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 798us/step - loss: 0.4380 - acc: 0.9086 - val_loss: 0.4669 - val_acc: 0.8915\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 705us/step - loss: 0.2870 - acc: 0.9682 - val_loss: 0.4391 - val_acc: 0.8891\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 713us/step - loss: 0.2232 - acc: 0.9881 - val_loss: 0.4446 - val_acc: 0.8891\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 727us/step - loss: 0.1941 - acc: 0.9970 - val_loss: 0.4226 - val_acc: 0.8868\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 736us/step - loss: 0.1772 - acc: 0.9960 - val_loss: 0.4077 - val_acc: 0.8891\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 720us/step - loss: 0.1673 - acc: 0.9950 - val_loss: 0.4217 - val_acc: 0.8961\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 1s 693us/step - loss: 0.1556 - acc: 0.9970 - val_loss: 0.4280 - val_acc: 0.8868\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 1s 711us/step - loss: 0.1615 - acc: 0.9950 - val_loss: 0.4308 - val_acc: 0.8799\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 1s 697us/step - loss: 0.1561 - acc: 0.9990 - val_loss: 0.4547 - val_acc: 0.8845\n", + "160/160 [==============================] - 0s 180us/step\n" ] } ], @@ -169,7 +353,7 @@ " model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])\n", " return model\n", "\n", - "ff_bow_scores = run_cross_validate(get_ff_bow_model, bow_predictors, labels, cv=2)" + "ff_bow_scores = run_cross_validate(get_ff_bow_model, bow_predictors, labels, cv=10)" ] }, { @@ -210,265 +394,247 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ + "Fitting with: (1440, 784) labels (1440,)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 4s 4ms/step - loss: 0.8892 - acc: 0.5114 - val_loss: 0.8111 - val_acc: 0.5681\n", + "1007/1007 [==============================] - 3s 3ms/step - loss: 0.9209 - acc: 0.4826 - val_loss: 0.8241 - val_acc: 0.5058\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7886 - acc: 0.5968 - val_loss: 0.7751 - val_acc: 0.6189\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7935 - acc: 0.5283 - val_loss: 0.7679 - val_acc: 0.5820\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7564 - acc: 0.6216 - val_loss: 0.7772 - val_acc: 0.6005\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7564 - acc: 0.5591 - val_loss: 0.7637 - val_acc: 0.5912\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7434 - acc: 0.6504 - val_loss: 0.7879 - val_acc: 0.6143\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7345 - acc: 0.5809 - val_loss: 0.7491 - val_acc: 0.5843\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6938 - acc: 0.6862 - val_loss: 0.7597 - val_acc: 0.6189\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7040 - acc: 0.6207 - val_loss: 0.7282 - val_acc: 0.5543\n", "Epoch 6/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6735 - acc: 0.6951 - val_loss: 0.7771 - val_acc: 0.6328\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6990 - acc: 0.6246 - val_loss: 0.7280 - val_acc: 0.6143\n", "Epoch 7/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6624 - acc: 0.7051 - val_loss: 0.7744 - val_acc: 0.6005\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6904 - acc: 0.6157 - val_loss: 0.7217 - val_acc: 0.6212\n", "Epoch 8/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6650 - acc: 0.6892 - val_loss: 0.7679 - val_acc: 0.6374\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6781 - acc: 0.6375 - val_loss: 0.7192 - val_acc: 0.6467\n", "Epoch 9/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6427 - acc: 0.7001 - val_loss: 0.7927 - val_acc: 0.6074\n", - "160/160 [==============================] - 0s 501us/step\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6694 - acc: 0.6743 - val_loss: 0.7458 - val_acc: 0.6028\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6700 - acc: 0.6713 - val_loss: 0.7373 - val_acc: 0.6189\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6504 - acc: 0.6862 - val_loss: 0.7777 - val_acc: 0.5820\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6576 - acc: 0.6783 - val_loss: 0.7460 - val_acc: 0.6005\n", + "160/160 [==============================] - 0s 294us/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 4s 4ms/step - loss: 0.8793 - acc: 0.5174 - val_loss: 0.8131 - val_acc: 0.4850\n", + "1007/1007 [==============================] - 4s 3ms/step - loss: 0.9513 - acc: 0.5084 - val_loss: 0.8599 - val_acc: 0.5081\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7761 - acc: 0.5084 - val_loss: 0.7622 - val_acc: 0.5358\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.8459 - acc: 0.5204 - val_loss: 0.8152 - val_acc: 0.4873\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7892 - acc: 0.5521 - val_loss: 0.7899 - val_acc: 0.4850\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7894 - acc: 0.4965 - val_loss: 0.7690 - val_acc: 0.5219\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7456 - acc: 0.5462 - val_loss: 0.7498 - val_acc: 0.5196\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7602 - acc: 0.5303 - val_loss: 0.7565 - val_acc: 0.5196\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7224 - acc: 0.6097 - val_loss: 0.7618 - val_acc: 0.5312\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7510 - acc: 0.5611 - val_loss: 0.7703 - val_acc: 0.5681\n", "Epoch 6/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7098 - acc: 0.6137 - val_loss: 0.7470 - val_acc: 0.5935\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7588 - acc: 0.5879 - val_loss: 0.7839 - val_acc: 0.5312\n", "Epoch 7/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7114 - acc: 0.6385 - val_loss: 0.7482 - val_acc: 0.5889\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7422 - acc: 0.6097 - val_loss: 0.7811 - val_acc: 0.5035\n", "Epoch 8/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6977 - acc: 0.6415 - val_loss: 0.7432 - val_acc: 0.5982\n", - "Epoch 9/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6865 - acc: 0.6504 - val_loss: 0.7682 - val_acc: 0.5681\n", - "Epoch 10/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6843 - acc: 0.6395 - val_loss: 0.7978 - val_acc: 0.5612\n", - "Epoch 11/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6784 - acc: 0.6723 - val_loss: 0.7464 - val_acc: 0.6305\n", - "Epoch 12/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6675 - acc: 0.6614 - val_loss: 0.7450 - val_acc: 0.6351\n", - "160/160 [==============================] - 0s 378us/step\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7296 - acc: 0.6346 - val_loss: 0.7702 - val_acc: 0.5520\n", + "160/160 [==============================] - 0s 306us/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 4s 4ms/step - loss: 0.9339 - acc: 0.4965 - val_loss: 0.8415 - val_acc: 0.5266\n", + "1007/1007 [==============================] - 4s 4ms/step - loss: 0.9359 - acc: 0.5144 - val_loss: 0.8700 - val_acc: 0.5612\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.8042 - acc: 0.5243 - val_loss: 0.7882 - val_acc: 0.5058\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.8265 - acc: 0.6157 - val_loss: 0.8473 - val_acc: 0.5704\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7702 - acc: 0.5948 - val_loss: 0.7674 - val_acc: 0.5450\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7612 - acc: 0.6683 - val_loss: 0.8640 - val_acc: 0.5381\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7445 - acc: 0.6137 - val_loss: 0.7869 - val_acc: 0.5058\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7338 - acc: 0.6733 - val_loss: 0.8086 - val_acc: 0.6305\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7464 - acc: 0.6068 - val_loss: 0.7683 - val_acc: 0.5797\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7032 - acc: 0.6922 - val_loss: 0.8274 - val_acc: 0.5982\n", "Epoch 6/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7240 - acc: 0.6296 - val_loss: 0.7488 - val_acc: 0.5820\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6995 - acc: 0.6842 - val_loss: 0.8140 - val_acc: 0.6097\n", "Epoch 7/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7101 - acc: 0.6643 - val_loss: 0.7541 - val_acc: 0.5727\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6837 - acc: 0.7160 - val_loss: 0.8143 - val_acc: 0.6443\n", "Epoch 8/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7180 - acc: 0.6455 - val_loss: 0.7520 - val_acc: 0.6328\n", - "Epoch 9/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6834 - acc: 0.6961 - val_loss: 0.7522 - val_acc: 0.5958\n", - "Epoch 10/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6734 - acc: 0.6991 - val_loss: 0.7758 - val_acc: 0.5866\n", - "160/160 [==============================] - 0s 300us/step\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6660 - acc: 0.7398 - val_loss: 0.8751 - val_acc: 0.5704\n", + "160/160 [==============================] - 0s 263us/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 4s 4ms/step - loss: 0.8810 - acc: 0.5144 - val_loss: 0.8163 - val_acc: 0.5012\n", + "1007/1007 [==============================] - 4s 4ms/step - loss: 0.8829 - acc: 0.5204 - val_loss: 0.8026 - val_acc: 0.5520\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.8084 - acc: 0.5611 - val_loss: 0.8017 - val_acc: 0.5473\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7805 - acc: 0.5323 - val_loss: 0.7737 - val_acc: 0.5774\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7666 - acc: 0.5859 - val_loss: 0.7694 - val_acc: 0.5404\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7674 - acc: 0.5482 - val_loss: 0.7544 - val_acc: 0.5912\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7510 - acc: 0.5740 - val_loss: 0.7846 - val_acc: 0.5012\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7479 - acc: 0.5670 - val_loss: 0.7511 - val_acc: 0.5450\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7396 - acc: 0.5501 - val_loss: 0.7544 - val_acc: 0.5242\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7369 - acc: 0.5929 - val_loss: 0.7486 - val_acc: 0.5912\n", "Epoch 6/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7215 - acc: 0.5809 - val_loss: 0.7358 - val_acc: 0.5427\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7181 - acc: 0.6077 - val_loss: 0.7357 - val_acc: 0.5912\n", "Epoch 7/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7173 - acc: 0.5819 - val_loss: 0.7329 - val_acc: 0.6097\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6895 - acc: 0.6465 - val_loss: 0.7435 - val_acc: 0.5820\n", "Epoch 8/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7073 - acc: 0.6207 - val_loss: 0.7324 - val_acc: 0.5843\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6723 - acc: 0.6594 - val_loss: 0.7476 - val_acc: 0.6259\n", "Epoch 9/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7008 - acc: 0.6286 - val_loss: 0.7331 - val_acc: 0.6097\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6898 - acc: 0.6415 - val_loss: 0.7639 - val_acc: 0.6259\n", "Epoch 10/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7005 - acc: 0.6435 - val_loss: 0.7295 - val_acc: 0.5727\n", - "Epoch 11/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6953 - acc: 0.6216 - val_loss: 0.7563 - val_acc: 0.5589\n", - "Epoch 12/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6889 - acc: 0.6435 - val_loss: 0.7501 - val_acc: 0.5635\n", - "160/160 [==============================] - 0s 323us/step\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6794 - acc: 0.6693 - val_loss: 0.7798 - val_acc: 0.5797\n", + "160/160 [==============================] - 0s 335us/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 4s 4ms/step - loss: 0.8440 - acc: 0.4737 - val_loss: 0.7721 - val_acc: 0.4988\n", + "1007/1007 [==============================] - 4s 4ms/step - loss: 0.8804 - acc: 0.5114 - val_loss: 0.8206 - val_acc: 0.5173\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7584 - acc: 0.5333 - val_loss: 0.7625 - val_acc: 0.5035\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.8086 - acc: 0.4955 - val_loss: 0.7912 - val_acc: 0.5289\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7466 - acc: 0.5392 - val_loss: 0.7526 - val_acc: 0.5797\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7808 - acc: 0.5134 - val_loss: 0.7772 - val_acc: 0.5751\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7296 - acc: 0.5730 - val_loss: 0.7233 - val_acc: 0.5566\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7533 - acc: 0.5432 - val_loss: 0.7505 - val_acc: 0.5658\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7142 - acc: 0.5631 - val_loss: 0.7198 - val_acc: 0.5843\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7456 - acc: 0.5482 - val_loss: 0.7338 - val_acc: 0.5958\n", "Epoch 6/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7068 - acc: 0.5899 - val_loss: 0.7166 - val_acc: 0.6120\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6944 - acc: 0.6216 - val_loss: 0.7413 - val_acc: 0.6051\n", "Epoch 7/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7006 - acc: 0.6236 - val_loss: 0.7357 - val_acc: 0.5058\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6902 - acc: 0.6495 - val_loss: 0.7583 - val_acc: 0.5958\n", "Epoch 8/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7066 - acc: 0.5938 - val_loss: 0.7147 - val_acc: 0.6028\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6705 - acc: 0.6604 - val_loss: 0.7632 - val_acc: 0.6443\n", "Epoch 9/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6984 - acc: 0.6306 - val_loss: 0.7115 - val_acc: 0.5751\n", - "Epoch 10/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6867 - acc: 0.6187 - val_loss: 0.7070 - val_acc: 0.6490\n", - "Epoch 11/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6780 - acc: 0.6534 - val_loss: 0.7261 - val_acc: 0.6028\n", - "Epoch 12/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6897 - acc: 0.6514 - val_loss: 0.7084 - val_acc: 0.6051\n", - "160/160 [==============================] - 0s 331us/step\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6630 - acc: 0.7021 - val_loss: 0.7724 - val_acc: 0.6628\n", + "160/160 [==============================] - 0s 367us/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 4s 4ms/step - loss: 0.9152 - acc: 0.5005 - val_loss: 0.8182 - val_acc: 0.4919\n", + "1007/1007 [==============================] - 5s 5ms/step - loss: 0.8874 - acc: 0.5214 - val_loss: 0.8097 - val_acc: 0.5012\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.8013 - acc: 0.5025 - val_loss: 0.7734 - val_acc: 0.4919\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7886 - acc: 0.5144 - val_loss: 0.7705 - val_acc: 0.5012\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7586 - acc: 0.4975 - val_loss: 0.7512 - val_acc: 0.5358\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7706 - acc: 0.5015 - val_loss: 0.7667 - val_acc: 0.5035\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7373 - acc: 0.4965 - val_loss: 0.7273 - val_acc: 0.5081\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7432 - acc: 0.5730 - val_loss: 0.7355 - val_acc: 0.5358\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7221 - acc: 0.4777 - val_loss: 0.7171 - val_acc: 0.5081\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7331 - acc: 0.5571 - val_loss: 0.7236 - val_acc: 0.5612\n", "Epoch 6/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7135 - acc: 0.4965 - val_loss: 0.7101 - val_acc: 0.5081\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7277 - acc: 0.5809 - val_loss: 0.7189 - val_acc: 0.5912\n", "Epoch 7/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7077 - acc: 0.4965 - val_loss: 0.7053 - val_acc: 0.5081\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7032 - acc: 0.5799 - val_loss: 0.7121 - val_acc: 0.6166\n", "Epoch 8/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7036 - acc: 0.4995 - val_loss: 0.7020 - val_acc: 0.4919\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7005 - acc: 0.5968 - val_loss: 0.7159 - val_acc: 0.5751\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ "Epoch 9/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7007 - acc: 0.5035 - val_loss: 0.6996 - val_acc: 0.4919\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6993 - acc: 0.6127 - val_loss: 0.7485 - val_acc: 0.5150\n", "Epoch 10/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6987 - acc: 0.5035 - val_loss: 0.6980 - val_acc: 0.4919\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7053 - acc: 0.6117 - val_loss: 0.7538 - val_acc: 0.5866\n", "Epoch 11/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6973 - acc: 0.5035 - val_loss: 0.6968 - val_acc: 0.4919\n", - "Epoch 12/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6964 - acc: 0.5035 - val_loss: 0.6961 - val_acc: 0.4919\n", - "160/160 [==============================] - 0s 296us/step\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7019 - acc: 0.6256 - val_loss: 0.7142 - val_acc: 0.6097\n", + "160/160 [==============================] - 0s 492us/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 5s 5ms/step - loss: 0.8823 - acc: 0.5074 - val_loss: 0.8056 - val_acc: 0.5681\n", + "1007/1007 [==============================] - 5s 5ms/step - loss: 0.8920 - acc: 0.5055 - val_loss: 0.8175 - val_acc: 0.4873\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7783 - acc: 0.5402 - val_loss: 0.7581 - val_acc: 0.5797\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7954 - acc: 0.5154 - val_loss: 0.7949 - val_acc: 0.5242\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7892 - acc: 0.5144 - val_loss: 0.7879 - val_acc: 0.4988\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7746 - acc: 0.5174 - val_loss: 0.7670 - val_acc: 0.5035\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7573 - acc: 0.5432 - val_loss: 0.7567 - val_acc: 0.5358\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7491 - acc: 0.5283 - val_loss: 0.7389 - val_acc: 0.5473\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7561 - acc: 0.5829 - val_loss: 0.7791 - val_acc: 0.5658\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7377 - acc: 0.5323 - val_loss: 0.7341 - val_acc: 0.5219\n", "Epoch 6/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7518 - acc: 0.5521 - val_loss: 0.7613 - val_acc: 0.4896\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7330 - acc: 0.5561 - val_loss: 0.7375 - val_acc: 0.5704\n", "Epoch 7/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7306 - acc: 0.6048 - val_loss: 0.7492 - val_acc: 0.5774\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7317 - acc: 0.5124 - val_loss: 0.7280 - val_acc: 0.5012\n", "Epoch 8/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7213 - acc: 0.6137 - val_loss: 0.7645 - val_acc: 0.5173\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7158 - acc: 0.5313 - val_loss: 0.7052 - val_acc: 0.5774\n", "Epoch 9/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7238 - acc: 0.6058 - val_loss: 0.7305 - val_acc: 0.6282\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7047 - acc: 0.5998 - val_loss: 0.7271 - val_acc: 0.5450\n", "Epoch 10/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7110 - acc: 0.6097 - val_loss: 0.7268 - val_acc: 0.6028\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7022 - acc: 0.6058 - val_loss: 0.7436 - val_acc: 0.5912\n", "Epoch 11/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7180 - acc: 0.6008 - val_loss: 0.7249 - val_acc: 0.5289\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7008 - acc: 0.6296 - val_loss: 0.7374 - val_acc: 0.5658\n", "Epoch 12/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6984 - acc: 0.6336 - val_loss: 0.7228 - val_acc: 0.6166\n", - "160/160 [==============================] - 0s 440us/step\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6995 - acc: 0.6068 - val_loss: 0.7685 - val_acc: 0.5797\n", + "160/160 [==============================] - 0s 350us/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 4s 4ms/step - loss: 0.8812 - acc: 0.4826 - val_loss: 0.8145 - val_acc: 0.4850\n", + "1007/1007 [==============================] - 5s 5ms/step - loss: 0.8891 - acc: 0.5164 - val_loss: 0.8056 - val_acc: 0.4919\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.8048 - acc: 0.5233 - val_loss: 0.7943 - val_acc: 0.5035\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7825 - acc: 0.5045 - val_loss: 0.7710 - val_acc: 0.5196\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7643 - acc: 0.5283 - val_loss: 0.7436 - val_acc: 0.5704\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7575 - acc: 0.5641 - val_loss: 0.7588 - val_acc: 0.5566\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7417 - acc: 0.5750 - val_loss: 0.7334 - val_acc: 0.5751\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7454 - acc: 0.5710 - val_loss: 0.7511 - val_acc: 0.5704\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7324 - acc: 0.5581 - val_loss: 0.7337 - val_acc: 0.5958\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7276 - acc: 0.6087 - val_loss: 0.7639 - val_acc: 0.5127\n", "Epoch 6/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7260 - acc: 0.6167 - val_loss: 0.7470 - val_acc: 0.6074\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7200 - acc: 0.6197 - val_loss: 0.7439 - val_acc: 0.6212\n", "Epoch 7/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7200 - acc: 0.6127 - val_loss: 0.7555 - val_acc: 0.5242\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7128 - acc: 0.6246 - val_loss: 0.7711 - val_acc: 0.5335\n", "Epoch 8/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7075 - acc: 0.6465 - val_loss: 0.7231 - val_acc: 0.6674\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7019 - acc: 0.6385 - val_loss: 0.7634 - val_acc: 0.5473\n", "Epoch 9/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7135 - acc: 0.6346 - val_loss: 0.7582 - val_acc: 0.5958\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6985 - acc: 0.6455 - val_loss: 0.7276 - val_acc: 0.6328\n", "Epoch 10/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6950 - acc: 0.6614 - val_loss: 0.7344 - val_acc: 0.6143\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6783 - acc: 0.6683 - val_loss: 0.7609 - val_acc: 0.5797\n", "Epoch 11/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6913 - acc: 0.6723 - val_loss: 0.7260 - val_acc: 0.6282\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6801 - acc: 0.6663 - val_loss: 0.7424 - val_acc: 0.6143\n", "Epoch 12/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6762 - acc: 0.6783 - val_loss: 0.7787 - val_acc: 0.5266\n", - "160/160 [==============================] - 0s 423us/step\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6818 - acc: 0.6763 - val_loss: 0.7433 - val_acc: 0.6282\n", + "160/160 [==============================] - 0s 299us/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 5s 5ms/step - loss: 0.8875 - acc: 0.5174 - val_loss: 0.8045 - val_acc: 0.5751\n", + "1007/1007 [==============================] - 5s 5ms/step - loss: 0.9225 - acc: 0.5074 - val_loss: 0.8355 - val_acc: 0.5058\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7872 - acc: 0.5482 - val_loss: 0.7768 - val_acc: 0.5727\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.8099 - acc: 0.5462 - val_loss: 0.7916 - val_acc: 0.5912\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7536 - acc: 0.5839 - val_loss: 0.7668 - val_acc: 0.6074\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7566 - acc: 0.6197 - val_loss: 0.7677 - val_acc: 0.6074\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7258 - acc: 0.6415 - val_loss: 0.7642 - val_acc: 0.6005\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7362 - acc: 0.6296 - val_loss: 0.7969 - val_acc: 0.5335\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7147 - acc: 0.6336 - val_loss: 0.7606 - val_acc: 0.6166\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7294 - acc: 0.6326 - val_loss: 0.7467 - val_acc: 0.6467\n", "Epoch 6/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6841 - acc: 0.6852 - val_loss: 0.7601 - val_acc: 0.6236\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7109 - acc: 0.6683 - val_loss: 0.7903 - val_acc: 0.5589\n", "Epoch 7/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6749 - acc: 0.6852 - val_loss: 0.7843 - val_acc: 0.6189\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6913 - acc: 0.6753 - val_loss: 0.7964 - val_acc: 0.6236\n", "Epoch 8/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6623 - acc: 0.7080 - val_loss: 0.7861 - val_acc: 0.6028\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6834 - acc: 0.6902 - val_loss: 0.7506 - val_acc: 0.6582\n", "Epoch 9/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6589 - acc: 0.6912 - val_loss: 0.7743 - val_acc: 0.5912\n", - "Epoch 10/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6491 - acc: 0.7090 - val_loss: 0.8071 - val_acc: 0.5935\n", - "160/160 [==============================] - 0s 366us/step\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6810 - acc: 0.6931 - val_loss: 0.7542 - val_acc: 0.6536\n", + "160/160 [==============================] - 0s 293us/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 5s 5ms/step - loss: 0.9038 - acc: 0.5402 - val_loss: 0.8186 - val_acc: 0.5797\n", + "1007/1007 [==============================] - 5s 5ms/step - loss: 0.8913 - acc: 0.5362 - val_loss: 0.8622 - val_acc: 0.4919\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7911 - acc: 0.5621 - val_loss: 0.7799 - val_acc: 0.5035\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7880 - acc: 0.5849 - val_loss: 0.7844 - val_acc: 0.5889\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7673 - acc: 0.5899 - val_loss: 0.7556 - val_acc: 0.5820\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7606 - acc: 0.6028 - val_loss: 0.7727 - val_acc: 0.6005\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7397 - acc: 0.5958 - val_loss: 0.7490 - val_acc: 0.5843\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7388 - acc: 0.6346 - val_loss: 0.7571 - val_acc: 0.5958\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7373 - acc: 0.6226 - val_loss: 0.7429 - val_acc: 0.6282\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7332 - acc: 0.6435 - val_loss: 0.7682 - val_acc: 0.6282\n", "Epoch 6/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7195 - acc: 0.6276 - val_loss: 0.7544 - val_acc: 0.5612\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7039 - acc: 0.6773 - val_loss: 0.7803 - val_acc: 0.6143\n", "Epoch 7/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7004 - acc: 0.6544 - val_loss: 0.7304 - val_acc: 0.5612\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7175 - acc: 0.6673 - val_loss: 0.7860 - val_acc: 0.5866\n", "Epoch 8/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6969 - acc: 0.6544 - val_loss: 0.7300 - val_acc: 0.6189\n", - "Epoch 9/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6897 - acc: 0.6584 - val_loss: 0.7637 - val_acc: 0.5497\n", - "Epoch 10/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6793 - acc: 0.6961 - val_loss: 0.7344 - val_acc: 0.6443\n", - "Epoch 11/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6638 - acc: 0.7249 - val_loss: 0.7727 - val_acc: 0.5727\n", - "Epoch 12/12\n", - "1007/1007 [==============================] - 2s 2ms/step - loss: 0.6700 - acc: 0.7130 - val_loss: 0.7682 - val_acc: 0.5889\n", - "160/160 [==============================] - 0s 361us/step\n" + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.7136 - acc: 0.6544 - val_loss: 0.7704 - val_acc: 0.6189\n", + "160/160 [==============================] - 0s 338us/step\n" ] } ], @@ -491,15 +657,15 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Bag of words: [0.84375, 0.89375, 0.8625, 0.90625, 0.85, 0.8375, 0.875, 0.8625, 0.875, 0.8875]\n", - "Word vectors: [0.64375, 0.625, 0.59375, 0.54375, 0.6, 0.5, 0.56875, 0.53125, 0.575, 0.56875]\n" + "Bag of words: [0.875, 0.85625, 0.88125, 0.8875, 0.84375, 0.89375, 0.91875, 0.8375, 0.86875, 0.86875]\n", + "Word vectors: [0.625, 0.63125, 0.54375, 0.50625, 0.5625, 0.5875, 0.5625, 0.625, 0.54375, 0.55625]\n" ] } ], @@ -513,12 +679,12 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "metadata": {}, "outputs": [ { "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvDW2N/gAAHXRJREFUeJzt3XuYXVWZ5/Hvj0JIEIFgSh6tUCRQhYC2DXI6DNIiokCGbok2M5rYToO3tHYnRmztgdFBJjyjqD1tZyIPbfCJ2CoExBZKZUxHLooQpE5IuCQSOAaBSryUBLlIuCS888deB3ZOqmqfhNp1Tiq/z/Ocp/Zee62930pOnfesfVlLEYGZmdlI9mh1AGZm1v6cLMzMrJCThZmZFXKyMDOzQk4WZmZWyMnCzMwKOVmYmVkhJwszMyvkZGFmZoX2bHUAo2Xy5MkxderUVodhZrZLWbly5e8jorOo3rhJFlOnTqVarbY6DDOzXYqkB5up59NQZmZWyMnCzMwKOVmYmVkhJwszMyvkZGFmZoWcLMzMrJCThZmZFRo3z1mMF4sWLaJWq7U0hg0bNgDQ1dXV0jgAenp6mDdvXqvDMNvtldqzkDRD0jpJNUnnDrH9EEnXS7pL0k2SpuS2nSXp/vQ6q8w4bVubN29m8+bNrQ7DzNqIIqKcHUsdwH3AKcAA0A/Mjoi1uTrfAX4QEd+QdDLw/oj4b5IOBKp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OA17Yy4JJnIA7dIlXphT0Ha3J7tjLG78cC03x8Azk5yMc1UzVOzd14JbExyBfDhoXGFzR6rqkuS3AF8aOiYFwNfoLnT2d9V1S3ALUmeDFzUjoPfRTOl9I+2879X6jj3kTQgyXeApQNTQ2/v/T8W+ApwaDueQZKTgbuq6j19HFPaFp4+knaQJH9Mc6Oit00FgjTb2FOQJHXsKUiSOoaCJKljKEiSOoaCJKljKEiSOoaCJKnz/wHJ4W1qEkm2AgAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] @@ -550,12 +716,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Convolutional Network" + "# Convolutional Network\n", + "Now let's try this with a convolutional network. It has been shown that word vectors perform better for text classification than Bag of Words. If BoW is more accurate, it is a clear sign that we should investigate why. First we find th Bag of Words result:" ] }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -564,7 +731,7 @@ "(1600, 20000)" ] }, - "execution_count": 6, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -575,7 +742,7 @@ }, { "cell_type": "code", - "execution_count": 75, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -584,7 +751,7 @@ "(1600, 1, 20000, 1)" ] }, - "execution_count": 75, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -597,7 +764,7 @@ }, { "cell_type": "code", - "execution_count": 76, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -623,47 +790,160 @@ }, { "cell_type": "code", - "execution_count": 77, + "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Train on 560 samples, validate on 240 samples\n", + "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.4213 - acc: 0.7984 - val_loss: 0.6684 - val_acc: 0.6490\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.1208 - acc: 0.9623 - val_loss: 0.7253 - val_acc: 0.6490\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0682 - acc: 0.9851 - val_loss: 0.8658 - val_acc: 0.6467\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0390 - acc: 0.9930 - val_loss: 1.0675 - val_acc: 0.6351\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0237 - acc: 0.9970 - val_loss: 1.2412 - val_acc: 0.6074\n", + "160/160 [==============================] - 1s 7ms/step\n", + "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", + "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "560/560 [==============================] - 13s 23ms/step - loss: 0.5304 - acc: 0.7357 - val_loss: 0.6516 - val_acc: 0.6667\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.4077 - acc: 0.8004 - val_loss: 0.6328 - val_acc: 0.6674\n", "Epoch 2/12\n", - "560/560 [==============================] - 11s 19ms/step - loss: 0.1653 - acc: 0.9589 - val_loss: 0.7696 - val_acc: 0.6292\n", + "1007/1007 [==============================] - 17s 17ms/step - loss: 0.1219 - acc: 0.9593 - val_loss: 0.7979 - val_acc: 0.6397\n", "Epoch 3/12\n", - "560/560 [==============================] - 10s 18ms/step - loss: 0.0820 - acc: 0.9804 - val_loss: 0.7386 - val_acc: 0.6708\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0618 - acc: 0.9831 - val_loss: 0.9696 - val_acc: 0.6282\n", "Epoch 4/12\n", - "560/560 [==============================] - 11s 20ms/step - loss: 0.0499 - acc: 0.9946 - val_loss: 0.9655 - val_acc: 0.5708\n", + "1007/1007 [==============================] - 16s 15ms/step - loss: 0.0347 - acc: 0.9930 - val_loss: 1.0283 - val_acc: 0.6305\n", "Epoch 5/12\n", - "560/560 [==============================] - 13s 23ms/step - loss: 0.0282 - acc: 0.9964 - val_loss: 0.9687 - val_acc: 0.6167\n", - "800/800 [==============================] - 7s 8ms/step\n", - "Train on 560 samples, validate on 240 samples\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0178 - acc: 0.9990 - val_loss: 1.3042 - val_acc: 0.6259\n", + "160/160 [==============================] - 1s 7ms/step\n", + "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 21s 21ms/step - loss: 0.4190 - acc: 0.7934 - val_loss: 0.6739 - val_acc: 0.6628\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.1281 - acc: 0.9533 - val_loss: 0.7579 - val_acc: 0.6559\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0627 - acc: 0.9881 - val_loss: 0.8680 - val_acc: 0.6328\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0365 - acc: 0.9960 - val_loss: 1.0100 - val_acc: 0.6259\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0233 - acc: 0.9980 - val_loss: 1.0868 - val_acc: 0.6305\n", + "160/160 [==============================] - 1s 7ms/step\n", + "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 19s 18ms/step - loss: 0.4621 - acc: 0.7736 - val_loss: 0.6420 - val_acc: 0.6674\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.1345 - acc: 0.9543 - val_loss: 0.8997 - val_acc: 0.5912\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0684 - acc: 0.9831 - val_loss: 0.9230 - val_acc: 0.6189\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 17s 17ms/step - loss: 0.0382 - acc: 0.9901 - val_loss: 1.0172 - val_acc: 0.6120\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0209 - acc: 0.9980 - val_loss: 1.1759 - val_acc: 0.5958\n", + "160/160 [==============================] - 1s 7ms/step\n", + "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.4145 - acc: 0.7944 - val_loss: 0.6856 - val_acc: 0.6651\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.1207 - acc: 0.9643 - val_loss: 0.8025 - val_acc: 0.6351\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0659 - acc: 0.9841 - val_loss: 0.9573 - val_acc: 0.6166\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0338 - acc: 0.9960 - val_loss: 1.1232 - val_acc: 0.5982\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0187 - acc: 0.9980 - val_loss: 1.2297 - val_acc: 0.5935\n", + "160/160 [==============================] - 1s 7ms/step\n", + "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 21s 21ms/step - loss: 0.4493 - acc: 0.7696 - val_loss: 0.6431 - val_acc: 0.6490\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.1321 - acc: 0.9553 - val_loss: 0.7824 - val_acc: 0.6259\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0680 - acc: 0.9821 - val_loss: 0.8983 - val_acc: 0.6351\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0383 - acc: 0.9950 - val_loss: 1.0083 - val_acc: 0.6236\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 17s 17ms/step - loss: 0.0247 - acc: 0.9970 - val_loss: 1.2117 - val_acc: 0.6212\n", + "160/160 [==============================] - 1s 7ms/step\n", + "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.4645 - acc: 0.7766 - val_loss: 0.6182 - val_acc: 0.6744\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.1445 - acc: 0.9513 - val_loss: 0.6983 - val_acc: 0.6697\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0865 - acc: 0.9732 - val_loss: 0.9037 - val_acc: 0.6305\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0462 - acc: 0.9901 - val_loss: 0.9443 - val_acc: 0.6305\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0271 - acc: 0.9960 - val_loss: 1.1070 - val_acc: 0.6166\n", + "160/160 [==============================] - 1s 7ms/step\n", + "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", + "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "560/560 [==============================] - 13s 24ms/step - loss: 0.5012 - acc: 0.7679 - val_loss: 0.6617 - val_acc: 0.6292\n", + "1007/1007 [==============================] - 19s 19ms/step - loss: 0.4311 - acc: 0.7964 - val_loss: 0.6987 - val_acc: 0.6397\n", "Epoch 2/12\n", - "560/560 [==============================] - 9s 16ms/step - loss: 0.1410 - acc: 0.9696 - val_loss: 0.7467 - val_acc: 0.6292\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.1310 - acc: 0.9474 - val_loss: 0.8557 - val_acc: 0.6236\n", "Epoch 3/12\n", - "560/560 [==============================] - 10s 18ms/step - loss: 0.0662 - acc: 0.9893 - val_loss: 0.8208 - val_acc: 0.6292\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0670 - acc: 0.9821 - val_loss: 0.8964 - val_acc: 0.6443\n", "Epoch 4/12\n", - "560/560 [==============================] - 10s 18ms/step - loss: 0.0360 - acc: 0.9982 - val_loss: 0.9100 - val_acc: 0.6333\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0372 - acc: 0.9930 - val_loss: 0.9940 - val_acc: 0.6467\n", "Epoch 5/12\n", - "560/560 [==============================] - 12s 22ms/step - loss: 0.0225 - acc: 1.0000 - val_loss: 0.9885 - val_acc: 0.6208\n", - "800/800 [==============================] - 6s 7ms/step\n" + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0199 - acc: 0.9990 - val_loss: 1.0933 - val_acc: 0.6397\n", + "160/160 [==============================] - 2s 10ms/step\n", + "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 19s 19ms/step - loss: 0.4104 - acc: 0.8083 - val_loss: 0.6762 - val_acc: 0.6467\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.1231 - acc: 0.9633 - val_loss: 0.8035 - val_acc: 0.6397\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0671 - acc: 0.9831 - val_loss: 0.8995 - val_acc: 0.6351\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0381 - acc: 0.9930 - val_loss: 1.0077 - val_acc: 0.6166\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0202 - acc: 1.0000 - val_loss: 1.1330 - val_acc: 0.6143\n", + "160/160 [==============================] - 1s 7ms/step\n", + "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 19s 19ms/step - loss: 0.4309 - acc: 0.7855 - val_loss: 0.6789 - val_acc: 0.6443\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.1241 - acc: 0.9613 - val_loss: 0.8183 - val_acc: 0.6120\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 17s 17ms/step - loss: 0.0696 - acc: 0.9811 - val_loss: 0.9625 - val_acc: 0.6282\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0429 - acc: 0.9901 - val_loss: 1.2855 - val_acc: 0.5982\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0268 - acc: 0.9970 - val_loss: 1.2844 - val_acc: 0.5982\n", + "160/160 [==============================] - 1s 8ms/step\n" ] } ], "source": [ - "conv_bow_scores = run_cross_validate(get_conv_bow_model, convolutional_data, labels, cv=2, categorical=True)" + "conv_bow_scores = run_cross_validate(get_conv_bow_model, convolutional_data, labels, cv=10, categorical=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "And our word vector result:" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ @@ -677,7 +957,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -687,7 +967,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 16, "metadata": {}, "outputs": [], "source": [ @@ -698,7 +978,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -715,7 +995,7 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 18, "metadata": {}, "outputs": [], "source": [ @@ -741,62 +1021,31 @@ }, { "cell_type": "code", - "execution_count": 70, + "execution_count": 20, "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "Train on 560 samples, validate on 240 samples\n", - "Epoch 1/12\n", - "560/560 [==============================] - 5s 9ms/step - loss: 0.7025 - acc: 0.4911 - val_loss: 0.6932 - val_acc: 0.4917\n", - "Epoch 2/12\n", - "560/560 [==============================] - 3s 5ms/step - loss: 0.6923 - acc: 0.5429 - val_loss: 0.6993 - val_acc: 0.4625\n", - "Epoch 3/12\n", - "560/560 [==============================] - 3s 5ms/step - loss: 0.6823 - acc: 0.5571 - val_loss: 0.6747 - val_acc: 0.5792\n", - "Epoch 4/12\n", - "560/560 [==============================] - 3s 5ms/step - loss: 0.6699 - acc: 0.6304 - val_loss: 0.6840 - val_acc: 0.5833\n", - "Epoch 5/12\n", - "560/560 [==============================] - 3s 5ms/step - loss: 0.6463 - acc: 0.6589 - val_loss: 0.6832 - val_acc: 0.5667\n", - "Epoch 6/12\n", - "560/560 [==============================] - 3s 5ms/step - loss: 0.6338 - acc: 0.6393 - val_loss: 0.6863 - val_acc: 0.5875\n", - "Epoch 7/12\n", - "560/560 [==============================] - 3s 5ms/step - loss: 0.6156 - acc: 0.6821 - val_loss: 0.6981 - val_acc: 0.5667\n", - "800/800 [==============================] - 1s 2ms/step\n", - "Train on 560 samples, validate on 240 samples\n", - "Epoch 1/12\n", - "560/560 [==============================] - 5s 9ms/step - loss: 0.6998 - acc: 0.4714 - val_loss: 0.6930 - val_acc: 0.5208\n", - "Epoch 2/12\n", - "560/560 [==============================] - 3s 5ms/step - loss: 0.6932 - acc: 0.5018 - val_loss: 0.6941 - val_acc: 0.4875\n", - "Epoch 3/12\n", - "560/560 [==============================] - 3s 5ms/step - loss: 0.6897 - acc: 0.5554 - val_loss: 0.7010 - val_acc: 0.4542\n", - "Epoch 4/12\n", - "560/560 [==============================] - 3s 5ms/step - loss: 0.6855 - acc: 0.5643 - val_loss: 0.7088 - val_acc: 0.4542\n", - "Epoch 5/12\n", - "560/560 [==============================] - 4s 6ms/step - loss: 0.6791 - acc: 0.5750 - val_loss: 0.7192 - val_acc: 0.4542\n", - "800/800 [==============================] - 2s 2ms/step\n" + "ename": "MemoryError", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mMemoryError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mconv_wv_scores\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mrun_cross_validate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mget_conv_wv_model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvectorized_reviews\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcv\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcategorical\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m\u001b[0m in \u001b[0;36mrun_cross_validate\u001b[0;34m(get_model, X, y, cv, categorical, add_target_dim)\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mtrain_indices\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtest_indices\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mskfSplitter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mX\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 8\u001b[0;31m \u001b[0mtraining_X\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mX\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mx\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mtrain_indices\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 9\u001b[0m \u001b[0mtraining_y\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0my\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mx\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mtrain_indices\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0mtest_X\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mX\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mx\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mtest_indices\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mMemoryError\u001b[0m: " ] } ], "source": [ - "conv_wv_scores = run_cross_validate(get_conv_wv_model, vectorized_reviews, labels, cv=2, categorical=True)" + "conv_wv_scores = run_cross_validate(get_conv_wv_model, vectorized_reviews, labels, cv=10, categorical=True)" ] }, { "cell_type": "code", - "execution_count": 78, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Bag of words: [0.82125, 0.7775]\n", - "Word vectors: [0.48, 0.51625]\n" - ] - } - ], + "outputs": [], "source": [ "print (\"Bag of words: \", conv_bow_scores['accuracies'])\n", "print (\"Word vectors: \", conv_wv_scores['accuracies'])\n", @@ -807,27 +1056,162 @@ }, { "cell_type": "code", - "execution_count": 79, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvDW2N/gAAGp1JREFUeJzt3X20XXV95/H3h4s8WIpiSV0aiEETBduxUG5xkGqxLZixVew4o9B2FWw1fQLRmdqRaUcdnFasnVpGWY7Iora2gk9VY2WkQaRVHkpuJIpEkGsUSWI1EqogQUz4zh97Xzi5uck+geyck+T9Wuuue/bev733N8nJ+ZzffvjtVBWSJO3IfqMuQJI0/gwLSVInw0KS1MmwkCR1MiwkSZ0MC0lSJ8NCktTJsJAkdTIsJEmd9h91AbvK4YcfXgsXLhx1GZK0R1m5cuV3qmpeV7u9JiwWLlzI1NTUqMuQpD1KkjuGaedhKElSJ8NCktTJsJAkdTIsJEmdDAtJUifDQpLUybCQJHXaa+6z2Fu84x3vYHp6eqQ1rFu3DoD58+ePtA6ARYsWcc4554y6DGmfZ1hoG5s2bRp1CZLGjGExZsbhW/S5554LwIUXXjjiSiSNC89ZSJI6GRaSpE6GhSSpk2EhSerkCe7WOFyyOi5m/h5mTnTv67x8VzIsHjI9Pc2qL32ZLY99wqhLGbn9HigAVq751ogrGb2J+zaOugRpLBgWA7Y89glsOvqFoy5DY+TgW68YdQnSWOj1nEWSJUluSzKd5PVzLF+Q5DNJbkryxSQvHFh2XrvebUle0GedkqQd661nkWQCuAg4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/kAzXv5DmDwSjxmtV2d5D5gZVUN9k5+DXhXkj8GHkPTA/kCcC5wcZLfonlP/W5VXZ/k2iRfonl//eEwddL0ot6W5EHgh7QhtC/xDu69SJJDqureJI+l+ca0tKo+P+q6JO357FnsXS5O8kya8wl/bVBI2lXsWUiSOnmCW5LUybCQJHUyLCRJnQwL7fOSXNfdaqe3uTDJr+7sMmlcGRba51VVH8O/LwS2Fwg7WiaNJcNC+7wk97a/T05yTZIPt6Pi/l07HhdJvt6OC3Rj+7Oonf/eJP9p9rZoRjd9bju66Wtn7XKrZe1IqccObOPaJM9K82yH9yW5OsntSV410OZ1SVakGT34f/bzNyM9zLCQtnYc8BrgmcBTaUZSnfG9qjoBeCfwlx3beT3w2Xasord3LLuEZtRfkjwdOLCqvti2fRbN0C0nAm9I8uQkp9KM2nsCcCxwfJLnIfXIsJC2dmNVra3mGQqraA4Zzbhs4PeJs1d8FD4E/HKSx9AMG//egWUzIwl/h2YolROAU9ufm4DP04yhtXgX1iNtwzu4pa39YOD1Frb+P1JzvN5M+6WrPWR1wM7usKruS7IcOA14Gc2zSeba58x0gLdU1bt3dl/SI2XPQhreywd+z4yu+nWaoauh+bB/TPt69uimg+Zadgnwf4AV7SiuM05rRxL+MZoh4VcAVwK/2Y4uTJL5efgxt1Iv7FlIwzuwHX13Px4eWv09wMeT3EgzJPbMaKhfBDYn+QLw3lnnLbZZVlUrk3wP+KtZ+7wR+CTNk+neXFXrgfVJjgGub8+/30szdPe3d/GfV3qIY0NJQ0jydWByYAjuXb39JwPXAEe350tI8ibg3qr68z72Ke0MD0NJI5bkN2geHvVHM0EhjRt7FpKkTvYsJEmdDAtJUifDQpLUybCQJHUyLCRJnQwLSVKn/w8obWijne89IwAAAABJRU5ErkJggg==\n", - "text/plain": [ - "
" - ] - }, - "metadata": { - "needs_background": "light" - }, - "output_type": "display_data" - } - ], + "outputs": [], + "source": [ + "boxplot(x='input type', y='accuracy', data=conv_scores_data_frame)\n", + "plt.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Just as before our results are alarming. We need the reasons why this can occur, it may be that we have made a mistake in generating our word vectors" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Recurrent Neural Networks\n", + "Let's also try this same experiment for Recurrent Neural Networks. We will use LSTM since this is known to be a good option for text classification. First with Bag of Words:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "batches = 1600\n", + "rnn_bow_data = np.array(np.split(bow_predictors, batches))\n", + "rnn_bow_data.shape" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "rnn_bow_targets = np.array([[x] for x in labels])\n", + "rnn_bow_targets.shape" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def get_rnn_bow_model():\n", + " model = Sequential([\n", + " LSTM(8, input_shape=(1, 20000)),\n", + " Dense(1, activation='sigmoid')\n", + " ])\n", + " model.compile(\n", + " loss='binary_crossentropy',\n", + " optimizer='adam',\n", + " metrics=['accuracy'])\n", + " return model\n", + "\n", + "rnn_bow_scores = run_cross_validate(get_rnn_bow_model, rnn_bow_data, rnn_bow_targets, cv=10)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "And with Word Vectors:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def get_rnn_wv_model():\n", + " model = Sequential([\n", + " Embedding(corpus_vocab_size, embedding_length, weights=[embedding_matrix], input_length=max_sequence_length,\n", + " trainable=False),\n", + " LSTM(8),\n", + " Dense(1, activation='sigmoid')\n", + " ])\n", + " model.compile(\n", + " loss='binary_crossentropy',\n", + " optimizer='adam',\n", + " metrics=['accuracy'])\n", + " return model\n", + "\n", + "rnn_wv_scores = run_cross_validate(get_rnn_wv_model, predictors_sequences, labels, cv=10)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print (\"Bag of words: \", rnn_bow_scores['accuracies'])\n", + "print (\"Word vectors: \", rnn_wv_scores['accuracies'])\n", + "\n", + "rnn_scores_entries =[('Bag of Words', x) for x in rnn_bow_scores['accuracies']] + [('Word Vectors', x) for x in rnn_wv_scores['accuracies']]\n", + "rnn_scores_data_frame = DataFrame(rnn_scores_entries, columns=['input type', 'accuracy'])" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ + "boxplot(x='input type', y='accuracy', data=rnn_scores_data_frame)\n", + "plt.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Comparison of all models:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "bow_scores = []\n", + "for score in ff_bow_scores['accuracies']:\n", + " bow_scores.append(\"Feed-Forward\", score)\n", + "for score in conv_bow_scores['accuracies']:\n", + " bow_scores.append(\"Convolutional\", score)\n", + "for score in rnn_bow_scores['accuracies']:\n", + " bow_scores.append(\"Recurrent\", score)\n", + " \n", "boxplot(x='input type', y='accuracy', data=conv_scores_data_frame)\n", "plt.show()" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "wv_scores = []\n", + "for score in ff_wv_scores['accuracies']:\n", + " wv_scores.append(\"Feed-Forward\", score)\n", + "for score in conv_wv_scores['accuracies']:\n", + " wv_scores.append(\"Convolutional\", score)\n", + "for score in rnn_wv_scores['accuracies']:\n", + " bow_scores.append(\"Recurrent\", score)" + ] + }, { "cell_type": "code", "execution_count": null, From fed38b6a9af5c96503f54bc99fa18e047a09ac9e Mon Sep 17 00:00:00 2001 From: Stefan Kennedy Date: Mon, 10 Dec 2018 00:25:07 +0000 Subject: [PATCH 3/5] Add Convolutional Network comparison --- LUCAS/notebooks/neuralnet_comparison.ipynb | 292 +++++++++++++++------ 1 file changed, 209 insertions(+), 83 deletions(-) diff --git a/LUCAS/notebooks/neuralnet_comparison.ipynb b/LUCAS/notebooks/neuralnet_comparison.ipynb index cc0bfef..241669e 100644 --- a/LUCAS/notebooks/neuralnet_comparison.ipynb +++ b/LUCAS/notebooks/neuralnet_comparison.ipynb @@ -365,7 +365,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -377,7 +377,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ @@ -722,7 +722,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -731,7 +731,7 @@ "(1600, 20000)" ] }, - "execution_count": 10, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -742,7 +742,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -751,7 +751,7 @@ "(1600, 1, 20000, 1)" ] }, - "execution_count": 11, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -764,7 +764,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 6, "metadata": {}, "outputs": [], "source": [ @@ -790,7 +790,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -800,133 +800,139 @@ "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 18s 18ms/step - loss: 0.4213 - acc: 0.7984 - val_loss: 0.6684 - val_acc: 0.6490\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.4104 - acc: 0.8133 - val_loss: 0.6877 - val_acc: 0.6420\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.1208 - acc: 0.9623 - val_loss: 0.7253 - val_acc: 0.6490\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.1270 - acc: 0.9563 - val_loss: 0.7839 - val_acc: 0.6305\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0682 - acc: 0.9851 - val_loss: 0.8658 - val_acc: 0.6467\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0611 - acc: 0.9891 - val_loss: 0.9292 - val_acc: 0.6120\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0390 - acc: 0.9930 - val_loss: 1.0675 - val_acc: 0.6351\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0412 - acc: 0.9911 - val_loss: 1.1034 - val_acc: 0.5889\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0237 - acc: 0.9970 - val_loss: 1.2412 - val_acc: 0.6074\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0321 - acc: 0.9930 - val_loss: 1.1769 - val_acc: 0.5912\n", "160/160 [==============================] - 1s 7ms/step\n", "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 18s 18ms/step - loss: 0.4077 - acc: 0.8004 - val_loss: 0.6328 - val_acc: 0.6674\n", + "1007/1007 [==============================] - 16s 15ms/step - loss: 0.4176 - acc: 0.8064 - val_loss: 0.7610 - val_acc: 0.6189\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 17s 17ms/step - loss: 0.1219 - acc: 0.9593 - val_loss: 0.7979 - val_acc: 0.6397\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.1339 - acc: 0.9494 - val_loss: 0.8414 - val_acc: 0.6328\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0618 - acc: 0.9831 - val_loss: 0.9696 - val_acc: 0.6282\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0693 - acc: 0.9861 - val_loss: 0.9440 - val_acc: 0.6212\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 16s 15ms/step - loss: 0.0347 - acc: 0.9930 - val_loss: 1.0283 - val_acc: 0.6305\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0391 - acc: 0.9940 - val_loss: 1.1303 - val_acc: 0.6028\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0178 - acc: 0.9990 - val_loss: 1.3042 - val_acc: 0.6259\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0212 - acc: 0.9970 - val_loss: 1.2155 - val_acc: 0.6143\n", "160/160 [==============================] - 1s 7ms/step\n", "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 21s 21ms/step - loss: 0.4190 - acc: 0.7934 - val_loss: 0.6739 - val_acc: 0.6628\n", + "1007/1007 [==============================] - 16s 15ms/step - loss: 0.4728 - acc: 0.7716 - val_loss: 0.6186 - val_acc: 0.6674\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.1281 - acc: 0.9533 - val_loss: 0.7579 - val_acc: 0.6559\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.1369 - acc: 0.9503 - val_loss: 0.6578 - val_acc: 0.6697\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0627 - acc: 0.9881 - val_loss: 0.8680 - val_acc: 0.6328\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0724 - acc: 0.9821 - val_loss: 0.9531 - val_acc: 0.6351\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0365 - acc: 0.9960 - val_loss: 1.0100 - val_acc: 0.6259\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0431 - acc: 0.9940 - val_loss: 0.8991 - val_acc: 0.6328\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0233 - acc: 0.9980 - val_loss: 1.0868 - val_acc: 0.6305\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0247 - acc: 0.9970 - val_loss: 1.0405 - val_acc: 0.6212\n", "160/160 [==============================] - 1s 7ms/step\n", "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 19s 18ms/step - loss: 0.4621 - acc: 0.7736 - val_loss: 0.6420 - val_acc: 0.6674\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.3978 - acc: 0.8113 - val_loss: 0.6811 - val_acc: 0.6328\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.1345 - acc: 0.9543 - val_loss: 0.8997 - val_acc: 0.5912\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.1221 - acc: 0.9623 - val_loss: 0.7995 - val_acc: 0.6305\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0684 - acc: 0.9831 - val_loss: 0.9230 - val_acc: 0.6189\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0695 - acc: 0.9801 - val_loss: 0.9517 - val_acc: 0.6051\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 17s 17ms/step - loss: 0.0382 - acc: 0.9901 - val_loss: 1.0172 - val_acc: 0.6120\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0386 - acc: 0.9930 - val_loss: 1.0806 - val_acc: 0.6212\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0209 - acc: 0.9980 - val_loss: 1.1759 - val_acc: 0.5958\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0240 - acc: 0.9950 - val_loss: 1.1951 - val_acc: 0.6120\n", "160/160 [==============================] - 1s 7ms/step\n", "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 18s 18ms/step - loss: 0.4145 - acc: 0.7944 - val_loss: 0.6856 - val_acc: 0.6651\n", + "1007/1007 [==============================] - 17s 16ms/step - loss: 0.4336 - acc: 0.7786 - val_loss: 0.6395 - val_acc: 0.6697\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 18s 18ms/step - loss: 0.1207 - acc: 0.9643 - val_loss: 0.8025 - val_acc: 0.6351\n", + "1007/1007 [==============================] - 21s 21ms/step - loss: 0.1405 - acc: 0.9434 - val_loss: 0.7227 - val_acc: 0.6582\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0659 - acc: 0.9841 - val_loss: 0.9573 - val_acc: 0.6166\n", + "1007/1007 [==============================] - 21s 21ms/step - loss: 0.0678 - acc: 0.9871 - val_loss: 0.8461 - val_acc: 0.6536\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0338 - acc: 0.9960 - val_loss: 1.1232 - val_acc: 0.5982\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0361 - acc: 0.9950 - val_loss: 1.0363 - val_acc: 0.6236\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0187 - acc: 0.9980 - val_loss: 1.2297 - val_acc: 0.5935\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0234 - acc: 0.9960 - val_loss: 1.1762 - val_acc: 0.6143\n", "160/160 [==============================] - 1s 7ms/step\n", "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 21s 21ms/step - loss: 0.4493 - acc: 0.7696 - val_loss: 0.6431 - val_acc: 0.6490\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.4447 - acc: 0.7805 - val_loss: 0.6711 - val_acc: 0.6282\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 16s 16ms/step - loss: 0.1321 - acc: 0.9553 - val_loss: 0.7824 - val_acc: 0.6259\n", + "1007/1007 [==============================] - 19s 19ms/step - loss: 0.1323 - acc: 0.9573 - val_loss: 0.7492 - val_acc: 0.6351\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0680 - acc: 0.9821 - val_loss: 0.8983 - val_acc: 0.6351\n", + "1007/1007 [==============================] - 17s 16ms/step - loss: 0.0769 - acc: 0.9782 - val_loss: 0.9064 - val_acc: 0.6189\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0383 - acc: 0.9950 - val_loss: 1.0083 - val_acc: 0.6236\n", + "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0408 - acc: 0.9930 - val_loss: 1.0671 - val_acc: 0.6028\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 17s 17ms/step - loss: 0.0247 - acc: 0.9970 - val_loss: 1.2117 - val_acc: 0.6212\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0253 - acc: 1.0000 - val_loss: 1.1682 - val_acc: 0.6120\n", "160/160 [==============================] - 1s 7ms/step\n", "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 18s 18ms/step - loss: 0.4645 - acc: 0.7766 - val_loss: 0.6182 - val_acc: 0.6744\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.4321 - acc: 0.7776 - val_loss: 0.6643 - val_acc: 0.6467\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.1445 - acc: 0.9513 - val_loss: 0.6983 - val_acc: 0.6697\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.1234 - acc: 0.9623 - val_loss: 0.8116 - val_acc: 0.6282\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0865 - acc: 0.9732 - val_loss: 0.9037 - val_acc: 0.6305\n", + "1007/1007 [==============================] - 19s 19ms/step - loss: 0.0605 - acc: 0.9881 - val_loss: 0.9559 - val_acc: 0.6097\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0462 - acc: 0.9901 - val_loss: 0.9443 - val_acc: 0.6305\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0384 - acc: 0.9930 - val_loss: 1.0549 - val_acc: 0.6120\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0271 - acc: 0.9960 - val_loss: 1.1070 - val_acc: 0.6166\n", - "160/160 [==============================] - 1s 7ms/step\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0208 - acc: 0.9990 - val_loss: 1.1966 - val_acc: 0.6074\n", + "160/160 [==============================] - 1s 8ms/step\n", "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 19s 19ms/step - loss: 0.4311 - acc: 0.7964 - val_loss: 0.6987 - val_acc: 0.6397\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.4149 - acc: 0.8054 - val_loss: 0.7225 - val_acc: 0.6490\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 18s 18ms/step - loss: 0.1310 - acc: 0.9474 - val_loss: 0.8557 - val_acc: 0.6236\n", + "1007/1007 [==============================] - 18s 17ms/step - loss: 0.1227 - acc: 0.9682 - val_loss: 0.7774 - val_acc: 0.6490\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0670 - acc: 0.9821 - val_loss: 0.8964 - val_acc: 0.6443\n", + "1007/1007 [==============================] - 20s 20ms/step - loss: 0.0639 - acc: 0.9841 - val_loss: 0.9796 - val_acc: 0.6166\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0372 - acc: 0.9930 - val_loss: 0.9940 - val_acc: 0.6467\n", + "1007/1007 [==============================] - 19s 19ms/step - loss: 0.0328 - acc: 0.9950 - val_loss: 1.0511 - val_acc: 0.6305\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0199 - acc: 0.9990 - val_loss: 1.0933 - val_acc: 0.6397\n", - "160/160 [==============================] - 2s 10ms/step\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0191 - acc: 0.9980 - val_loss: 1.1928 - val_acc: 0.6236\n", + "160/160 [==============================] - 1s 7ms/step\n", "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 19s 19ms/step - loss: 0.4104 - acc: 0.8083 - val_loss: 0.6762 - val_acc: 0.6467\n", + "1007/1007 [==============================] - 17s 16ms/step - loss: 0.4449 - acc: 0.7954 - val_loss: 0.6790 - val_acc: 0.6397\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.1231 - acc: 0.9633 - val_loss: 0.8035 - val_acc: 0.6397\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.1311 - acc: 0.9543 - val_loss: 0.7680 - val_acc: 0.6467\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0671 - acc: 0.9831 - val_loss: 0.8995 - val_acc: 0.6351\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0736 - acc: 0.9811 - val_loss: 0.9357 - val_acc: 0.6467\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0381 - acc: 0.9930 - val_loss: 1.0077 - val_acc: 0.6166\n", + "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0440 - acc: 0.9901 - val_loss: 1.1653 - val_acc: 0.6005\n", "Epoch 5/12\n", - "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0202 - acc: 1.0000 - val_loss: 1.1330 - val_acc: 0.6143\n", - "160/160 [==============================] - 1s 7ms/step\n", + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0265 - acc: 0.9960 - val_loss: 1.1660 - val_acc: 0.6259\n", + "160/160 [==============================] - 2s 11ms/step\n", "Fitting with: (1440, 1, 20000, 1) labels (1440, 2)\n", "Train on 1007 samples, validate on 433 samples\n", "Epoch 1/12\n", - "1007/1007 [==============================] - 19s 19ms/step - loss: 0.4309 - acc: 0.7855 - val_loss: 0.6789 - val_acc: 0.6443\n", + "1007/1007 [==============================] - 21s 21ms/step - loss: 0.4229 - acc: 0.8024 - val_loss: 0.6728 - val_acc: 0.6605\n", "Epoch 2/12\n", - "1007/1007 [==============================] - 16s 16ms/step - loss: 0.1241 - acc: 0.9613 - val_loss: 0.8183 - val_acc: 0.6120\n", + "1007/1007 [==============================] - 20s 20ms/step - loss: 0.1182 - acc: 0.9583 - val_loss: 0.7547 - val_acc: 0.6467\n", "Epoch 3/12\n", - "1007/1007 [==============================] - 17s 17ms/step - loss: 0.0696 - acc: 0.9811 - val_loss: 0.9625 - val_acc: 0.6282\n", + "1007/1007 [==============================] - 17s 17ms/step - loss: 0.0661 - acc: 0.9791 - val_loss: 0.9196 - val_acc: 0.6490\n", "Epoch 4/12\n", - "1007/1007 [==============================] - 15s 15ms/step - loss: 0.0429 - acc: 0.9901 - val_loss: 1.2855 - val_acc: 0.5982\n", - "Epoch 5/12\n", - "1007/1007 [==============================] - 16s 16ms/step - loss: 0.0268 - acc: 0.9970 - val_loss: 1.2844 - val_acc: 0.5982\n", - "160/160 [==============================] - 1s 8ms/step\n" + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0412 - acc: 0.9901 - val_loss: 1.1109 - val_acc: 0.6120\n", + "Epoch 5/12\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0232 - acc: 0.9970 - val_loss: 1.1591 - val_acc: 0.6305\n", + "160/160 [==============================] - 1s 7ms/step\n" ] } ], @@ -934,6 +940,26 @@ "conv_bow_scores = run_cross_validate(get_conv_bow_model, convolutional_data, labels, cv=10, categorical=True)" ] }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[0.84375, 0.86875, 0.7625, 0.825, 0.86875, 0.85, 0.8, 0.8375, 0.8375, 0.78125]" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "conv_bow_scores['accuracies']" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -943,7 +969,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 11, "metadata": {}, "outputs": [], "source": [ @@ -957,7 +983,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 12, "metadata": {}, "outputs": [], "source": [ @@ -967,7 +993,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -978,7 +1004,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -995,7 +1021,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -1021,31 +1047,118 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 16, "metadata": {}, "outputs": [ { - "ename": "MemoryError", - "evalue": "", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mMemoryError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mconv_wv_scores\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mrun_cross_validate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mget_conv_wv_model\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvectorized_reviews\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcv\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m10\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcategorical\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m\u001b[0m in \u001b[0;36mrun_cross_validate\u001b[0;34m(get_model, X, y, cv, categorical, add_target_dim)\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mtrain_indices\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtest_indices\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mskfSplitter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msplit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mX\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 8\u001b[0;31m \u001b[0mtraining_X\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mX\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mx\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mtrain_indices\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 9\u001b[0m \u001b[0mtraining_y\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0my\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mx\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mtrain_indices\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[0mtest_X\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marray\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mX\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mx\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mtest_indices\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mMemoryError\u001b[0m: " + "name": "stdout", + "output_type": "stream", + "text": [ + "Fitting with: (1332, 1, 381, 100) labels (1332, 2)\n", + "Train on 932 samples, validate on 400 samples\n", + "Epoch 1/12\n", + "932/932 [==============================] - 6s 7ms/step - loss: 0.6975 - acc: 0.4764 - val_loss: 0.6934 - val_acc: 0.4475\n", + "Epoch 2/12\n", + "932/932 [==============================] - 5s 5ms/step - loss: 0.6915 - acc: 0.5300 - val_loss: 0.6942 - val_acc: 0.5025\n", + "Epoch 3/12\n", + "932/932 [==============================] - 4s 5ms/step - loss: 0.6849 - acc: 0.5590 - val_loss: 0.6958 - val_acc: 0.4925\n", + "Epoch 4/12\n", + "932/932 [==============================] - 4s 5ms/step - loss: 0.6753 - acc: 0.5869 - val_loss: 0.7030 - val_acc: 0.5225\n", + "Epoch 5/12\n", + "932/932 [==============================] - 4s 5ms/step - loss: 0.6682 - acc: 0.5912 - val_loss: 0.7110 - val_acc: 0.5000\n", + "268/268 [==============================] - 1s 2ms/step\n", + "Fitting with: (1332, 1, 381, 100) labels (1332, 2)\n", + "Train on 932 samples, validate on 400 samples\n", + "Epoch 1/12\n", + "932/932 [==============================] - 6s 7ms/step - loss: 0.6989 - acc: 0.4775 - val_loss: 0.6931 - val_acc: 0.4975\n", + "Epoch 2/12\n", + "932/932 [==============================] - 5s 5ms/step - loss: 0.6932 - acc: 0.4710 - val_loss: 0.6932 - val_acc: 0.4975\n", + "Epoch 3/12\n", + "932/932 [==============================] - 5s 5ms/step - loss: 0.6932 - acc: 0.5011 - val_loss: 0.6932 - val_acc: 0.4975\n", + "Epoch 4/12\n", + "932/932 [==============================] - 5s 5ms/step - loss: 0.6934 - acc: 0.4775 - val_loss: 0.6932 - val_acc: 0.4975\n", + "Epoch 5/12\n", + "932/932 [==============================] - 5s 5ms/step - loss: 0.6932 - acc: 0.5011 - val_loss: 0.6932 - val_acc: 0.4975\n", + "268/268 [==============================] - 1s 2ms/step\n", + "Fitting with: (1334, 1, 381, 100) labels (1334, 2)\n", + "Train on 933 samples, validate on 401 samples\n", + "Epoch 1/12\n", + "933/933 [==============================] - 6s 7ms/step - loss: 0.6957 - acc: 0.4759 - val_loss: 0.6931 - val_acc: 0.4938\n", + "Epoch 2/12\n", + "933/933 [==============================] - 5s 6ms/step - loss: 0.6919 - acc: 0.5252 - val_loss: 0.6923 - val_acc: 0.5037\n", + "Epoch 3/12\n", + "933/933 [==============================] - 5s 5ms/step - loss: 0.6842 - acc: 0.5659 - val_loss: 0.6956 - val_acc: 0.5012\n", + "Epoch 4/12\n", + "933/933 [==============================] - 5s 6ms/step - loss: 0.6716 - acc: 0.5884 - val_loss: 0.6993 - val_acc: 0.5112\n", + "Epoch 5/12\n", + "933/933 [==============================] - 5s 5ms/step - loss: 0.6600 - acc: 0.5949 - val_loss: 0.7082 - val_acc: 0.5187\n", + "Epoch 6/12\n", + "933/933 [==============================] - 5s 5ms/step - loss: 0.6565 - acc: 0.5949 - val_loss: 0.7069 - val_acc: 0.5187\n", + "266/266 [==============================] - 1s 3ms/step\n", + "Fitting with: (1334, 1, 381, 100) labels (1334, 2)\n", + "Train on 933 samples, validate on 401 samples\n", + "Epoch 1/12\n", + "933/933 [==============================] - 6s 6ms/step - loss: 0.6965 - acc: 0.4952 - val_loss: 0.6932 - val_acc: 0.5137\n", + "Epoch 2/12\n", + "933/933 [==============================] - 4s 5ms/step - loss: 0.6920 - acc: 0.5359 - val_loss: 0.6932 - val_acc: 0.5212\n", + "Epoch 3/12\n", + "933/933 [==============================] - 4s 5ms/step - loss: 0.6865 - acc: 0.5627 - val_loss: 0.6960 - val_acc: 0.5237\n", + "Epoch 4/12\n", + "933/933 [==============================] - 4s 5ms/step - loss: 0.6786 - acc: 0.5756 - val_loss: 0.6971 - val_acc: 0.5287\n", + "Epoch 5/12\n", + "933/933 [==============================] - 4s 5ms/step - loss: 0.6761 - acc: 0.5713 - val_loss: 0.7037 - val_acc: 0.5087\n", + "266/266 [==============================] - 1s 2ms/step\n", + "Fitting with: (1334, 1, 381, 100) labels (1334, 2)\n", + "Train on 933 samples, validate on 401 samples\n", + "Epoch 1/12\n", + "933/933 [==============================] - 6s 7ms/step - loss: 0.6979 - acc: 0.5091 - val_loss: 0.6924 - val_acc: 0.5112\n", + "Epoch 2/12\n", + "933/933 [==============================] - 5s 5ms/step - loss: 0.6928 - acc: 0.5177 - val_loss: 0.6922 - val_acc: 0.5287\n", + "Epoch 3/12\n", + "933/933 [==============================] - 4s 5ms/step - loss: 0.6823 - acc: 0.5852 - val_loss: 0.6925 - val_acc: 0.5287\n", + "Epoch 4/12\n", + "933/933 [==============================] - 4s 5ms/step - loss: 0.6680 - acc: 0.5927 - val_loss: 0.6970 - val_acc: 0.5237\n", + "Epoch 5/12\n", + "933/933 [==============================] - 4s 5ms/step - loss: 0.6621 - acc: 0.5916 - val_loss: 0.6982 - val_acc: 0.5387\n", + "Epoch 6/12\n", + "933/933 [==============================] - 4s 5ms/step - loss: 0.6552 - acc: 0.5981 - val_loss: 0.7037 - val_acc: 0.5411\n", + "266/266 [==============================] - 1s 3ms/step\n", + "Fitting with: (1334, 1, 381, 100) labels (1334, 2)\n", + "Train on 933 samples, validate on 401 samples\n", + "Epoch 1/12\n", + "933/933 [==============================] - 7s 7ms/step - loss: 0.6992 - acc: 0.4995 - val_loss: 0.6934 - val_acc: 0.4888\n", + "Epoch 2/12\n", + "933/933 [==============================] - 5s 5ms/step - loss: 0.6934 - acc: 0.4770 - val_loss: 0.6933 - val_acc: 0.4888\n", + "Epoch 3/12\n", + "933/933 [==============================] - 4s 5ms/step - loss: 0.6930 - acc: 0.5091 - val_loss: 0.6934 - val_acc: 0.4988\n", + "Epoch 4/12\n", + "933/933 [==============================] - 4s 5ms/step - loss: 0.6915 - acc: 0.5456 - val_loss: 0.6944 - val_acc: 0.4788\n", + "Epoch 5/12\n", + "933/933 [==============================] - 5s 5ms/step - loss: 0.6869 - acc: 0.5552 - val_loss: 0.6962 - val_acc: 0.4913\n", + "Epoch 6/12\n", + "933/933 [==============================] - 5s 5ms/step - loss: 0.6740 - acc: 0.5809 - val_loss: 0.7028 - val_acc: 0.5212\n", + "266/266 [==============================] - 1s 2ms/step\n" ] } ], "source": [ - "conv_wv_scores = run_cross_validate(get_conv_wv_model, vectorized_reviews, labels, cv=10, categorical=True)" + "conv_wv_scores = run_cross_validate(get_conv_wv_model, vectorized_reviews, labels, cv=6, categorical=True)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Bag of words: [0.84375, 0.86875, 0.7625, 0.825, 0.86875, 0.85, 0.8, 0.8375, 0.8375, 0.78125]\n", + "Word vectors: [0.4738805965701146, 0.5, 0.488721804063123, 0.5300751881940025, 0.4812030079669522, 0.496240601727837]\n" + ] + } + ], "source": [ "print (\"Bag of words: \", conv_bow_scores['accuracies'])\n", "print (\"Word vectors: \", conv_wv_scores['accuracies'])\n", @@ -1056,9 +1169,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "image/png": "iVBORw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WVz7zUozCU8kmxK+E1gCfDLNLoykNr3ymFuzUrhnYVa/PdPsu2N4ZWr1K4CbJN1LNiV2/2yoDwC9ku4Hrqoat9hpW0Qsl/Qs8O2qY94L/ITsyXQXRcQGYIOkI4Flafz9ebKpu58e4t/XbDvPDWVWB0mPApXcFNxDvf8DgTuAI9J4CZIuBJ6PiH8s45hmu8KnocwaTNLpZA+P+lx/ojBrNu5ZmJlZIfcszMyskJOFmZkVcrIwM7NCThZmZlbIycLMzAo5WZiZWaH/DxpHMDjNvWNTAAAAAElFTkSuQmCC\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], "source": [ "boxplot(x='input type', y='accuracy', data=conv_scores_data_frame)\n", "plt.show()" From bd86503143b1c9cd8c1ed95569d6c26431555389 Mon Sep 17 00:00:00 2001 From: Stefan Kennedy Date: Mon, 10 Dec 2018 02:59:13 +0000 Subject: [PATCH 4/5] Added final graphs --- LUCAS/notebooks/neuralnet_comparison.ipynb | 649 +++++++++++++++++++-- 1 file changed, 597 insertions(+), 52 deletions(-) diff --git a/LUCAS/notebooks/neuralnet_comparison.ipynb b/LUCAS/notebooks/neuralnet_comparison.ipynb index 241669e..be8e8de 100644 --- a/LUCAS/notebooks/neuralnet_comparison.ipynb +++ b/LUCAS/notebooks/neuralnet_comparison.ipynb @@ -365,7 +365,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -377,7 +377,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -924,13 +924,7 @@ "1007/1007 [==============================] - 17s 17ms/step - loss: 0.0661 - acc: 0.9791 - val_loss: 0.9196 - val_acc: 0.6490\n", "Epoch 4/12\n", "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0412 - acc: 0.9901 - val_loss: 1.1109 - val_acc: 0.6120\n", - "Epoch 5/12\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ + "Epoch 5/12\n", "1007/1007 [==============================] - 18s 18ms/step - loss: 0.0232 - acc: 0.9970 - val_loss: 1.1591 - val_acc: 0.6305\n", "160/160 [==============================] - 1s 7ms/step\n" ] @@ -940,26 +934,6 @@ "conv_bow_scores = run_cross_validate(get_conv_bow_model, convolutional_data, labels, cv=10, categorical=True)" ] }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0.84375, 0.86875, 0.7625, 0.825, 0.86875, 0.85, 0.8, 0.8375, 0.8375, 0.78125]" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "conv_bow_scores['accuracies']" - ] - }, { "cell_type": "markdown", "metadata": {}, @@ -1207,9 +1181,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "(1600, 1, 20000)" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "batches = 1600\n", "rnn_bow_data = np.array(np.split(bow_predictors, batches))\n", @@ -1218,9 +1203,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "(1600, 1)" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "rnn_bow_targets = np.array([[x] for x in labels])\n", "rnn_bow_targets.shape" @@ -1228,9 +1224,222 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Fitting with: (1440, 1, 20000) labels (1440, 1)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 3s 3ms/step - loss: 0.5428 - acc: 0.7637 - val_loss: 0.3637 - val_acc: 0.8799\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1343 - acc: 0.9861 - val_loss: 0.3267 - val_acc: 0.8753\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0618 - acc: 0.9990 - val_loss: 0.3146 - val_acc: 0.8891\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0396 - acc: 1.0000 - val_loss: 0.3132 - val_acc: 0.8915\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0288 - acc: 1.0000 - val_loss: 0.3127 - val_acc: 0.8868\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0224 - acc: 1.0000 - val_loss: 0.3150 - val_acc: 0.8868\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0180 - acc: 1.0000 - val_loss: 0.3180 - val_acc: 0.8891\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0150 - acc: 1.0000 - val_loss: 0.3211 - val_acc: 0.8938\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0127 - acc: 1.0000 - val_loss: 0.3256 - val_acc: 0.8938\n", + "160/160 [==============================] - 0s 237us/step\n", + "Fitting with: (1440, 1, 20000) labels (1440, 1)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 3s 3ms/step - loss: 0.5319 - acc: 0.7706 - val_loss: 0.3679 - val_acc: 0.8730\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1252 - acc: 0.9861 - val_loss: 0.3113 - val_acc: 0.8799\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0609 - acc: 0.9970 - val_loss: 0.3081 - val_acc: 0.8868\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0391 - acc: 1.0000 - val_loss: 0.3008 - val_acc: 0.8891\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.0281 - acc: 1.0000 - val_loss: 0.2969 - val_acc: 0.8915\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.0216 - acc: 1.0000 - val_loss: 0.2971 - val_acc: 0.8891\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.0174 - acc: 1.0000 - val_loss: 0.2988 - val_acc: 0.8961\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.0144 - acc: 1.0000 - val_loss: 0.3019 - val_acc: 0.8984\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 2s 1ms/step - loss: 0.0121 - acc: 1.0000 - val_loss: 0.3039 - val_acc: 0.8984\n", + "160/160 [==============================] - 0s 229us/step\n", + "Fitting with: (1440, 1, 20000) labels (1440, 1)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 3s 3ms/step - loss: 0.5196 - acc: 0.7607 - val_loss: 0.3464 - val_acc: 0.8915\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1028 - acc: 0.9791 - val_loss: 0.3072 - val_acc: 0.8938\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0453 - acc: 0.9990 - val_loss: 0.3003 - val_acc: 0.8915\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0286 - acc: 1.0000 - val_loss: 0.3003 - val_acc: 0.8891\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0203 - acc: 1.0000 - val_loss: 0.3056 - val_acc: 0.8868\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0156 - acc: 1.0000 - val_loss: 0.3105 - val_acc: 0.8845\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0125 - acc: 1.0000 - val_loss: 0.3130 - val_acc: 0.8845\n", + "160/160 [==============================] - 0s 224us/step\n", + "Fitting with: (1440, 1, 20000) labels (1440, 1)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 3s 3ms/step - loss: 0.5540 - acc: 0.7686 - val_loss: 0.4088 - val_acc: 0.8753\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1803 - acc: 0.9772 - val_loss: 0.3416 - val_acc: 0.8776\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0933 - acc: 0.9980 - val_loss: 0.3257 - val_acc: 0.8684\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0619 - acc: 0.9990 - val_loss: 0.3187 - val_acc: 0.8637\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0456 - acc: 1.0000 - val_loss: 0.3161 - val_acc: 0.8661\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0356 - acc: 1.0000 - val_loss: 0.3161 - val_acc: 0.8614\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0287 - acc: 1.0000 - val_loss: 0.3183 - val_acc: 0.8637\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0238 - acc: 1.0000 - val_loss: 0.3198 - val_acc: 0.8637\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0201 - acc: 1.0000 - val_loss: 0.3231 - val_acc: 0.8637\n", + "160/160 [==============================] - 0s 183us/step\n", + "Fitting with: (1440, 1, 20000) labels (1440, 1)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 4s 4ms/step - loss: 0.5290 - acc: 0.7696 - val_loss: 0.3542 - val_acc: 0.8822\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1171 - acc: 0.9861 - val_loss: 0.3179 - val_acc: 0.8707\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0541 - acc: 0.9990 - val_loss: 0.3179 - val_acc: 0.8753\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0348 - acc: 1.0000 - val_loss: 0.3170 - val_acc: 0.8684\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0251 - acc: 1.0000 - val_loss: 0.3195 - val_acc: 0.8684\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0194 - acc: 1.0000 - val_loss: 0.3243 - val_acc: 0.8684\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0156 - acc: 1.0000 - val_loss: 0.3283 - val_acc: 0.8661\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0130 - acc: 1.0000 - val_loss: 0.3334 - val_acc: 0.8684\n", + "160/160 [==============================] - 0s 214us/step\n", + "Fitting with: (1440, 1, 20000) labels (1440, 1)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 4s 4ms/step - loss: 0.5361 - acc: 0.7537 - val_loss: 0.3424 - val_acc: 0.8753\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1170 - acc: 0.9811 - val_loss: 0.3131 - val_acc: 0.8776\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0500 - acc: 0.9990 - val_loss: 0.3046 - val_acc: 0.8915\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0318 - acc: 1.0000 - val_loss: 0.3040 - val_acc: 0.8891\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0230 - acc: 1.0000 - val_loss: 0.3056 - val_acc: 0.8915\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0176 - acc: 1.0000 - val_loss: 0.3096 - val_acc: 0.8915\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0142 - acc: 1.0000 - val_loss: 0.3137 - val_acc: 0.8891\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0117 - acc: 1.0000 - val_loss: 0.3174 - val_acc: 0.8891\n", + "160/160 [==============================] - 0s 239us/step\n", + "Fitting with: (1440, 1, 20000) labels (1440, 1)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 4s 4ms/step - loss: 0.5679 - acc: 0.7428 - val_loss: 0.4064 - val_acc: 0.8684\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 2s 2ms/step - loss: 0.1829 - acc: 0.9762 - val_loss: 0.3367 - val_acc: 0.8799\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0931 - acc: 0.9990 - val_loss: 0.3038 - val_acc: 0.8915\n", + "Epoch 4/12\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0615 - acc: 0.9990 - val_loss: 0.2955 - val_acc: 0.8915\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0450 - acc: 1.0000 - val_loss: 0.2853 - val_acc: 0.8961\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0350 - acc: 1.0000 - val_loss: 0.2822 - val_acc: 0.8984\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0282 - acc: 1.0000 - val_loss: 0.2824 - val_acc: 0.8961\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0234 - acc: 1.0000 - val_loss: 0.2832 - val_acc: 0.8961\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0198 - acc: 1.0000 - val_loss: 0.2830 - val_acc: 0.8984\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0170 - acc: 1.0000 - val_loss: 0.2855 - val_acc: 0.8938\n", + "160/160 [==============================] - 0s 230us/step\n", + "Fitting with: (1440, 1, 20000) labels (1440, 1)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 5s 4ms/step - loss: 0.5634 - acc: 0.7458 - val_loss: 0.4024 - val_acc: 0.8684\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1787 - acc: 0.9821 - val_loss: 0.3468 - val_acc: 0.8915\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0907 - acc: 0.9980 - val_loss: 0.3273 - val_acc: 0.8845\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0602 - acc: 1.0000 - val_loss: 0.3214 - val_acc: 0.8776\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0443 - acc: 1.0000 - val_loss: 0.3196 - val_acc: 0.8776\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0344 - acc: 1.0000 - val_loss: 0.3198 - val_acc: 0.8730\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0278 - acc: 1.0000 - val_loss: 0.3222 - val_acc: 0.8776\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0230 - acc: 1.0000 - val_loss: 0.3260 - val_acc: 0.8776\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0195 - acc: 1.0000 - val_loss: 0.3297 - val_acc: 0.8753\n", + "160/160 [==============================] - 0s 198us/step\n", + "Fitting with: (1440, 1, 20000) labels (1440, 1)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 5s 5ms/step - loss: 0.5229 - acc: 0.7746 - val_loss: 0.3663 - val_acc: 0.8661\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1295 - acc: 0.9821 - val_loss: 0.3030 - val_acc: 0.9007\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0640 - acc: 0.9970 - val_loss: 0.3018 - val_acc: 0.8938\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0416 - acc: 1.0000 - val_loss: 0.2985 - val_acc: 0.8891\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0301 - acc: 1.0000 - val_loss: 0.2996 - val_acc: 0.8915\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0234 - acc: 1.0000 - val_loss: 0.3038 - val_acc: 0.8868\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0188 - acc: 1.0000 - val_loss: 0.3071 - val_acc: 0.8915\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0156 - acc: 1.0000 - val_loss: 0.3115 - val_acc: 0.8915\n", + "160/160 [==============================] - 0s 209us/step\n", + "Fitting with: (1440, 1, 20000) labels (1440, 1)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 4s 4ms/step - loss: 0.5431 - acc: 0.7468 - val_loss: 0.3233 - val_acc: 0.8961\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.1069 - acc: 0.9821 - val_loss: 0.3107 - val_acc: 0.8684\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0441 - acc: 0.9990 - val_loss: 0.2851 - val_acc: 0.8845\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0272 - acc: 1.0000 - val_loss: 0.2836 - val_acc: 0.8961\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0198 - acc: 1.0000 - val_loss: 0.2866 - val_acc: 0.8868\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0154 - acc: 1.0000 - val_loss: 0.2890 - val_acc: 0.8915\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0124 - acc: 1.0000 - val_loss: 0.2920 - val_acc: 0.8915\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 1s 1ms/step - loss: 0.0104 - acc: 1.0000 - val_loss: 0.2961 - val_acc: 0.8915\n", + "160/160 [==============================] - 0s 196us/step\n" + ] + } + ], "source": [ "def get_rnn_bow_model():\n", " model = Sequential([\n", @@ -1255,9 +1464,294 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Fitting with: (1440, 784) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 62s 62ms/step - loss: 0.6888 - acc: 0.5402 - val_loss: 0.6834 - val_acc: 0.5404\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 57s 57ms/step - loss: 0.6733 - acc: 0.5909 - val_loss: 0.6546 - val_acc: 0.6236\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 56s 56ms/step - loss: 0.6554 - acc: 0.6038 - val_loss: 0.6469 - val_acc: 0.6189\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 60s 59ms/step - loss: 0.6487 - acc: 0.6187 - val_loss: 0.6443 - val_acc: 0.6259\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 58s 58ms/step - loss: 0.6480 - acc: 0.6137 - val_loss: 0.6396 - val_acc: 0.6351\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 61s 60ms/step - loss: 0.6374 - acc: 0.6266 - val_loss: 0.6375 - val_acc: 0.6397\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 62s 62ms/step - loss: 0.6345 - acc: 0.6316 - val_loss: 0.6285 - val_acc: 0.6513\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 58s 57ms/step - loss: 0.6259 - acc: 0.6455 - val_loss: 0.6333 - val_acc: 0.6420\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 64s 63ms/step - loss: 0.6282 - acc: 0.6445 - val_loss: 0.6301 - val_acc: 0.6582\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 65s 65ms/step - loss: 0.6379 - acc: 0.6256 - val_loss: 0.6290 - val_acc: 0.6513\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 58s 58ms/step - loss: 0.6169 - acc: 0.6465 - val_loss: 0.6272 - val_acc: 0.6467\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 58s 58ms/step - loss: 0.6149 - acc: 0.6534 - val_loss: 0.6222 - val_acc: 0.6605\n", + "160/160 [==============================] - 0s 3ms/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 67s 67ms/step - loss: 0.6884 - acc: 0.5353 - val_loss: 0.6811 - val_acc: 0.6005\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 60s 59ms/step - loss: 0.6717 - acc: 0.5968 - val_loss: 0.6534 - val_acc: 0.6189\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 64s 64ms/step - loss: 0.6515 - acc: 0.6157 - val_loss: 0.6452 - val_acc: 0.6189\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 64s 63ms/step - loss: 0.6432 - acc: 0.6226 - val_loss: 0.6378 - val_acc: 0.6305\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 64s 64ms/step - loss: 0.6430 - acc: 0.6157 - val_loss: 0.6500 - val_acc: 0.5889\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 91s 90ms/step - loss: 0.6342 - acc: 0.6326 - val_loss: 0.6359 - val_acc: 0.6097\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 65s 64ms/step - loss: 0.6276 - acc: 0.6395 - val_loss: 0.6327 - val_acc: 0.6536\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 67s 66ms/step - loss: 0.6332 - acc: 0.6346 - val_loss: 0.6309 - val_acc: 0.6420\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 71s 71ms/step - loss: 0.6214 - acc: 0.6316 - val_loss: 0.6358 - val_acc: 0.6166\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 72s 72ms/step - loss: 0.6120 - acc: 0.6524 - val_loss: 0.6467 - val_acc: 0.6420\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 70s 70ms/step - loss: 0.6185 - acc: 0.6524 - val_loss: 0.6225 - val_acc: 0.6559\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 71s 70ms/step - loss: 0.6102 - acc: 0.6475 - val_loss: 0.6225 - val_acc: 0.6467\n", + "160/160 [==============================] - 1s 3ms/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 71s 70ms/step - loss: 0.6903 - acc: 0.5223 - val_loss: 0.6819 - val_acc: 0.5196\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 75s 74ms/step - loss: 0.6711 - acc: 0.5869 - val_loss: 0.6466 - val_acc: 0.6236\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 69s 69ms/step - loss: 0.6464 - acc: 0.6177 - val_loss: 0.6375 - val_acc: 0.6328\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 70s 69ms/step - loss: 0.6456 - acc: 0.6316 - val_loss: 0.6343 - val_acc: 0.6305\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 66s 66ms/step - loss: 0.6339 - acc: 0.6236 - val_loss: 0.6691 - val_acc: 0.5982\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 65s 65ms/step - loss: 0.6251 - acc: 0.6504 - val_loss: 0.6209 - val_acc: 0.6721\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 70s 69ms/step - loss: 0.6196 - acc: 0.6405 - val_loss: 0.6202 - val_acc: 0.6674\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 63s 63ms/step - loss: 0.6187 - acc: 0.6624 - val_loss: 0.6122 - val_acc: 0.6582\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 83s 82ms/step - loss: 0.6152 - acc: 0.6673 - val_loss: 0.6368 - val_acc: 0.6420\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 75s 74ms/step - loss: 0.6272 - acc: 0.6524 - val_loss: 0.6318 - val_acc: 0.6259\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 75s 74ms/step - loss: 0.6005 - acc: 0.6713 - val_loss: 0.6140 - val_acc: 0.6628\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 85s 84ms/step - loss: 0.5985 - acc: 0.6842 - val_loss: 0.6047 - val_acc: 0.6836\n", + "160/160 [==============================] - 0s 3ms/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 88s 87ms/step - loss: 0.6866 - acc: 0.5362 - val_loss: 0.6726 - val_acc: 0.5635\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 83s 83ms/step - loss: 0.6628 - acc: 0.5988 - val_loss: 0.6554 - val_acc: 0.6051\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 71s 70ms/step - loss: 0.6488 - acc: 0.6087 - val_loss: 0.6522 - val_acc: 0.5935\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 75s 75ms/step - loss: 0.6505 - acc: 0.6077 - val_loss: 0.6587 - val_acc: 0.5958\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 71s 70ms/step - loss: 0.6428 - acc: 0.6266 - val_loss: 0.6429 - val_acc: 0.6051\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 67s 67ms/step - loss: 0.6415 - acc: 0.6276 - val_loss: 0.6421 - val_acc: 0.6074\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 68s 68ms/step - loss: 0.6374 - acc: 0.6286 - val_loss: 0.6412 - val_acc: 0.6236\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 71s 70ms/step - loss: 0.6351 - acc: 0.6266 - val_loss: 0.6380 - val_acc: 0.6305\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 64s 63ms/step - loss: 0.6293 - acc: 0.6346 - val_loss: 0.6298 - val_acc: 0.6328\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 60s 60ms/step - loss: 0.6218 - acc: 0.6425 - val_loss: 0.6497 - val_acc: 0.6143\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 66s 66ms/step - loss: 0.6171 - acc: 0.6524 - val_loss: 0.6061 - val_acc: 0.6767\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 72s 72ms/step - loss: 0.6143 - acc: 0.6524 - val_loss: 0.6134 - val_acc: 0.6628\n", + "160/160 [==============================] - 0s 3ms/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 82s 81ms/step - loss: 0.6987 - acc: 0.4826 - val_loss: 0.6887 - val_acc: 0.5727\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 67s 67ms/step - loss: 0.6840 - acc: 0.5770 - val_loss: 0.6715 - val_acc: 0.6028\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 67s 66ms/step - loss: 0.6641 - acc: 0.6018 - val_loss: 0.6541 - val_acc: 0.6005\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 66s 66ms/step - loss: 0.6446 - acc: 0.6266 - val_loss: 0.6315 - val_acc: 0.6490\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 67s 67ms/step - loss: 0.6442 - acc: 0.6137 - val_loss: 0.6301 - val_acc: 0.6420\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 64s 64ms/step - loss: 0.6468 - acc: 0.6216 - val_loss: 0.6516 - val_acc: 0.6328\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 64s 64ms/step - loss: 0.6385 - acc: 0.6216 - val_loss: 0.6304 - val_acc: 0.6328\n", + "Epoch 8/12\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1007/1007 [==============================] - 65s 64ms/step - loss: 0.6331 - acc: 0.6485 - val_loss: 0.6256 - val_acc: 0.6582\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 65s 64ms/step - loss: 0.6318 - acc: 0.6435 - val_loss: 0.6302 - val_acc: 0.6282\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 66s 65ms/step - loss: 0.6230 - acc: 0.6455 - val_loss: 0.6141 - val_acc: 0.6697\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 64s 64ms/step - loss: 0.6309 - acc: 0.6475 - val_loss: 0.6288 - val_acc: 0.6374\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 65s 64ms/step - loss: 0.6283 - acc: 0.6395 - val_loss: 0.6318 - val_acc: 0.6236\n", + "160/160 [==============================] - 0s 3ms/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 69s 68ms/step - loss: 0.6893 - acc: 0.5392 - val_loss: 0.6756 - val_acc: 0.6005\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 65s 65ms/step - loss: 0.6760 - acc: 0.5859 - val_loss: 0.6496 - val_acc: 0.6212\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 64s 64ms/step - loss: 0.6484 - acc: 0.6127 - val_loss: 0.6219 - val_acc: 0.6490\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 63s 62ms/step - loss: 0.6364 - acc: 0.6445 - val_loss: 0.6187 - val_acc: 0.6536\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 61s 61ms/step - loss: 0.6387 - acc: 0.6286 - val_loss: 0.6261 - val_acc: 0.6212\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 61s 61ms/step - loss: 0.6376 - acc: 0.6375 - val_loss: 0.6137 - val_acc: 0.6490\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 62s 61ms/step - loss: 0.6285 - acc: 0.6385 - val_loss: 0.6234 - val_acc: 0.6513\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 63s 63ms/step - loss: 0.6304 - acc: 0.6455 - val_loss: 0.6402 - val_acc: 0.6120\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 63s 63ms/step - loss: 0.6238 - acc: 0.6326 - val_loss: 0.6097 - val_acc: 0.6721\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 67s 67ms/step - loss: 0.6117 - acc: 0.6554 - val_loss: 0.6064 - val_acc: 0.6697\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 69s 68ms/step - loss: 0.6045 - acc: 0.6634 - val_loss: 0.6313 - val_acc: 0.6328\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 64s 64ms/step - loss: 0.6021 - acc: 0.6643 - val_loss: 0.5917 - val_acc: 0.6790\n", + "160/160 [==============================] - 0s 2ms/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 72s 71ms/step - loss: 0.6910 - acc: 0.5194 - val_loss: 0.6821 - val_acc: 0.5635\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 68s 67ms/step - loss: 0.6755 - acc: 0.5899 - val_loss: 0.6486 - val_acc: 0.6189\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 59s 59ms/step - loss: 0.6484 - acc: 0.6356 - val_loss: 0.6686 - val_acc: 0.5982\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 61s 61ms/step - loss: 0.6367 - acc: 0.6375 - val_loss: 0.6529 - val_acc: 0.5912\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 66s 65ms/step - loss: 0.6339 - acc: 0.6524 - val_loss: 0.6297 - val_acc: 0.6513\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 63s 63ms/step - loss: 0.6282 - acc: 0.6415 - val_loss: 0.6270 - val_acc: 0.6420\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 64s 63ms/step - loss: 0.6245 - acc: 0.6465 - val_loss: 0.6343 - val_acc: 0.6490\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 59s 58ms/step - loss: 0.6247 - acc: 0.6564 - val_loss: 0.6331 - val_acc: 0.6536\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 57s 56ms/step - loss: 0.6143 - acc: 0.6673 - val_loss: 0.6305 - val_acc: 0.6605\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 72s 72ms/step - loss: 0.6135 - acc: 0.6653 - val_loss: 0.6333 - val_acc: 0.6374\n", + "160/160 [==============================] - 1s 5ms/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 96s 95ms/step - loss: 0.6945 - acc: 0.5134 - val_loss: 0.6855 - val_acc: 0.5820\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 80s 80ms/step - loss: 0.6778 - acc: 0.5770 - val_loss: 0.6553 - val_acc: 0.6212\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 59s 59ms/step - loss: 0.6453 - acc: 0.6147 - val_loss: 0.6244 - val_acc: 0.6536\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 65s 64ms/step - loss: 0.6669 - acc: 0.6068 - val_loss: 0.6432 - val_acc: 0.6212\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 82s 82ms/step - loss: 0.6385 - acc: 0.6276 - val_loss: 0.6249 - val_acc: 0.6443\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 83s 82ms/step - loss: 0.6359 - acc: 0.6266 - val_loss: 0.6222 - val_acc: 0.6628\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 85s 84ms/step - loss: 0.6291 - acc: 0.6346 - val_loss: 0.6182 - val_acc: 0.6744\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 88s 88ms/step - loss: 0.6293 - acc: 0.6425 - val_loss: 0.6231 - val_acc: 0.6582\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 85s 84ms/step - loss: 0.6234 - acc: 0.6266 - val_loss: 0.6308 - val_acc: 0.6236\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 81s 80ms/step - loss: 0.6269 - acc: 0.6336 - val_loss: 0.6256 - val_acc: 0.6282\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 83s 82ms/step - loss: 0.6180 - acc: 0.6435 - val_loss: 0.6045 - val_acc: 0.6767\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 78s 78ms/step - loss: 0.6172 - acc: 0.6455 - val_loss: 0.5987 - val_acc: 0.6651\n", + "160/160 [==============================] - 0s 2ms/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 75s 75ms/step - loss: 0.6898 - acc: 0.5392 - val_loss: 0.6768 - val_acc: 0.6120\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 67s 66ms/step - loss: 0.6667 - acc: 0.5958 - val_loss: 0.6455 - val_acc: 0.6143\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 66s 65ms/step - loss: 0.6447 - acc: 0.6028 - val_loss: 0.6323 - val_acc: 0.6282\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 72s 71ms/step - loss: 0.6346 - acc: 0.6286 - val_loss: 0.6324 - val_acc: 0.6328\n", + "Epoch 5/12\n", + "1007/1007 [==============================] - 79s 79ms/step - loss: 0.6277 - acc: 0.6296 - val_loss: 0.6252 - val_acc: 0.6374\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 76s 76ms/step - loss: 0.6265 - acc: 0.6365 - val_loss: 0.6373 - val_acc: 0.6328\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 68s 67ms/step - loss: 0.6225 - acc: 0.6336 - val_loss: 0.6263 - val_acc: 0.6513\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 83s 83ms/step - loss: 0.6069 - acc: 0.6435 - val_loss: 0.6160 - val_acc: 0.6674\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 74s 73ms/step - loss: 0.6150 - acc: 0.6495 - val_loss: 0.6174 - val_acc: 0.6236\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 71s 71ms/step - loss: 0.6167 - acc: 0.6395 - val_loss: 0.6224 - val_acc: 0.6490\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 74s 73ms/step - loss: 0.6047 - acc: 0.6733 - val_loss: 0.6486 - val_acc: 0.6120\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 69s 68ms/step - loss: 0.6026 - acc: 0.6624 - val_loss: 0.6058 - val_acc: 0.6559\n", + "160/160 [==============================] - 0s 3ms/step\n", + "Fitting with: (1440, 784) labels (1440,)\n", + "Train on 1007 samples, validate on 433 samples\n", + "Epoch 1/12\n", + "1007/1007 [==============================] - 81s 80ms/step - loss: 0.6927 - acc: 0.5074 - val_loss: 0.6830 - val_acc: 0.5820\n", + "Epoch 2/12\n", + "1007/1007 [==============================] - 79s 78ms/step - loss: 0.6829 - acc: 0.5591 - val_loss: 0.6628 - val_acc: 0.6212\n", + "Epoch 3/12\n", + "1007/1007 [==============================] - 74s 74ms/step - loss: 0.6681 - acc: 0.5958 - val_loss: 0.6378 - val_acc: 0.6536\n", + "Epoch 4/12\n", + "1007/1007 [==============================] - 73s 72ms/step - loss: 0.6509 - acc: 0.6236 - val_loss: 0.6282 - val_acc: 0.6443\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Epoch 5/12\n", + "1007/1007 [==============================] - 66s 65ms/step - loss: 0.6414 - acc: 0.6207 - val_loss: 0.6306 - val_acc: 0.6374\n", + "Epoch 6/12\n", + "1007/1007 [==============================] - 77s 77ms/step - loss: 0.6386 - acc: 0.6286 - val_loss: 0.6189 - val_acc: 0.6420\n", + "Epoch 7/12\n", + "1007/1007 [==============================] - 80s 79ms/step - loss: 0.6361 - acc: 0.6395 - val_loss: 0.6182 - val_acc: 0.6513\n", + "Epoch 8/12\n", + "1007/1007 [==============================] - 81s 80ms/step - loss: 0.6230 - acc: 0.6614 - val_loss: 0.6216 - val_acc: 0.6282\n", + "Epoch 9/12\n", + "1007/1007 [==============================] - 78s 78ms/step - loss: 0.6183 - acc: 0.6475 - val_loss: 0.6271 - val_acc: 0.6536\n", + "Epoch 10/12\n", + "1007/1007 [==============================] - 78s 77ms/step - loss: 0.6245 - acc: 0.6475 - val_loss: 0.6002 - val_acc: 0.6697\n", + "Epoch 11/12\n", + "1007/1007 [==============================] - 82s 81ms/step - loss: 0.6083 - acc: 0.6683 - val_loss: 0.5864 - val_acc: 0.6813\n", + "Epoch 12/12\n", + "1007/1007 [==============================] - 78s 78ms/step - loss: 0.6335 - acc: 0.6187 - val_loss: 0.6513 - val_acc: 0.5958\n", + "160/160 [==============================] - 0s 3ms/step\n" + ] + } + ], "source": [ "def get_rnn_wv_model():\n", " model = Sequential([\n", @@ -1277,9 +1771,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Bag of words: [0.89375, 0.86875, 0.88125, 0.89375, 0.86875, 0.875, 0.8875, 0.9125, 0.85625, 0.86875]\n", + "Word vectors: [0.7125, 0.65, 0.68125, 0.68125, 0.6375, 0.6, 0.59375, 0.74375, 0.625, 0.59375]\n" + ] + } + ], "source": [ "print (\"Bag of words: \", rnn_bow_scores['accuracies'])\n", "print (\"Word vectors: \", rnn_wv_scores['accuracies'])\n", @@ -1290,9 +1793,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvDW2N/gAAGxRJREFUeJzt3XuUVeWd5vHvYxkV26AYKq62EEELb7m0xmoyapto0hra7gxJZ8ZAktXmJp10S9B07NFORm2cUXOZdhjiskNcxI4dJSTpKJ0wYfCWGMVIIXiBFj3BW4FRInhB8EL5mz/2e2RzqKq9QTbnUPV81jqrzt7n3Xv/Ck6d57z78m5FBGZmZgPZo9kFmJlZ63NYmJlZIYeFmZkVcliYmVkhh4WZmRVyWJiZWSGHhZmZFXJYmJlZIYeFmZkV2rPZBewsI0eOjDFjxjS7DDOz3cqSJUt+HxHtRe0GTViMGTOG7u7uZpdhZrZbkfR4mXbeDWVmZoUcFmZmVshhYWZmhRwWZmZWyGFhZmaFHBZmZlbIYWFmZoUGzXUWg8XMmTOp1WpNrWH16tUAdHR0NLUOgM7OTqZOndrsMsyGPIeFbWPTpk3NLsHMWozDosW0wrfoadOmATBjxowmV2JmrcLHLMzMrJDDwszMClUaFpImSFopqSbpgj5eP1TSLZLul3S7pFG5186S9Eh6nFVlnWZmNrDKwkJSG3AV8GfAMcBkScc0NPsW8P2IeDcwHbg8LXsgcDHwXmA8cLGkEVXVamZmA6uyZzEeqEXEqoh4FZgDTGxocwxwS3p+W+71DwEL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kSuQmCC\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], "source": [ "boxplot(x='input type', y='accuracy', data=rnn_scores_data_frame)\n", "plt.show()" @@ -1307,35 +1823,64 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvDW2N/gAAHvNJREFUeJzt3X2cVnWd//HXm1EE72+Y7hgQarCk1s1tolorLdPQ3ypr9ito3aK1sN2UzYfsrv5ylVh99Nu28tdsaqGrlpVEdEdGIXm32WIyiICgyBUpXtLNmDeJaAh8fn+c78jxYmbOBczhmhnez8fjesw53/M953xmrrmuzznne873q4jAzMysN0MaHYCZmfV/ThZmZlbIycLMzAo5WZiZWSEnCzMzK+RkYWZmhZwszMyskJOFmZkVcrIwM7NC+zQ6gL4yYsSIGDNmTKPDMDMbUJYuXfp4RDQX1Rs0yWLMmDF0dHQ0OgwzswFF0iP11PNlKDMzK+RkYWZmhZwszMysUKnJQtJESWskVSRd2M3yIyXdKmmFpDsktaTyN0paLGlVWvbBMuM0M7PelZYsJDUBVwKnAOOBKZLG11T7PPD1iDgGmAV8NpVvAj4cEa8HJgL/T9KhZcVqZma9K/PMYgJQiYh1EbEZmANMqqkzHrg1Td/etTwiHoqItWl6A/B7oPDWLjMzK0eZyWIk8GhuvprK8pYDZ6bpM4CDJB2RryBpAjAU+FVJcZqZWYEyn7NQN2W1Y7jOAL4saSrw38BjwJYXNyC9ErgR+EhEbNthB9I0YBrA6NGj+ybq3dDe3k6lUunz7VarVQBaWlr6fNsAra2tTJ8+vZRtm9ngUGayqAKjcv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cLMx2Tr4/rm25+W1kn6fuRiqMmp95IhvF76I+i9CsBL4MZda38r0DnwA8HhF/rCk/hawbech6P31/6gmV1OZx5J4O2qyIzyzM+tZM4PrU8+gmtncV/hmyHknvJetqfD1ARKyWdDHZkLhDgBfIxmIYkL382uDlXmfNzKyQL0OZmVkhJwszMyvkZGFmZoWcLMzMrJCThZmZFXKyMDOzQk4WZmZWyMnCzMwK/X9lUWBTiWo8LgAAAABJRU5ErkJggg==\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], "source": [ "bow_scores = []\n", "for score in ff_bow_scores['accuracies']:\n", - " bow_scores.append(\"Feed-Forward\", score)\n", + " bow_scores.append((\"Feed-Forward\", score))\n", "for score in conv_bow_scores['accuracies']:\n", - " bow_scores.append(\"Convolutional\", score)\n", + " bow_scores.append((\"Convolutional\", score))\n", "for score in rnn_bow_scores['accuracies']:\n", - " bow_scores.append(\"Recurrent\", score)\n", + " bow_scores.append((\"Recurrent\", score))\n", " \n", - "boxplot(x='input type', y='accuracy', data=conv_scores_data_frame)\n", + "boxplot(x='model', y='accuracy', data=DataFrame(bow_scores, columns=[\"model\", \"accuracy\"]))\n", "plt.show()" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4xLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvDW2N/gAAGz9JREFUeJzt3X2UVfV97/H3h/EBjFZBMEkZEdLBGG+TajsxSc3NRW8huBofk2Uwzb3QNhLb6jTpNa3eepWgXTXNus3KGJNovBjam6iJMYoWH0gMXo0aGQRFiMqIT0dMAoJGBBSY7/1j/0Y2x5nZh/Fsz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Bsil2cPsMbjMzK+Q1CzMzK+SwMDOzQg4LMzMr5LAwM7NCDgszMyvksDBrANV2RdrCacz2FIeFmZkVcliY1ShdafRxZfeceEzZFWn/RNLPJa2WdJykMcqu6vtouiLsB9K8h0q6K10R9ipyl/OQ9FlJD6WTs65KZ2ybDSkOC7Pd0wZ8HfgA2Rm6nyG7KOH5wP8Evgwsi4gPpPF/S/NdAtwXEccCC8gu14Kk9wGfBo5P1zbaQbqsi9lQ0pQXtDJroKcjYgVAunTITyMi0qUkJpJdyO6TABFxd1qjOJjs2lNnpPb/kLQx9fdfya5FtCRdrXQU8Js9+PuY1cRhYbZ78tfj6smN95B9nvq6U2FU/cwT2V38LqxbhWYl8GYos/rKXx14CrA+In5b1X4S2WXkIbv66afSlVBJ+zyO2NNFmxXxmoVZfc0Brk1XHt3MzkuFf5nsiqQPk11q/DmAiFgl6SKyW+KOALaR3YuhKa/ya8OXrzprZmaFvBnKzMwKOSzMzKyQw8LMzAo5LMzMrJDDwszMCjkszMyskMPCzMwKOSzMzKzQ/wf+ZgmY3MjZxwAAAABJRU5ErkJggg==\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], "source": [ "wv_scores = []\n", "for score in ff_wv_scores['accuracies']:\n", - " wv_scores.append(\"Feed-Forward\", score)\n", + " wv_scores.append((\"Feed-Forward\", score))\n", "for score in conv_wv_scores['accuracies']:\n", - " wv_scores.append(\"Convolutional\", score)\n", + " wv_scores.append((\"Convolutional\", score))\n", "for score in rnn_wv_scores['accuracies']:\n", - " bow_scores.append(\"Recurrent\", score)" + " wv_scores.append((\"Recurrent\", score))\n", + "\n", + "boxplot(x='model', y='accuracy', data=DataFrame(wv_scores, columns=[\"model\", \"accuracy\"]))\n", + "plt.show()" ] }, { From 1949214735636f8b0f388589d27a34ef61ecac59 Mon Sep 17 00:00:00 2001 From: Stefan Kennedy Date: Mon, 10 Dec 2018 03:00:23 +0000 Subject: [PATCH 5/5] Added conclusion --- LUCAS/notebooks/neuralnet_comparison.ipynb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/LUCAS/notebooks/neuralnet_comparison.ipynb b/LUCAS/notebooks/neuralnet_comparison.ipynb index be8e8de..9a6a1ed 100644 --- a/LUCAS/notebooks/neuralnet_comparison.ipynb +++ b/LUCAS/notebooks/neuralnet_comparison.ipynb @@ -717,7 +717,7 @@ "metadata": {}, "source": [ "# Convolutional Network\n", - "Now let's try this with a convolutional network. It has been shown that word vectors perform better for text classification than Bag of Words. If BoW is more accurate, it is a clear sign that we should investigate why. First we find th Bag of Words result:" + "Now let's try this with a convolutional network. It has been shown that word vectors perform better for text classification than Bag of Words. If BoW is more accurate, it is a clear sign that we should investigate why. First we find the Bag of Words result:" ] }, { @@ -1168,7 +1168,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Just as before our results are alarming. We need the reasons why this can occur, it may be that we have made a mistake in generating our word vectors" + "Just as before our results are alarming. We need to investigate why this can occur, it may be that we have made a mistake in generating our word vectors" ] }, { @@ -1884,11 +1884,11 @@ ] }, { - "cell_type": "code", - "execution_count": null, + "cell_type": "markdown", "metadata": {}, - "outputs": [], - "source": [] + "source": [ + "From these results we can see that more work is needed to investigate why our embeddings to not perform better than bag of words. There are a number of possibilities, already suggested." + ] } ], "metadata": {