{
  "id": 12785,
  "title": "Python Code for NN: get 93.33% on LB in 1min  Without GPU",
  "url": "/competitions/digit-recognizer/discussion/12785",
  "author_name": "PengPai",
  "post_date": "2015-03-12T14:20:09.643000",
  "votes": 7,
  "comment_count": 0,
  "views": null,
  "content": "<p>Hey guys. Here is my sample code to construct a two-layer neural networks in Python. I also add one dropout layer to deal with overfitting. It takes <strong>0.7 second</strong> each epoch <strong>without GPU</strong> on my Macbook Pro. To run this code, you have to install the following lib: pandas, sklearn,&nbsp;matplotlib, numpy, <strong>nolearn</strong>, <strong>lasagne</strong>, . As a pythoner, you may familiar with the first three packages which are commonly used in solving machine learning problems. As for the last two libs, they are newly born for building up neural networks based on Theano. Hope you will like it. Also I will post another sample code for Convolutional Neural Networks in these libs.&nbsp;</p>\n<p>ps: notes for my NN.</p>\n<p>Fully connected 3-layers neural network, i.e. two hidden layers(both 100 neurons) followed with drop out layer(drop out probability = 0.25) a output layer. The loss function is softmax and activation function is ReLU. The optimization method is sgd and learning rate is 0.001. Max epoch iterations is 200. Validation accuracy: 93.86%</p>\n<p>In case the image collapse, the snapshot for running progress:&nbsp;http://imgur.com/lMrWAYR</p>",
  "messages": [
    {
      "id": 66041,
      "postDate": "2015-03-12T14:20:09.643Z",
      "content": "<p>Hey guys. Here is my sample code to construct a two-layer neural networks in Python. I also add one dropout layer to deal with overfitting. It takes <strong>0.7 second</strong> each epoch <strong>without GPU</strong> on my Macbook Pro. To run this code, you have to install the following lib: pandas, sklearn,&nbsp;matplotlib, numpy, <strong>nolearn</strong>, <strong>lasagne</strong>, . As a pythoner, you may familiar with the first three packages which are commonly used in solving machine learning problems. As for the last two libs, they are newly born for building up neural networks based on Theano. Hope you will like it. Also I will post another sample code for Convolutional Neural Networks in these libs.&nbsp;</p>\n<p>ps: notes for my NN.</p>\n<p>Fully connected 3-layers neural network, i.e. two hidden layers(both 100 neurons) followed with drop out layer(drop out probability = 0.25) a output layer. The loss function is softmax and activation function is ReLU. The optimization method is sgd and learning rate is 0.001. Max epoch iterations is 200. Validation accuracy: 93.86%</p>\n<p>In case the image collapse, the snapshot for running progress:&nbsp;http://imgur.com/lMrWAYR</p>",
      "votes": 7
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "66041": ""
  }
}