{"action":"created","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/6688","repository_url":"https://api.github.com/repos/fchollet/keras","labels_url":"https://api.github.com/repos/fchollet/keras/issues/6688/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/6688/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/6688/events","html_url":"https://github.com/fchollet/keras/issues/6688","id":229920435,"number":6688,"title":"Keras accuracy is not increasing over 50%","user":{"login":"Ahmid","id":18170760,"avatar_url":"https://avatars1.githubusercontent.com/u/18170760?v=3","gravatar_id":"","url":"https://api.github.com/users/Ahmid","html_url":"https://github.com/Ahmid","followers_url":"https://api.github.com/users/Ahmid/followers","following_url":"https://api.github.com/users/Ahmid/following{/other_user}","gists_url":"https://api.github.com/users/Ahmid/gists{/gist_id}","starred_url":"https://api.github.com/users/Ahmid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ahmid/subscriptions","organizations_url":"https://api.github.com/users/Ahmid/orgs","repos_url":"https://api.github.com/users/Ahmid/repos","events_url":"https://api.github.com/users/Ahmid/events{/privacy}","received_events_url":"https://api.github.com/users/Ahmid/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-05-19T09:30:32Z","updated_at":"2017-05-22T06:43:03Z","closed_at":null,"body":"I am trying to build a binary classification algorithm (output is 0 or 1) on a dataset that contains normal and malicious network packets. The dataset shape (after converting IP @'s and hexa to decimal) is:\r\n\r\n![capture1](https://cloud.githubusercontent.com/assets/18170760/26241844/86366da2-3c86-11e7-9620-24e6dd6f74e0.PNG)\r\n\r\nNote: The final column is the output.\r\n\r\nAnd the Keras model is:\r\n\r\n```\r\nfrom keras.models import Sequential\r\nfrom keras.layers import Dense\r\nfrom sklearn import preprocessing\r\nimport numpy\r\nimport os\r\n\r\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\r\nseed = 4\r\nnumpy.random.seed(seed)\r\n\r\ndataset = numpy.loadtxt(\"NetworkPackets.csv\", delimiter=\",\")\r\nX = dataset[:, 0:11].astype(float)\r\nY = dataset[:, 11]\r\n\r\nmodel = Sequential()\r\nmodel.add(Dense(12, input_dim=11, kernel_initializer='normal', activation='relu'))\r\nmodel.add(Dense(12, kernel_initializer='normal', activation='relu'))\r\nmodel.add(Dense(1, kernel_initializer='normal', activation='relu'))\r\n\r\nmodel.compile(loss='binary_crossentropy', optimizer='Adam', metrics=['accuracy'])\r\nmodel.fit(X, Y, nb_epoch=100, batch_size=5)\r\n\r\nscores = model.evaluate(X, Y)\r\nprint(\"\\n%s: %.2f%%\" % (model.metrics_names[1], scores[1]*100))\r\n```\r\n\r\nHowever, I tried different optimizers, activation functions, number of layers, but the accuracy is reaching 0.5 at most:\r\n\r\n![capture](https://cloud.githubusercontent.com/assets/18170760/26241854/8c530380-3c86-11e7-92c6-c9afd759eac0.PNG)\r\n\r\nEven I tried Grid search for searching the best parameters, but the maximum is 0.5. Does anyone knows why the output is always like that? and how can I enhance it. Thanks in advance!"},"comment":{"url":"https://api.github.com/repos/fchollet/keras/issues/comments/303012508","html_url":"https://github.com/fchollet/keras/issues/6688#issuecomment-303012508","issue_url":"https://api.github.com/repos/fchollet/keras/issues/6688","id":303012508,"user":{"login":"Ahmid","id":18170760,"avatar_url":"https://avatars1.githubusercontent.com/u/18170760?v=3","gravatar_id":"","url":"https://api.github.com/users/Ahmid","html_url":"https://github.com/Ahmid","followers_url":"https://api.github.com/users/Ahmid/followers","following_url":"https://api.github.com/users/Ahmid/following{/other_user}","gists_url":"https://api.github.com/users/Ahmid/gists{/gist_id}","starred_url":"https://api.github.com/users/Ahmid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ahmid/subscriptions","organizations_url":"https://api.github.com/users/Ahmid/orgs","repos_url":"https://api.github.com/users/Ahmid/repos","events_url":"https://api.github.com/users/Ahmid/events{/privacy}","received_events_url":"https://api.github.com/users/Ahmid/received_events","type":"User","site_admin":false},"created_at":"2017-05-22T06:43:03Z","updated_at":"2017-05-22T06:43:03Z","body":"@myhussien I used `standardized_X = preprocessing.scale(X)` and the result becomes:\r\n\r\n![capture](https://cloud.githubusercontent.com/assets/18170760/26295521/87ece82e-3eca-11e7-932e-99917c2eaf30.PNG)\r\n\r\nWhich is great!\r\nBut the question is that a right approach? \r\nBecause when I predicted if a packet is normal or malicious after training, the model predicts a wrong one :/\r\n"}}
{"actor":{"display_login":"Ahmid"}}