{"action":"created","issue":{"url":"https://api.github.com/repos/aigamedev/scikit-neuralnetwork/issues/60","labels_url":"https://api.github.com/repos/aigamedev/scikit-neuralnetwork/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/aigamedev/scikit-neuralnetwork/issues/60/comments","events_url":"https://api.github.com/repos/aigamedev/scikit-neuralnetwork/issues/60/events","html_url":"https://github.com/aigamedev/scikit-neuralnetwork/issues/60","id":79805706,"number":60,"title":"IndexError in topo_view_to_design_mat","user":{"login":"matthiasplappert","id":124243,"avatar_url":"https://avatars.githubusercontent.com/u/124243?v=3","gravatar_id":"","url":"https://api.github.com/users/matthiasplappert","html_url":"https://github.com/matthiasplappert","followers_url":"https://api.github.com/users/matthiasplappert/followers","following_url":"https://api.github.com/users/matthiasplappert/following{/other_user}","gists_url":"https://api.github.com/users/matthiasplappert/gists{/gist_id}","starred_url":"https://api.github.com/users/matthiasplappert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthiasplappert/subscriptions","organizations_url":"https://api.github.com/users/matthiasplappert/orgs","repos_url":"https://api.github.com/users/matthiasplappert/repos","events_url":"https://api.github.com/users/matthiasplappert/events{/privacy}","received_events_url":"https://api.github.com/users/matthiasplappert/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aigamedev/scikit-neuralnetwork/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/aigamedev/scikit-neuralnetwork/milestones/1","html_url":"https://github.com/aigamedev/scikit-neuralnetwork/milestones/0.2","labels_url":"https://api.github.com/repos/aigamedev/scikit-neuralnetwork/milestones/1/labels","id":1097227,"number":1,"title":"0.2","description":null,"creator":{"login":"alexjc","id":445208,"avatar_url":"https://avatars.githubusercontent.com/u/445208?v=3","gravatar_id":"","url":"https://api.github.com/users/alexjc","html_url":"https://github.com/alexjc","followers_url":"https://api.github.com/users/alexjc/followers","following_url":"https://api.github.com/users/alexjc/following{/other_user}","gists_url":"https://api.github.com/users/alexjc/gists{/gist_id}","starred_url":"https://api.github.com/users/alexjc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexjc/subscriptions","organizations_url":"https://api.github.com/users/alexjc/orgs","repos_url":"https://api.github.com/users/alexjc/repos","events_url":"https://api.github.com/users/alexjc/events{/privacy}","received_events_url":"https://api.github.com/users/alexjc/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":3,"state":"open","created_at":"2015-05-05T16:57:24Z","updated_at":"2015-05-23T11:28:00Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-05-23T10:23:55Z","updated_at":"2015-05-23T13:46:31Z","closed_at":null,"body":"I'm trying to use a very simple NN with a convolution layer to learn handwritten digits. Here's my code:\r\n\r\n```\r\nimport sys\r\nimport logging\r\n\r\nfrom sklearn.datasets import load_digits\r\nfrom sklearn.cross_validation import StratifiedKFold\r\nfrom sknn.mlp import Classifier, Layer, Convolution\r\n\r\nlogging.basicConfig(format=\"%(message)s\", level=logging.DEBUG, stream=sys.stdout)\r\n\r\ndigits = load_digits()\r\nX = digits.images\r\ny = digits.target\r\nprint(X.shape, y.shape)  # outputs: ((1797, 8, 8), (1797,))\r\n\r\nkf = StratifiedKFold(y, n_folds=3)\r\nfor train, test in kf:\r\n    X_train, y_train = X[train], y[train]\r\n    X_test, y_test = X[test], y[test]\r\n\r\n    nn = Classifier(\r\n        layers=[\r\n            Convolution('Rectifier', channels=8, kernel_shape=(3, 3)),\r\n            Layer('Softmax')],\r\n        learning_rate=0.001,\r\n        n_iter=25, verbose=1)\r\n    nn.fit(X_train, y_train)\r\n    print nn.score(X_test, y_test)\r\n```\r\n\r\nWhen training the network, I get the following error:\r\n```\r\nTraceback (most recent call last):\r\n  File \"/Users/matze/Labs/deeplearn/src/digits.py\", line 29, in <module>\r\n    nn.fit(X_train, y_train)\r\n  File \"/Users/matze/Labs/deeplearn/lib/python2.7/site-packages/sknn/mlp.py\", line 839, in fit\r\n    return super(Classifier, self)._fit(X, yp, test=y)\r\n  File \"/Users/matze/Labs/deeplearn/lib/python2.7/site-packages/sknn/mlp.py\", line 696, in _fit\r\n    X = self.ds.view_converter.topo_view_to_design_mat(X)\r\n  File \"/Users/matze/Labs/deeplearn/lib/python2.7/site-packages/sknn/pylearn2/datasets/dense_design_matrix.py\", line 1396, in topo_view_to_design_mat\r\n    if topo_array.shape[self.axes.index(axis)] != shape_elem:\r\nIndexError: tuple index out of range\r\n```\r\n\r\nI have used neural network before but I'm very new to the idea of convolution. It is therefore perfectly possible that I'm trying doing something very stupid here. I've played around with the `kernel_shape` and `channels` values, but no luck. Any help or input on this would be greatly appreciated."},"comment":{"url":"https://api.github.com/repos/aigamedev/scikit-neuralnetwork/issues/comments/104900022","html_url":"https://github.com/aigamedev/scikit-neuralnetwork/issues/60#issuecomment-104900022","issue_url":"https://api.github.com/repos/aigamedev/scikit-neuralnetwork/issues/60","id":104900022,"user":{"login":"alexjc","id":445208,"avatar_url":"https://avatars.githubusercontent.com/u/445208?v=3","gravatar_id":"","url":"https://api.github.com/users/alexjc","html_url":"https://github.com/alexjc","followers_url":"https://api.github.com/users/alexjc/followers","following_url":"https://api.github.com/users/alexjc/following{/other_user}","gists_url":"https://api.github.com/users/alexjc/gists{/gist_id}","starred_url":"https://api.github.com/users/alexjc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexjc/subscriptions","organizations_url":"https://api.github.com/users/alexjc/orgs","repos_url":"https://api.github.com/users/alexjc/repos","events_url":"https://api.github.com/users/alexjc/events{/privacy}","received_events_url":"https://api.github.com/users/alexjc/received_events","type":"User","site_admin":false},"created_at":"2015-05-23T13:46:31Z","updated_at":"2015-05-23T13:46:31Z","body":"This line fixes it:\r\n```\r\nX = digits.images.reshape((1797, 8, 8, 1))\r\n```\r\nI will add a test for that in the code and fix it next..."}}