{
  "id": 7514,
  "title": "99.46% with Convolutional NN (Weka)",
  "url": "/competitions/digit-recognizer/discussion/7514",
  "author_name": "Johannes Amtén",
  "post_date": "2014-03-25T18:39:08.560000",
  "votes": 13,
  "comment_count": 13,
  "views": null,
  "content": "<p>I continued building on my Weka neural network implementation from <a href=\"http://www.kaggle.com/c/digit-recognizer/forums/t/7221/98-83-with-weka-new-nn-package\">here </a>to implement convolutional neural networks.<br>Source code, downloads and installation instructions here:<br>https://github.com/amten/NeuralNetwork</p>\n<p>With regular neural networks, I got stuck at 98.83%. With convolutional neural networks, I was able to get 99.46% without problems.</p>\n<p>I used two convolutional layers, the first with 20 feature maps, the second with 100 feature maps, both layers with 5x5 patch-size and 2x2 max-pooling.<br>Also, I used batch-size=1, i.e. Stochastic Gradient Descent. That seemed to work a lot better than larger batch sizes for conv nets.<br>It took about an hour on a modern laptop for the training to converge.</p>",
  "messages": [
    {
      "id": 41006,
      "postDate": "2014-03-25T18:39:08.560Z",
      "content": "<p>I continued building on my Weka neural network implementation from <a href=\"http://www.kaggle.com/c/digit-recognizer/forums/t/7221/98-83-with-weka-new-nn-package\">here </a>to implement convolutional neural networks.<br>Source code, downloads and installation instructions here:<br>https://github.com/amten/NeuralNetwork</p>\n<p>With regular neural networks, I got stuck at 98.83%. With convolutional neural networks, I was able to get 99.46% without problems.</p>\n<p>I used two convolutional layers, the first with 20 feature maps, the second with 100 feature maps, both layers with 5x5 patch-size and 2x2 max-pooling.<br>Also, I used batch-size=1, i.e. Stochastic Gradient Descent. That seemed to work a lot better than larger batch sizes for conv nets.<br>It took about an hour on a modern laptop for the training to converge.</p>",
      "votes": 13
    },
    {
      "id": 51563,
      "postDate": "2014-08-03T19:45:33.957Z",
      "content": "<p>[quote=Mike Hall;51562]</p>\n<p>I have to learn more NN sometime, somewhere. I'm not remembering fully-connected or convolutional coming up in what I've seen so far, which has been pretty much limited to multi-layer perceptron.</p>\n<p>Thanks again.</p>\n<p>[/quote]</p>\n<p>I highly recommend the video lectures from Hugo Larochelles Neural Network class:</p>\n<p>https://www.youtube.com/playlist?list=PL6Xpj9I5qXYEcOhn7TqghAJ6NAPrNmUBH</p>\n<p>In chapter 9.6 he talks about convolutional neural networks for images.</p>",
      "votes": 3
    },
    {
      "id": 51171,
      "postDate": "2014-07-25T08:40:08.690Z",
      "content": "<p>[quote=Tgeek;51166]</p>\n<p>amazing work, well done!!!</p>\n<p>[/quote]</p>\n<p>Thank you very much :)</p>",
      "votes": 1
    },
    {
      "id": 51166,
      "postDate": "2014-07-25T05:34:49.787Z",
      "content": "<p>amazing work, well done!!!</p>",
      "votes": 1
    },
    {
      "id": 100685,
      "postDate": "2015-12-09T17:46:24.357Z",
      "content": "<p>Thanks a lot for sharing! I've installed this on WEKA. I'd like to do some image classification (RGB images and greyscale images). But I am not sure how to manage the input for CNN. Should I arrange the images as channel by channel or RGB value by RGB value?  </p>",
      "rawMarkdown": "Thanks a lot for sharing! I've installed this on WEKA. I'd like to do some image classification (RGB images and greyscale images). But I am not sure how to manage the input for CNN. Should I arrange the images as channel by channel or RGB value by RGB value?  "
    },
    {
      "id": 100683,
      "postDate": "2015-12-09T17:19:34.713Z",
      "content": "<p>Thank you, Johannes Amt&#233;n! It's so good. But I have a question, when I implement your code to recognite characters on Android is very slow. I don't know why. Can you give me some advise how to use it on android.</p>",
      "rawMarkdown": "Thank you, Johannes Amtén! It's so good. But I have a question, when I implement your code to recognite characters on Android is very slow. I don't know why. Can you give me some advise how to use it on android."
    },
    {
      "id": 90437,
      "postDate": "2015-08-26T15:28:10.677Z",
      "content": "<p>Excellent work ! just one question, how can visualize the learnt model with your weka implementation?</p>",
      "rawMarkdown": "Excellent work ! just one question, how can visualize the learnt model with your weka implementation?"
    },
    {
      "id": 60272,
      "postDate": "2014-12-15T20:21:14.930Z",
      "content": "<p>[quote=Hang Zhang;60253]</p>\n<p>Hi Amten,</p>\n<p>Thank you for your&nbsp;amazing work! I am&nbsp;trying to use your implementation to another topics on kaggle, 'First step in Julia'. I used the same parameter shown above, and only got 66%. Can you give me some advise on choosing parameters.</p>\n<p>Thanks!</p>\n<p>Hang</p>\n<p>[/quote]</p>\n<p>Thank you. I haven't looked at that problem. Don't know if any other parameters would be better. It seems like 66% is quite a good score on that problem though. The benchmark scores for Random Forest/KNN is just 43% / 41% and a score of 66% would put you at spot 8 on the leaderboard(!)</p>"
    },
    {
      "id": 60253,
      "postDate": "2014-12-15T19:10:33.937Z",
      "content": "<p>Hi Amten,</p>\n<p>Thank you for your&nbsp;amazing work! I am&nbsp;trying to use your implementation to another topics on kaggle, 'First step in Julia'. I used the same parameter shown above, and only got 66%. Can you give me some advise on choosing parameters.</p>\n<p>Thanks!</p>\n<p>Hang</p>"
    },
    {
      "id": 59446,
      "postDate": "2014-12-03T07:58:17.010Z",
      "content": "<p>[quote=Yanyanyan;59437]</p>\n<p>Hi Amten,</p>\n<p>Thanks for your implementation.</p>\n<p>I have a question, how should we set the parameter in weka when we use this package.</p>\n<p>For example, &quot;I used two convolutional layers, the first with 20 feature maps, the second with 100 feature maps, both layers with 5x5 patch-size and 2x2 max-pooling.&quot;</p>\n<p>how to set these parameters on weka hiddenlayer input would you please make a screenshot for me?&nbsp;</p>\n<p>Thanks</p>\n<p>[/quote]</p>\n<p>Sure,</p>\n<p>Hidden layers parameter: 20-5-5-2-2,100-5-5-2-2</p>\n<p><img src=\"http://oi62.tinypic.com/155qkq1.jpg\" alt width=\"489\" height=\"505\"></p>\n\n<p>(Also, you can just press the &quot;more&quot; button for an explanation of the parameters in the UI.)</p>"
    },
    {
      "id": 59437,
      "postDate": "2014-12-03T04:21:25.540Z",
      "content": "<p>Hi Amten,</p>\n<p>Thanks for your implementation.</p>\n<p>I have a question, how should we set the parameter in weka when we use this package.</p>\n<p>For example, &quot;I used two convolutional layers, the first with 20 feature maps, the second with 100 feature maps, both layers with 5x5 patch-size and 2x2 max-pooling.&quot;</p>\n<p>how to set these parameters on weka hiddenlayer input would you please make a screenshot for me?&nbsp;</p>\n<p>Thanks</p>"
    },
    {
      "id": 51562,
      "postDate": "2014-08-03T18:19:42.710Z",
      "content": "<p>I have to learn more NN sometime, somewhere. I'm not remembering fully-connected or convolutional coming up in what I've seen so far, which has been pretty much limited to multi-layer perceptron.</p>\n<p>Thanks again.</p>"
    },
    {
      "id": 51553,
      "postDate": "2014-08-03T15:16:24.967Z",
      "content": "<p>[quote=Mike Hall;51535]</p>\n<p>Works very nicely, even 'out of the box' with default parameters on this dataset. Is that still convolutional?</p>\n<p>I had to run it command line though due to memory problems with the Weka GUI. (This on OS X - I got rid of the blas related and it ran fine with just the jars. The linux doc link you provided says the OS X veclib [I think it was] implementation is fast enough you don't need to worry about it and it seems to be.</p>\n<p>Thanks.</p>\n<p>[/quote]</p>\n<p>Cool. No, the default setting is a single, fully-connected, hidden layer with 100 Units.</p>"
    },
    {
      "id": 51535,
      "postDate": "2014-08-02T23:13:08.013Z",
      "content": "<p>Works very nicely, even 'out of the box' with default parameters on this dataset. Is that still convolutional?</p>\n<p>I had to run it command line though due to memory problems with the Weka GUI. (This on OS X - I got rid of the blas related and it ran fine with just the jars. The linux doc link you provided says the OS X veclib [I think it was] implementation is fast enough you don't need to worry about it and it seems to be.</p>\n<p>Thanks.</p>"
    }
  ],
  "comments": [
    {
      "id": 51563,
      "author_name": "Johannes Amtén",
      "author_url": "",
      "post_date": "2014-08-03T19:45:33.957000",
      "content": "<p>[quote=Mike Hall;51562]</p>\n<p>I have to learn more NN sometime, somewhere. I'm not remembering fully-connected or convolutional coming up in what I've seen so far, which has been pretty much limited to multi-layer perceptron.</p>\n<p>Thanks again.</p>\n<p>[/quote]</p>\n<p>I highly recommend the video lectures from Hugo Larochelles Neural Network class:</p>\n<p>https://www.youtube.com/playlist?list=PL6Xpj9I5qXYEcOhn7TqghAJ6NAPrNmUBH</p>\n<p>In chapter 9.6 he talks about convolutional neural networks for images.</p>",
      "votes": 3,
      "replies": []
    },
    {
      "id": 51171,
      "author_name": "Johannes Amtén",
      "author_url": "",
      "post_date": "2014-07-25T08:40:08.690000",
      "content": "<p>[quote=Tgeek;51166]</p>\n<p>amazing work, well done!!!</p>\n<p>[/quote]</p>\n<p>Thank you very much :)</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 51166,
      "author_name": "Tgeek",
      "author_url": "",
      "post_date": "2014-07-25T05:34:49.787000",
      "content": "<p>amazing work, well done!!!</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 100685,
      "author_name": "Xuefei",
      "author_url": "",
      "post_date": "2015-12-09T17:46:24.357000",
      "content": "<p>Thanks a lot for sharing! I've installed this on WEKA. I'd like to do some image classification (RGB images and greyscale images). But I am not sure how to manage the input for CNN. Should I arrange the images as channel by channel or RGB value by RGB value?  </p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 100683,
      "author_name": "TranHongNghi",
      "author_url": "",
      "post_date": "2015-12-09T17:19:34.713000",
      "content": "<p>Thank you, Johannes Amt&#233;n! It's so good. But I have a question, when I implement your code to recognite characters on Android is very slow. I don't know why. Can you give me some advise how to use it on android.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 90437,
      "author_name": "James10",
      "author_url": "",
      "post_date": "2015-08-26T15:28:10.677000",
      "content": "<p>Excellent work ! just one question, how can visualize the learnt model with your weka implementation?</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 60272,
      "author_name": "Johannes Amtén",
      "author_url": "",
      "post_date": "2014-12-15T20:21:14.930000",
      "content": "<p>[quote=Hang Zhang;60253]</p>\n<p>Hi Amten,</p>\n<p>Thank you for your&nbsp;amazing work! I am&nbsp;trying to use your implementation to another topics on kaggle, 'First step in Julia'. I used the same parameter shown above, and only got 66%. Can you give me some advise on choosing parameters.</p>\n<p>Thanks!</p>\n<p>Hang</p>\n<p>[/quote]</p>\n<p>Thank you. I haven't looked at that problem. Don't know if any other parameters would be better. It seems like 66% is quite a good score on that problem though. The benchmark scores for Random Forest/KNN is just 43% / 41% and a score of 66% would put you at spot 8 on the leaderboard(!)</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 60253,
      "author_name": "Hang Zhang",
      "author_url": "",
      "post_date": "2014-12-15T19:10:33.937000",
      "content": "<p>Hi Amten,</p>\n<p>Thank you for your&nbsp;amazing work! I am&nbsp;trying to use your implementation to another topics on kaggle, 'First step in Julia'. I used the same parameter shown above, and only got 66%. Can you give me some advise on choosing parameters.</p>\n<p>Thanks!</p>\n<p>Hang</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 59446,
      "author_name": "Johannes Amtén",
      "author_url": "",
      "post_date": "2014-12-03T07:58:17.010000",
      "content": "<p>[quote=Yanyanyan;59437]</p>\n<p>Hi Amten,</p>\n<p>Thanks for your implementation.</p>\n<p>I have a question, how should we set the parameter in weka when we use this package.</p>\n<p>For example, &quot;I used two convolutional layers, the first with 20 feature maps, the second with 100 feature maps, both layers with 5x5 patch-size and 2x2 max-pooling.&quot;</p>\n<p>how to set these parameters on weka hiddenlayer input would you please make a screenshot for me?&nbsp;</p>\n<p>Thanks</p>\n<p>[/quote]</p>\n<p>Sure,</p>\n<p>Hidden layers parameter: 20-5-5-2-2,100-5-5-2-2</p>\n<p><img src=\"http://oi62.tinypic.com/155qkq1.jpg\" alt width=\"489\" height=\"505\"></p>\n\n<p>(Also, you can just press the &quot;more&quot; button for an explanation of the parameters in the UI.)</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 59437,
      "author_name": "Yanyanyan",
      "author_url": "",
      "post_date": "2014-12-03T04:21:25.540000",
      "content": "<p>Hi Amten,</p>\n<p>Thanks for your implementation.</p>\n<p>I have a question, how should we set the parameter in weka when we use this package.</p>\n<p>For example, &quot;I used two convolutional layers, the first with 20 feature maps, the second with 100 feature maps, both layers with 5x5 patch-size and 2x2 max-pooling.&quot;</p>\n<p>how to set these parameters on weka hiddenlayer input would you please make a screenshot for me?&nbsp;</p>\n<p>Thanks</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 51562,
      "author_name": "Mike Hall",
      "author_url": "",
      "post_date": "2014-08-03T18:19:42.710000",
      "content": "<p>I have to learn more NN sometime, somewhere. I'm not remembering fully-connected or convolutional coming up in what I've seen so far, which has been pretty much limited to multi-layer perceptron.</p>\n<p>Thanks again.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 51553,
      "author_name": "Johannes Amtén",
      "author_url": "",
      "post_date": "2014-08-03T15:16:24.967000",
      "content": "<p>[quote=Mike Hall;51535]</p>\n<p>Works very nicely, even 'out of the box' with default parameters on this dataset. Is that still convolutional?</p>\n<p>I had to run it command line though due to memory problems with the Weka GUI. (This on OS X - I got rid of the blas related and it ran fine with just the jars. The linux doc link you provided says the OS X veclib [I think it was] implementation is fast enough you don't need to worry about it and it seems to be.</p>\n<p>Thanks.</p>\n<p>[/quote]</p>\n<p>Cool. No, the default setting is a single, fully-connected, hidden layer with 100 Units.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 51535,
      "author_name": "Mike Hall",
      "author_url": "",
      "post_date": "2014-08-02T23:13:08.013000",
      "content": "<p>Works very nicely, even 'out of the box' with default parameters on this dataset. Is that still convolutional?</p>\n<p>I had to run it command line though due to memory problems with the Weka GUI. (This on OS X - I got rid of the blas related and it ran fine with just the jars. The linux doc link you provided says the OS X veclib [I think it was] implementation is fast enough you don't need to worry about it and it seems to be.</p>\n<p>Thanks.</p>",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "41006": "",
    "51563": "",
    "51171": "",
    "51166": "",
    "100685": "Thanks a lot for sharing! I've installed this on WEKA. I'd like to do some image classification (RGB images and greyscale images). But I am not sure how to manage the input for CNN. Should I arrange the images as channel by channel or RGB value by RGB value?  ",
    "100683": "Thank you, Johannes Amtén! It's so good. But I have a question, when I implement your code to recognite characters on Android is very slow. I don't know why. Can you give me some advise how to use it on android.",
    "90437": "Excellent work ! just one question, how can visualize the learnt model with your weka implementation?",
    "60272": "",
    "60253": "",
    "59446": "",
    "59437": "",
    "51562": "",
    "51553": "",
    "51535": ""
  }
}