{"action":"created","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/3056","repository_url":"https://api.github.com/repos/fchollet/keras","labels_url":"https://api.github.com/repos/fchollet/keras/issues/3056/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/3056/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/3056/events","html_url":"https://github.com/fchollet/keras/issues/3056","id":162065462,"number":3056,"title":"Help me explain the result LSTM","user":{"login":"zero76114","id":4373968,"avatar_url":"https://avatars.githubusercontent.com/u/4373968?v=3","gravatar_id":"","url":"https://api.github.com/users/zero76114","html_url":"https://github.com/zero76114","followers_url":"https://api.github.com/users/zero76114/followers","following_url":"https://api.github.com/users/zero76114/following{/other_user}","gists_url":"https://api.github.com/users/zero76114/gists{/gist_id}","starred_url":"https://api.github.com/users/zero76114/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zero76114/subscriptions","organizations_url":"https://api.github.com/users/zero76114/orgs","repos_url":"https://api.github.com/users/zero76114/repos","events_url":"https://api.github.com/users/zero76114/events{/privacy}","received_events_url":"https://api.github.com/users/zero76114/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-06-24T02:46:44Z","updated_at":"2016-09-14T10:26:08Z","closed_at":null,"body":"Dear All,\r\nPlease help me explain the result training. Why val_acc seems  abnormal fluctuations. Is there overfitting? How I can avoid and tunning hyperparameter. Please help me.\r\nLoading data...\r\n47808 train sequences\r\n11952 test sequences\r\nPad sequences (samples x time)\r\nX_train shape: (47808, 100)\r\nX_test shape: (11952, 100)\r\nBuild model...\r\nTrain...\r\n(47808, 100)\r\n(47808,)\r\nTrain on 47808 samples, validate on 11952 samples\r\nEpoch 1/15\r\n47808/47808 [==============================] - 300s - loss: 0.6807 - acc: 0.5745 - val_loss: 0.6770 - val_acc: 0.5802\r\nEpoch 2/15\r\n47808/47808 [==============================] - 324s - loss: 0.6693 - acc: 0.5843 - val_loss: 0.6765 - val_acc: 0.5796\r\nEpoch 3/15\r\n47808/47808 [==============================] - 349s - loss: 0.6678 - acc: 0.5857 - val_loss: 0.6789 - val_acc: 0.5801\r\nEpoch 4/15\r\n47808/47808 [==============================] - 345s - loss: 0.6485 - acc: 0.6128 - val_loss: 0.6913 - val_acc: 0.5599\r\nEpoch 5/15\r\n47808/47808 [==============================] - 362s - loss: 0.6175 - acc: 0.6478 - val_loss: 0.7101 - val_acc: 0.5591\r\nEpoch 6/15\r\n47808/47808 [==============================] - 344s - loss: 0.5860 - acc: 0.6778 - val_loss: 0.7268 - val_acc: 0.5556\r\nEpoch 7/15\r\n47808/47808 [==============================] - 347s - loss: 0.5521 - acc: 0.7081 - val_loss: 0.7586 - val_acc: 0.5456\r\nEpoch 8/15\r\n47808/47808 [==============================] - 353s - loss: 0.5202 - acc: 0.7324 - val_loss: 0.8535 - val_acc: 0.5518\r\nEpoch 9/15\r\n47808/47808 [==============================] - 354s - loss: 0.4908 - acc: 0.7519 - val_loss: 0.8264 - val_acc: 0.5393\r\nEpoch 10/15\r\n47808/47808 [==============================] - 352s - loss: 0.4640 - acc: 0.7673 - val_loss: 0.9265 - val_acc: 0.5376\r\nEpoch 11/15\r\n47808/47808 [==============================] - 340s - loss: 0.4427 - acc: 0.7817 - val_loss: 0.9088 - val_acc: 0.5418\r\nEpoch 12/15\r\n47808/47808 [==============================] - 358s - loss: 0.4148 - acc: 0.7972 - val_loss: 0.9248 - val_acc: 0.5501\r\nEpoch 13/15\r\n47808/47808 [==============================] - 355s - loss: 0.3903 - acc: 0.8125 - val_loss: 1.0106 - val_acc: 0.5452\r\nEpoch 14/15\r\n47808/47808 [==============================] - 360s - loss: 0.3669 - acc: 0.8290 - val_loss: 1.0123 - val_acc: 0.5361\r\nEpoch 15/15\r\n47808/47808 [==============================] - 437s - loss: 0.3514 - acc: 0.8371 - val_loss: 1.1003 - val_acc: 0.5429\r\n11952/11952 [==============================] - 25s    \r\nTest score: 1.10034437192\r\nTest accuracy: 0.542921686747\r\n\r\n=======================================\r\nThis is my model:\r\nmax_features = 20000\r\nmaxlen = 100  # cut texts after this number of words (among top max_features most common words)\r\nbatch_size = 32\r\nprint('Loading data...')\r\n(X_train, y_train), (X_test, y_test) = reuter.load_data(path='/home/huy/Create_data/aclImdb/reuter23.pkl',nb_words=max_features,\r\n                                                      test_split=0.2)\r\nprint(len(X_train), 'train sequences')\r\nprint(len(X_test), 'test sequences')\r\n\r\nprint('Pad sequences (samples x time)')\r\nX_train = sequence.pad_sequences(X_train, maxlen=maxlen)\r\nX_test = sequence.pad_sequences(X_test, maxlen=maxlen)\r\nprint('X_train shape:', X_train.shape)\r\nprint('X_test shape:', X_test.shape)\r\n\r\nprint('Build model...')\r\nmodel = Sequential()\r\nmodel.add(Embedding(max_features, 128, input_length=maxlen, dropout=0.2))\r\nmodel.add(LSTM(128, dropout_W=0.2, dropout_U=0.2))  # try using a GRU instead, for fun\r\nmodel.add(Dense(1))\r\nmodel.add(Activation('sigmoid'))\r\n===================\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/fchollet/keras/issues/comments/246970241","html_url":"https://github.com/fchollet/keras/issues/3056#issuecomment-246970241","issue_url":"https://api.github.com/repos/fchollet/keras/issues/3056","id":246970241,"user":{"login":"ersinyar","id":19571570,"avatar_url":"https://avatars.githubusercontent.com/u/19571570?v=3","gravatar_id":"","url":"https://api.github.com/users/ersinyar","html_url":"https://github.com/ersinyar","followers_url":"https://api.github.com/users/ersinyar/followers","following_url":"https://api.github.com/users/ersinyar/following{/other_user}","gists_url":"https://api.github.com/users/ersinyar/gists{/gist_id}","starred_url":"https://api.github.com/users/ersinyar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ersinyar/subscriptions","organizations_url":"https://api.github.com/users/ersinyar/orgs","repos_url":"https://api.github.com/users/ersinyar/repos","events_url":"https://api.github.com/users/ersinyar/events{/privacy}","received_events_url":"https://api.github.com/users/ersinyar/received_events","type":"User","site_admin":false},"created_at":"2016-09-14T10:26:07Z","updated_at":"2016-09-14T10:26:07Z","body":"@zero76114 I am having the exact same situation. Val_loss increases and the val_acc fluctuates in a small interval. Increasing val_loss can be explained with overfitting but I cannot explain the fluctuations in val_acc. Normally, in overfitting case we should be observing that val_acc starts from a lower value and goes up to higher value and then decreases continuously. But that's not the case here. Have you come up with a solution or an explanation yet? "}}
{"actor":{"display_login":"ersinyar"}}