{"action":"closed","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/463","labels_url":"https://api.github.com/repos/fchollet/keras/issues/463/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/463/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/463/events","html_url":"https://github.com/fchollet/keras/issues/463","id":98219279,"number":463,"title":"A bug in the latest version of keras: bias is not updated","user":{"login":"bangrui","id":8725911,"avatar_url":"https://avatars.githubusercontent.com/u/8725911?v=3","gravatar_id":"","url":"https://api.github.com/users/bangrui","html_url":"https://github.com/bangrui","followers_url":"https://api.github.com/users/bangrui/followers","following_url":"https://api.github.com/users/bangrui/following{/other_user}","gists_url":"https://api.github.com/users/bangrui/gists{/gist_id}","starred_url":"https://api.github.com/users/bangrui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bangrui/subscriptions","organizations_url":"https://api.github.com/users/bangrui/orgs","repos_url":"https://api.github.com/users/bangrui/repos","events_url":"https://api.github.com/users/bangrui/events{/privacy}","received_events_url":"https://api.github.com/users/bangrui/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-30T17:16:08Z","updated_at":"2015-07-31T01:52:52Z","closed_at":"2015-07-31T01:52:52Z","body":"Hi guys, I have some problems with the latest version of keras. This is a simple autoencoder code:\r\n\r\nimport numpy as np\r\n\r\nfrom keras.models import Sequential\r\nfrom keras.layers.core import Dense, Activation, AutoEncoder\r\nfrom keras.optimizers import SGD\r\nfrom keras.layers import containers\r\n\r\ntrain_feature = np.zeros((1,4))\r\nfor i in range(1):\r\n        train_feature[i,] = [0.5, 0.3, 0.2, 0.1]\r\n\r\nmodel = Sequential()\r\nencoder = containers.Sequential([Dense(4,2,activation='tanh')])\r\ndecoder = containers.Sequential([Dense(2,4,activation='tanh')])\r\nautoencoder = AutoEncoder(encoder=encoder,decoder=decoder)\r\nmodel.add(autoencoder)\r\n\r\nsgd = SGD(lr = 1)\r\nmodel.compile(loss='mse', optimizer=sgd)\r\nweights_org = model.get_weights()\r\nmodel.fit(train_feature, train_feature, nb_epoch=1, batch_size=1, shuffle=False)\r\nweights_now = model.get_weights()\r\nprint \"Weights and bias before trainning is\"\r\nprint weights_org\r\nprint \"Weights and bias after trainning is\"\r\nprint weights_now\r\n\r\nIf I use the past version, the result is fine, which looks like:\r\nEpoch 0\r\n1/1 [==============================] - 0s - loss: 0.1271\r\nWeights and bias before trainning is\r\n[array([[-0.92038186,  0.05200247],\r\n       [ 0.46043892, -0.82942702],\r\n       [-0.57505271, -0.25431725],\r\n       [ 0.03477517, -0.10212894]]), array([ 0.,  0.]), array([[-0.16022001, -0.06501606, -0.68613223,  0.96541306],\r\n       [ 0.15240795, -0.41876942,  0.50621491,  0.11618159]]), array([ 0.,  0.,  0.,  0.])]\r\nWeights and bias after trainning is\r\n[array([[-0.86223659,  0.07199206],\r\n       [ 0.49532608, -0.81743327],\r\n       [-0.5517946 , -0.24632141],\r\n       [ 0.04640422, -0.09813102]]), array([ 0.11629053,  0.03997918]), array([[-0.25749549, -0.09675063, -0.69828947,  0.87946589],\r\n       [ 0.08653298, -0.44026008,  0.49798202,  0.05797814]]), array([ 0.23823399,  0.07772003,  0.02977387,  0.21049024])]\r\nHowever, if I use the latest version of keras, then the result will be:\r\nEpoch 0\r\n1/1 [==============================] - 0s - loss: 0.0328\r\nWeights and bias before trainning is\r\n[array([[ 0.99807841, -0.0321337 ],\r\n       [-0.34120891,  0.31954411],\r\n       [ 0.61708271,  0.51410343],\r\n       [-0.68198998,  0.58714997]]), array([ 0.,  0.]), array([[ 0.69201076,  0.3782278 ,  0.95140293,  0.22793627],\r\n       [ 0.16048078,  0.68251729,  0.26576419, -0.86654349]]), array([ 0.,  0.,  0.,  0.])]\r\nWeights and bias after trainning is\r\n[array([[ 0.99807841, -0.0321337 ],\r\n       [-0.34120891,  0.31954411],\r\n       [ 0.61708271,  0.51410343],\r\n       [-0.68198998,  0.58714997]]), array([ 0.,  0.]), array([[ 0.69201076,  0.3782278 ,  0.95140293,  0.22793627],\r\n       [ 0.16048078,  0.68251729,  0.26576419, -0.86654349]]), array([ 0.,  0.,  0.,  0.])]\r\n\r\nBasically, the bias of the neural network is not updating. Could someone help to fix it?"}}