{
  "id": 12652,
  "title": "CNN",
  "url": "/competitions/datasciencebowl/discussion/12652",
  "author_name": "",
  "post_date": "2015-03-02T03:39:17.763Z",
  "votes": null,
  "comment_count": 30,
  "views": 6758,
  "content": "<p>is there is any CNN&nbsp;code for this competition using python lasagne + nolearn ?</p>",
  "messages": [
    {
      "id": "65213",
      "postDate": "03/02/2015 03:39:17",
      "content": "<p>is there is any CNN&nbsp;code for this competition using python lasagne + nolearn ?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65243",
      "postDate": "03/02/2015 15:20:24",
      "content": "<p>Hi,</p>\n<p>I was trying to use lasagne+nolearn, but the results I obtained are very bad! moreover the values I found for MCL with the model on a test set are very different from the ones on the LB.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65246",
      "postDate": "03/02/2015 15:39:16",
      "content": "<p>I am using a lasagne + nolearn setup, you can check it out here:</p>\n<p>https://github.com/msegala/Kaggle-National_Data_Science_Bowl</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65247",
      "postDate": "03/02/2015 15:48:27",
      "content": "<p>[quote=mike1886;65246]</p>\n<p>I am using a lasagne + nolearn setup, you can check it out here:</p>\n<p>https://github.com/msegala/Kaggle-National_Data_Science_Bowl</p>\n<p>[/quote]</p>\n<p>is this your code? what is the logloss do you get with this?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65250",
      "postDate": "03/02/2015 15:51:30",
      "content": "<p>This is not the&nbsp;final code I use for submission, I have spent a long time tweaking this for performance.&nbsp;</p>\n<p>My current log loss is ~0.75.&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65253",
      "postDate": "03/02/2015 16:29:02",
      "content": "<p>Did you find overfitting? I tried with a similar net, without batchiterator, and Maxout, But I found a lot of overfitting.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65254",
      "postDate": "03/02/2015 16:36:22",
      "content": "<p>I was able to get pretty good results by training a deep network with large layers. Of course there is still overfitting but using dropout and maxout layers helps a lot.&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65255",
      "postDate": "03/02/2015 16:36:46",
      "content": "<p>I am just curious here, since Maxout was proposed as an activation function to enhance&nbsp;dropout's model averaging accuracy, why would you put dropout before Maxout? Did you observe any improvement than putting dropout after Maxout?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65258",
      "postDate": "03/02/2015 16:43:00",
      "content": "<p>@yr, do you mean why did I put Maxout before dropout?</p>\n<p>layers=[<br> ('input', layers.InputLayer),<br> ('conv1', Conv2DLayer),<br> ('pool1', MaxPool2DLayer),<br> ('dropout1', layers.DropoutLayer),</p>\n<p>.....</p>\n<p>right now my maxout layers feeds into my drouput layer</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65262",
      "postDate": "03/02/2015 16:52:13",
      "content": "<p>Yes. The part you quoted is max-pooling (across spatial). I mean here:</p>\n<p>('hidden4', layers.DenseLayer),<br> ('dropout4', layers.DropoutLayer),<br> ('maxout4', Maxout),<br> ('hidden5', layers.DenseLayer),<br> ('dropout5', layers.DropoutLayer),<br> ('maxout5', Maxout),<br> ('output', layers.DenseLayer),</p>\n<p>maxout (across feature map) is after&nbsp;dropout. If you treat maxout as activation function, as I understand, it should be something like:</p>\n<p>('hidden4', layers.DenseLayer),<br>('maxout4', Maxout),</p>\n<p>('dropout4', layers.DropoutLayer),</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65263",
      "postDate": "03/02/2015 16:56:06",
      "content": "<p>ah sorry, I looked to quickly. I thought it was supposed this way, I will try to reverse it and let you know.&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65272",
      "postDate": "03/02/2015 17:55:41",
      "content": "<p>I used Lasagne + NoLearn to quickly get a score &lt; 1.0. Pretty standard CNN with several convolutional + max pooling layers followed by fully connected dropout layers. I used RMSprop to train it.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65278",
      "postDate": "03/02/2015 18:56:15",
      "content": "<p>Can someone post a simple code for the prediction? I wrote a training code using CNN similar to the examples&nbsp; following the blog of Nouri</p>\n<p>http://danielnouri.org/notes/2014/12/17/using-convolutional-neural-nets-to-detect-facial-keypoints-tutorial/.</p>\n<p>With the first tests, I found on a test set which consist of a 30% of the shuffled training set a MCL of a value of 1.5~1.6.</p>\n<p>I saved the model on disk&nbsp; and then load the model to make prediction.</p>\n<p>I'm attaching my code for prediction.</p>\n<p>When I post the prediction on LB I found values~10!!!</p>\n<p>Is there something wrong in my prediction code?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65288",
      "postDate": "03/02/2015 20:39:24",
      "content": "<p>Forgot my post| I realized that I may have swapped the classes names in the submission file!</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65295",
      "postDate": "03/02/2015 21:36:08",
      "content": "<p>Mike1886</p>\n<p>How many hour it took you to train the model you posted?</p>\n<p>Do you still using lasagne+nolearn or you switched to Caffe or other frameworks?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65306",
      "postDate": "03/03/2015 00:52:08",
      "content": "<p>Hi Mike,&nbsp;</p>\n<p>Do you get logloss&nbsp;~0.75 just for a single model or is it with&nbsp; model averaging? I'm kind of stuck&nbsp;in ~0.83 and was wondering whether I have to do&nbsp;model averaging to go beyond that?&nbsp;</p>\n<p>Can anyone suggest me some resources about&nbsp;model averaging?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65309",
      "postDate": "03/03/2015 01:35:13",
      "content": "<p>@Akile: I get around 0.78 with my best single model and then when averaging three models together I get around 0.75.&nbsp;</p>\n<p>The way I am doing the averaging (which may not be the best) is to simply average the predictions together. So imagine you had an array,df, that contained your model predictions. Just do something like</p>\n<p>combined = (np.array(df) + np.array(df1) + np.array(df2)) / 3</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65310",
      "postDate": "03/03/2015 01:49:05",
      "content": "<p>Please can u check whats wrong with my code. I am trying to use the simplest one layer network</p>\n<p>pixelNo = 10<br>imageSize = pixelNo*pixelNo<br>rowsNo = 30336<br>l = range(rowsNo)</p>\n<p><br>def readTrainingImagesCNN(imagesPath):<br> directory_names = list(set(glob.glob(os.path.join(imagesPath, &quot;train&quot;, &quot;*&quot;))\\<br> ).difference(set(glob.glob(os.path.join(imagesPath, &quot;train&quot;, &quot;*.*&quot;)))))</p>\n<p>label = 0<br> images = list()<br> header = list()<br> targets = list()</p>\n<p>for folder in directory_names:<br> header.append(folder.split(&quot;\\\\&quot;)[-1])<br> for fileNameDir in os.walk(folder):<br> for fileName in fileNameDir[2]:<br> if fileName[-4:] != &quot;.jpg&quot;:<br> continue<br> imageReading = &quot;{0}{1}{2}&quot;.format(fileNameDir[0], os.sep, fileName)<br> images.append(imread(imageReading, as_grey=True))<br> targets.append(label)<br> label += 1<br> header = &quot;,&quot;.join(header)<br> return images, targets, header</p>\n\n<p>def imageResizingCNN(images, size):<br> imagesResized = list()<br> for image in images:<br> imagesResized.append(resize(image, (size, size)))<br> del images<br> return imagesResized</p>\n\n<p>print &quot;Image reading&quot;<br>t = time()<br>images, targets, header = readTrainingImagesCNN(root)<br>print &quot;Time: &quot;, round(time()-t, 3), &quot;\\n&quot;</p>\n\n<p>print &quot;Image resizing&quot;<br>t = time()<br>imagesResized = imageResizingCNN(images, pixelNo)<br>print &quot;Time: &quot;, round(time()-t, 3), &quot;\\n&quot;</p>\n<p>del images</p>\n\n<p>print &quot;Reshaping Images&quot;<br>imageFeatures = np.zeros((rowsNo, imageSize), dtype=float)<br>t = time()<br>for i in l:<br> imageFeatures[i, :] = np.reshape(imagesResized[i], (1, imageSize))<br>print &quot;Time: &quot;, round(time()-t, 3), &quot;\\n&quot;</p>\n<p><br>features = imageFeatures<br>targets = np.asarray(targets)<br>del imagesResized, imageFeatures</p>\n<p>print &quot;features &quot;, features.shape<br>print &quot;targets&quot;, targets.shape</p>\n<p><br>netOneLayer = NeuralNet(<br> layers=[<br> ('input', layers.InputLayer),<br> ('hidden', layers.DenseLayer),<br> ('output', layers.DenseLayer),<br> ],</p>\n<p>input_shape=(None, imageSize),<br> hidden_num_units=100,<br> output_nonlinearity=None,<br> output_num_units=121,</p>\n<p>update=nesterov_momentum,<br> update_learning_rate=0.01,<br> update_momentum=0.9,</p>\n<p>regression=False,<br> max_epochs=100,<br> verbose=1,<br>)</p>\n<p>features2 = features[0:1000, :]<br>targets2 = targets[0:1000]<br>netOneLayer.fit(features2, targets2)</p>\n<p><br>print &quot;Total time: &quot;, round(time()-totalTime, 3)</p>\n\n<p>The code is running well but the neural output is the following&nbsp;</p>\n<p>I don't know where the bug</p>\n\n<p>InputLayer (None, 100) produces 100 outputs<br> DenseLayer (None, 100) produces 100 outputs<br> DenseLayer (None, 121) produces 121 outputs</p>\n<p>Epoch | Train loss | Valid loss | Train / Val | Valid acc | Dur<br>--------|--------------|--------------|---------------|-------------|-------<br> 1 | nan | nan | nan | 5.86% | 0.0s<br> 2 | nan | nan | nan | 5.86% | 0.0s<br> 3 | nan | nan | nan | 5.86% | 0.0s<br> 4 | nan | nan | nan | 5.86% | 0.0s<br> 5 | nan | nan | nan | 5.86% | 0.0s<br> 6 | nan | nan | nan | 5.86% | 0.0s<br> 7 | nan | nan | nan | 5.86% | 0.0s<br> 8 | nan | nan | nan | 31.25% | 0.0s<br> 9 | nan | nan | nan | 30.86% | 0.0s<br> 10 | nan | nan | nan | 30.86% | 0.0s<br> 11 | nan | nan | nan | 30.86% | 0.0s<br> 12 | nan | nan | nan | 30.86% | 0.0s<br> 13 | nan | nan | nan | 30.86% | 0.0s<br> 14 | nan | nan | nan | 30.86% | 0.0s<br> 15 | nan | nan | nan | 30.86% | 0.0s<br> 16 | nan | nan | nan | 30.86% | 0.0s<br> 17 | nan | nan | nan | 30.86% | 0.0s<br> 18 | nan | nan | nan | 30.86% | 0.0s<br> 19 | nan | nan | nan | 30.86% | 0.0s<br> 20 | nan | nan | nan | 30.86% | 0.0s<br> 21 | nan | nan | nan | 30.86% | 0.0s<br> 22 | nan | nan | nan | 30.86% | 0.0s<br> 23 | nan | nan | nan | 30.86% | 0.0s<br> 24 | nan | nan | nan | 30.86% | 0.0s<br> 25 | nan | nan | nan | 30.86% | 0.0s<br> 26 | nan | nan | nan | 30.86% | 0.0s<br> 27 | nan | nan | nan | 30.86% | 0.0s<br> 28 | nan | nan | nan | 30.86% | 0.0s<br> 29 | nan | nan | nan | 30.86% | 0.0s<br> 30 | nan | nan | nan | 30.86% | 0.0s<br> 31 | nan | nan | nan | 30.86% | 0.0s<br> 32 | nan | nan | nan | 30.86% | 0.0s<br> 33 | nan | nan | nan | 30.86% | 0.0s<br> 34 | nan | nan | nan | 30.86% | 0.0s<br> 35 | nan | nan | nan | 30.86% | 0.0s<br> 36 | nan | nan | nan | 30.86% | 0.0s<br> 37 | nan | nan | nan | 30.86% | 0.0s<br> 38 | nan | nan | nan | 30.86% | 0.0s<br> 39 | nan | nan | nan | 30.86% | 0.0s<br> 40 | nan | nan | nan | 30.86% | 0.0s<br> 41 | nan | nan | nan | 30.86% | 0.0s<br> 42 | nan | nan | nan | 30.86% | 0.0s<br> 43 | nan | nan | nan | 30.86% | 0.0s<br> 44 | nan | nan | nan | 30.86% | 0.0s<br> 45 | nan | nan | nan | 30.86% | 0.0s<br> 46 | nan | nan | nan | 30.86% | 0.0s<br> 47 | nan | nan | nan | 30.86% | 0.0s<br> 48 | nan | nan | nan | 30.86% | 0.0s<br> 49 | nan | nan | nan | 30.86% | 0.0s<br> 50 | nan | nan | nan | 30.86% | 0.0s<br> 51 | nan | nan | nan | 30.86% | 0.0s<br> 52 | nan | nan | nan | 30.86% | 0.0s<br> 53 | nan | nan | nan | 30.86% | 0.0s<br> 54 | nan | nan | nan | 30.86% | 0.0s<br> 55 | nan | nan | nan | 30.86% | 0.0s<br> 56 | nan | nan | nan | 30.86% | 0.0s<br> 57 | nan | nan | nan | 30.86% | 0.0s<br> 58 | nan | nan | nan | 30.86% | 0.0s<br> 59 | nan | nan | nan | 30.86% | 0.0s<br> 60 | nan | nan | nan | 30.86% | 0.0s<br> 61 | nan | nan | nan | 30.86% | 0.0s<br> 62 | nan | nan | nan | 30.86% | 0.0s<br> 63 | nan | nan | nan | 30.86% | 0.0s<br> 64 | nan | nan | nan | 30.86% | 0.0s<br> 65 | nan | nan | nan | 30.86% | 0.0s<br> 66 | nan | nan | nan | 30.86% | 0.0s<br> 67 | nan | nan | nan | 30.86% | 0.0s<br> 68 | nan | nan | nan | 30.86% | 0.0s<br> 69 | nan | nan | nan | 30.86% | 0.0s<br> 70 | nan | nan | nan | 30.86% | 0.0s<br> 71 | nan | nan | nan | 30.86% | 0.0s<br> 72 | nan | nan | nan | 30.86% | 0.0s<br> 73 | nan | nan | nan | 30.86% | 0.0s<br> 74 | nan | nan | nan | 30.86% | 0.0s<br> 75 | nan | nan | nan | 30.86% | 0.0s<br> 76 | nan | nan | nan | 30.86% | 0.0s<br> 77 | nan | nan | nan | 30.86% | 0.0s<br> 78 | nan | nan | nan | 30.86% | 0.0s<br> 79 | nan | nan | nan | 30.86% | 0.0s<br> 80 | nan | nan | nan | 30.86% | 0.0s<br> 81 | nan | nan | nan | 30.86% | 0.0s<br> 82 | nan | nan | nan | 30.86% | 0.0s<br> 83 | nan | nan | nan | 30.86% | 0.0s<br> 84 | nan | nan | nan | 30.86% | 0.0s<br> 85 | nan | nan | nan | 30.86% | 0.0s<br> 86 | nan | nan | nan | 30.86% | 0.0s<br> 87 | nan | nan | nan | 30.86% | 0.0s<br> 88 | nan | nan | nan | 30.86% | 0.0s<br> 89 | nan | nan | nan | 30.86% | 0.0s<br> 90 | nan | nan | nan | 30.86% | 0.0s<br> 91 | nan | nan | nan | 30.86% | 0.0s<br> 92 | nan | nan | nan | 30.86% | 0.0s<br> 93 | nan | nan | nan | 30.86% | 0.0s<br> 94 | nan | nan | nan | 30.86% | 0.0s<br> 95 | nan | nan | nan | 30.86% | 0.0s<br> 96 | nan | nan | nan | 30.86% | 0.0s<br> 97 | nan | nan | nan | 30.86% | 0.0s<br> 98 | nan | nan | nan | 30.86% | 0.0s<br> 99 | nan | nan | nan | 30.86% | 0.0s<br> 100 | nan | nan | nan | 30.86% | 0.0s<br>Total time: 21.955</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65311",
      "postDate": "03/03/2015 01:55:11",
      "content": "<p>It may be to simple, try something more realistic like 60 pixels and a bit more complex network. I had issues like this when things were way off from ideal.&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65313",
      "postDate": "03/03/2015 02:27:06",
      "content": "<p>I am planning to do that but I need to make this network work to make sure am in the right direction</p>\n<p>I think may be the problem is with targets coz it suppose to be 121 but am sending it as int</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65314",
      "postDate": "03/03/2015 02:35:25",
      "content": "<p>@Data-Lover, if you want your network to output probabilities, you should probably have a softmax (or similar) non-linearity on your output layer.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65335",
      "postDate": "03/03/2015 14:09:12",
      "content": "<p>Thanks Mike. I guess it better to start model averaging now. I tried to use large layers as you told. I couldn't get any improvement by doing that, may be I should try some more configurations.&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65353",
      "postDate": "03/03/2015 18:24:36",
      "content": "<p>This is a very similar version of CNN based on&nbsp; no-learn, lasagne as Mike's one</p>\n<p>https://github.com/elenacuoco/Bowl</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65357",
      "postDate": "03/03/2015 19:23:11",
      "content": "<p>@Elena, what logloss score are you currently getting for your single best model?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65361",
      "postDate": "03/03/2015 21:07:41",
      "content": "<p>[quote=mike1886;65357]</p>\n<p>@Elena, what logloss score are you currently getting for your single best model?</p>\n<p>[/quote]</p>\n<p>For the moment ~1.2</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65363",
      "postDate": "03/03/2015 21:59:49",
      "content": "<p>Thanks Elena for sharing</p>\n<p>just one note don't do image reading and feature extraction at the same time because it make the program slow. read all images first then do feature extraction this will increase speed more than 10 times</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65372",
      "postDate": "03/04/2015 01:05:35",
      "content": "<p>Ok guys model averaging would definitely help. I averaged over four&nbsp;models and got to 0.785861&nbsp;from&nbsp;0.830915</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65380",
      "postDate": "03/04/2015 04:45:48",
      "content": "<p>@mike1886, where does your Maxout layer come from ? It seems that lasagne.layers have only provide the definition for dense, conv, maxpooling. And what does such maxout layer do ?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65428",
      "postDate": "03/04/2015 18:53:53",
      "content": "<p>Add this line of code above your model definition:<br>Maxout = layers.pool.FeaturePoolLayer</p>\n<p>http://stats.stackexchange.com/questions/129698/what-is-maxout-in-neural-network</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "65505",
      "postDate": "03/05/2015 13:05:30",
      "content": "<p>Many thanks Mike1886 and Elena Cuocu</p>\n<p>I got my first CNN working. it is far from being good but at least it is working &nbsp;,)</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "3482188",
      "postDate": "06/26/2026 22:37:55",
      "content": "<p>Spot on! This context underscores why automated plankton classification and tracking is so important. Historically, Kaggle has hosted amazing competitions focused on plankton imagery. Building accurate Computer Vision models to monitor these populations can directly help marine biologists detect ecological upheaval before it's too late. High-impact domain!</p>",
      "rawMarkdown": "Spot on! This context underscores why automated plankton classification and tracking is so important. Historically, Kaggle has hosted amazing competitions focused on plankton imagery. Building accurate Computer Vision models to monitor these populations can directly help marine biologists detect ecological upheaval before it's too late. High-impact domain!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 3482188,
      "author_name": "",
      "author_url": "",
      "post_date": "06/26/2026 22:37:55",
      "content": "<p>Spot on! This context underscores why automated plankton classification and tracking is so important. Historically, Kaggle has hosted amazing competitions focused on plankton imagery. Building accurate Computer Vision models to monitor these populations can directly help marine biologists detect ecological upheaval before it's too late. High-impact domain!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65243,
      "author_name": "elenacuoco",
      "author_url": "",
      "post_date": "03/02/2015 15:20:24",
      "content": "<p>Hi,</p>\n<p>I was trying to use lasagne+nolearn, but the results I obtained are very bad! moreover the values I found for MCL with the model on a test set are very different from the ones on the LB.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65246,
      "author_name": "msegala",
      "author_url": "",
      "post_date": "03/02/2015 15:39:16",
      "content": "<p>I am using a lasagne + nolearn setup, you can check it out here:</p>\n<p>https://github.com/msegala/Kaggle-National_Data_Science_Bowl</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65247,
      "author_name": "abhishek",
      "author_url": "",
      "post_date": "03/02/2015 15:48:27",
      "content": "<p>[quote=mike1886;65246]</p>\n<p>I am using a lasagne + nolearn setup, you can check it out here:</p>\n<p>https://github.com/msegala/Kaggle-National_Data_Science_Bowl</p>\n<p>[/quote]</p>\n<p>is this your code? what is the logloss do you get with this?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65250,
      "author_name": "msegala",
      "author_url": "",
      "post_date": "03/02/2015 15:51:30",
      "content": "<p>This is not the&nbsp;final code I use for submission, I have spent a long time tweaking this for performance.&nbsp;</p>\n<p>My current log loss is ~0.75.&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65253,
      "author_name": "elenacuoco",
      "author_url": "",
      "post_date": "03/02/2015 16:29:02",
      "content": "<p>Did you find overfitting? I tried with a similar net, without batchiterator, and Maxout, But I found a lot of overfitting.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65254,
      "author_name": "msegala",
      "author_url": "",
      "post_date": "03/02/2015 16:36:22",
      "content": "<p>I was able to get pretty good results by training a deep network with large layers. Of course there is still overfitting but using dropout and maxout layers helps a lot.&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65255,
      "author_name": "chenglongchen",
      "author_url": "",
      "post_date": "03/02/2015 16:36:46",
      "content": "<p>I am just curious here, since Maxout was proposed as an activation function to enhance&nbsp;dropout's model averaging accuracy, why would you put dropout before Maxout? Did you observe any improvement than putting dropout after Maxout?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65258,
      "author_name": "msegala",
      "author_url": "",
      "post_date": "03/02/2015 16:43:00",
      "content": "<p>@yr, do you mean why did I put Maxout before dropout?</p>\n<p>layers=[<br> ('input', layers.InputLayer),<br> ('conv1', Conv2DLayer),<br> ('pool1', MaxPool2DLayer),<br> ('dropout1', layers.DropoutLayer),</p>\n<p>.....</p>\n<p>right now my maxout layers feeds into my drouput layer</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65262,
      "author_name": "chenglongchen",
      "author_url": "",
      "post_date": "03/02/2015 16:52:13",
      "content": "<p>Yes. The part you quoted is max-pooling (across spatial). I mean here:</p>\n<p>('hidden4', layers.DenseLayer),<br> ('dropout4', layers.DropoutLayer),<br> ('maxout4', Maxout),<br> ('hidden5', layers.DenseLayer),<br> ('dropout5', layers.DropoutLayer),<br> ('maxout5', Maxout),<br> ('output', layers.DenseLayer),</p>\n<p>maxout (across feature map) is after&nbsp;dropout. If you treat maxout as activation function, as I understand, it should be something like:</p>\n<p>('hidden4', layers.DenseLayer),<br>('maxout4', Maxout),</p>\n<p>('dropout4', layers.DropoutLayer),</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65263,
      "author_name": "msegala",
      "author_url": "",
      "post_date": "03/02/2015 16:56:06",
      "content": "<p>ah sorry, I looked to quickly. I thought it was supposed this way, I will try to reverse it and let you know.&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65272,
      "author_name": "albeam",
      "author_url": "",
      "post_date": "03/02/2015 17:55:41",
      "content": "<p>I used Lasagne + NoLearn to quickly get a score &lt; 1.0. Pretty standard CNN with several convolutional + max pooling layers followed by fully connected dropout layers. I used RMSprop to train it.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65278,
      "author_name": "elenacuoco",
      "author_url": "",
      "post_date": "03/02/2015 18:56:15",
      "content": "<p>Can someone post a simple code for the prediction? I wrote a training code using CNN similar to the examples&nbsp; following the blog of Nouri</p>\n<p>http://danielnouri.org/notes/2014/12/17/using-convolutional-neural-nets-to-detect-facial-keypoints-tutorial/.</p>\n<p>With the first tests, I found on a test set which consist of a 30% of the shuffled training set a MCL of a value of 1.5~1.6.</p>\n<p>I saved the model on disk&nbsp; and then load the model to make prediction.</p>\n<p>I'm attaching my code for prediction.</p>\n<p>When I post the prediction on LB I found values~10!!!</p>\n<p>Is there something wrong in my prediction code?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65288,
      "author_name": "elenacuoco",
      "author_url": "",
      "post_date": "03/02/2015 20:39:24",
      "content": "<p>Forgot my post| I realized that I may have swapped the classes names in the submission file!</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65295,
      "author_name": "",
      "author_url": "",
      "post_date": "03/02/2015 21:36:08",
      "content": "<p>Mike1886</p>\n<p>How many hour it took you to train the model you posted?</p>\n<p>Do you still using lasagne+nolearn or you switched to Caffe or other frameworks?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65306,
      "author_name": "akilaw",
      "author_url": "",
      "post_date": "03/03/2015 00:52:08",
      "content": "<p>Hi Mike,&nbsp;</p>\n<p>Do you get logloss&nbsp;~0.75 just for a single model or is it with&nbsp; model averaging? I'm kind of stuck&nbsp;in ~0.83 and was wondering whether I have to do&nbsp;model averaging to go beyond that?&nbsp;</p>\n<p>Can anyone suggest me some resources about&nbsp;model averaging?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65309,
      "author_name": "msegala",
      "author_url": "",
      "post_date": "03/03/2015 01:35:13",
      "content": "<p>@Akile: I get around 0.78 with my best single model and then when averaging three models together I get around 0.75.&nbsp;</p>\n<p>The way I am doing the averaging (which may not be the best) is to simply average the predictions together. So imagine you had an array,df, that contained your model predictions. Just do something like</p>\n<p>combined = (np.array(df) + np.array(df1) + np.array(df2)) / 3</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65310,
      "author_name": "",
      "author_url": "",
      "post_date": "03/03/2015 01:49:05",
      "content": "<p>Please can u check whats wrong with my code. I am trying to use the simplest one layer network</p>\n<p>pixelNo = 10<br>imageSize = pixelNo*pixelNo<br>rowsNo = 30336<br>l = range(rowsNo)</p>\n<p><br>def readTrainingImagesCNN(imagesPath):<br> directory_names = list(set(glob.glob(os.path.join(imagesPath, &quot;train&quot;, &quot;*&quot;))\\<br> ).difference(set(glob.glob(os.path.join(imagesPath, &quot;train&quot;, &quot;*.*&quot;)))))</p>\n<p>label = 0<br> images = list()<br> header = list()<br> targets = list()</p>\n<p>for folder in directory_names:<br> header.append(folder.split(&quot;\\\\&quot;)[-1])<br> for fileNameDir in os.walk(folder):<br> for fileName in fileNameDir[2]:<br> if fileName[-4:] != &quot;.jpg&quot;:<br> continue<br> imageReading = &quot;{0}{1}{2}&quot;.format(fileNameDir[0], os.sep, fileName)<br> images.append(imread(imageReading, as_grey=True))<br> targets.append(label)<br> label += 1<br> header = &quot;,&quot;.join(header)<br> return images, targets, header</p>\n\n<p>def imageResizingCNN(images, size):<br> imagesResized = list()<br> for image in images:<br> imagesResized.append(resize(image, (size, size)))<br> del images<br> return imagesResized</p>\n\n<p>print &quot;Image reading&quot;<br>t = time()<br>images, targets, header = readTrainingImagesCNN(root)<br>print &quot;Time: &quot;, round(time()-t, 3), &quot;\\n&quot;</p>\n\n<p>print &quot;Image resizing&quot;<br>t = time()<br>imagesResized = imageResizingCNN(images, pixelNo)<br>print &quot;Time: &quot;, round(time()-t, 3), &quot;\\n&quot;</p>\n<p>del images</p>\n\n<p>print &quot;Reshaping Images&quot;<br>imageFeatures = np.zeros((rowsNo, imageSize), dtype=float)<br>t = time()<br>for i in l:<br> imageFeatures[i, :] = np.reshape(imagesResized[i], (1, imageSize))<br>print &quot;Time: &quot;, round(time()-t, 3), &quot;\\n&quot;</p>\n<p><br>features = imageFeatures<br>targets = np.asarray(targets)<br>del imagesResized, imageFeatures</p>\n<p>print &quot;features &quot;, features.shape<br>print &quot;targets&quot;, targets.shape</p>\n<p><br>netOneLayer = NeuralNet(<br> layers=[<br> ('input', layers.InputLayer),<br> ('hidden', layers.DenseLayer),<br> ('output', layers.DenseLayer),<br> ],</p>\n<p>input_shape=(None, imageSize),<br> hidden_num_units=100,<br> output_nonlinearity=None,<br> output_num_units=121,</p>\n<p>update=nesterov_momentum,<br> update_learning_rate=0.01,<br> update_momentum=0.9,</p>\n<p>regression=False,<br> max_epochs=100,<br> verbose=1,<br>)</p>\n<p>features2 = features[0:1000, :]<br>targets2 = targets[0:1000]<br>netOneLayer.fit(features2, targets2)</p>\n<p><br>print &quot;Total time: &quot;, round(time()-totalTime, 3)</p>\n\n<p>The code is running well but the neural output is the following&nbsp;</p>\n<p>I don't know where the bug</p>\n\n<p>InputLayer (None, 100) produces 100 outputs<br> DenseLayer (None, 100) produces 100 outputs<br> DenseLayer (None, 121) produces 121 outputs</p>\n<p>Epoch | Train loss | Valid loss | Train / Val | Valid acc | Dur<br>--------|--------------|--------------|---------------|-------------|-------<br> 1 | nan | nan | nan | 5.86% | 0.0s<br> 2 | nan | nan | nan | 5.86% | 0.0s<br> 3 | nan | nan | nan | 5.86% | 0.0s<br> 4 | nan | nan | nan | 5.86% | 0.0s<br> 5 | nan | nan | nan | 5.86% | 0.0s<br> 6 | nan | nan | nan | 5.86% | 0.0s<br> 7 | nan | nan | nan | 5.86% | 0.0s<br> 8 | nan | nan | nan | 31.25% | 0.0s<br> 9 | nan | nan | nan | 30.86% | 0.0s<br> 10 | nan | nan | nan | 30.86% | 0.0s<br> 11 | nan | nan | nan | 30.86% | 0.0s<br> 12 | nan | nan | nan | 30.86% | 0.0s<br> 13 | nan | nan | nan | 30.86% | 0.0s<br> 14 | nan | nan | nan | 30.86% | 0.0s<br> 15 | nan | nan | nan | 30.86% | 0.0s<br> 16 | nan | nan | nan | 30.86% | 0.0s<br> 17 | nan | nan | nan | 30.86% | 0.0s<br> 18 | nan | nan | nan | 30.86% | 0.0s<br> 19 | nan | nan | nan | 30.86% | 0.0s<br> 20 | nan | nan | nan | 30.86% | 0.0s<br> 21 | nan | nan | nan | 30.86% | 0.0s<br> 22 | nan | nan | nan | 30.86% | 0.0s<br> 23 | nan | nan | nan | 30.86% | 0.0s<br> 24 | nan | nan | nan | 30.86% | 0.0s<br> 25 | nan | nan | nan | 30.86% | 0.0s<br> 26 | nan | nan | nan | 30.86% | 0.0s<br> 27 | nan | nan | nan | 30.86% | 0.0s<br> 28 | nan | nan | nan | 30.86% | 0.0s<br> 29 | nan | nan | nan | 30.86% | 0.0s<br> 30 | nan | nan | nan | 30.86% | 0.0s<br> 31 | nan | nan | nan | 30.86% | 0.0s<br> 32 | nan | nan | nan | 30.86% | 0.0s<br> 33 | nan | nan | nan | 30.86% | 0.0s<br> 34 | nan | nan | nan | 30.86% | 0.0s<br> 35 | nan | nan | nan | 30.86% | 0.0s<br> 36 | nan | nan | nan | 30.86% | 0.0s<br> 37 | nan | nan | nan | 30.86% | 0.0s<br> 38 | nan | nan | nan | 30.86% | 0.0s<br> 39 | nan | nan | nan | 30.86% | 0.0s<br> 40 | nan | nan | nan | 30.86% | 0.0s<br> 41 | nan | nan | nan | 30.86% | 0.0s<br> 42 | nan | nan | nan | 30.86% | 0.0s<br> 43 | nan | nan | nan | 30.86% | 0.0s<br> 44 | nan | nan | nan | 30.86% | 0.0s<br> 45 | nan | nan | nan | 30.86% | 0.0s<br> 46 | nan | nan | nan | 30.86% | 0.0s<br> 47 | nan | nan | nan | 30.86% | 0.0s<br> 48 | nan | nan | nan | 30.86% | 0.0s<br> 49 | nan | nan | nan | 30.86% | 0.0s<br> 50 | nan | nan | nan | 30.86% | 0.0s<br> 51 | nan | nan | nan | 30.86% | 0.0s<br> 52 | nan | nan | nan | 30.86% | 0.0s<br> 53 | nan | nan | nan | 30.86% | 0.0s<br> 54 | nan | nan | nan | 30.86% | 0.0s<br> 55 | nan | nan | nan | 30.86% | 0.0s<br> 56 | nan | nan | nan | 30.86% | 0.0s<br> 57 | nan | nan | nan | 30.86% | 0.0s<br> 58 | nan | nan | nan | 30.86% | 0.0s<br> 59 | nan | nan | nan | 30.86% | 0.0s<br> 60 | nan | nan | nan | 30.86% | 0.0s<br> 61 | nan | nan | nan | 30.86% | 0.0s<br> 62 | nan | nan | nan | 30.86% | 0.0s<br> 63 | nan | nan | nan | 30.86% | 0.0s<br> 64 | nan | nan | nan | 30.86% | 0.0s<br> 65 | nan | nan | nan | 30.86% | 0.0s<br> 66 | nan | nan | nan | 30.86% | 0.0s<br> 67 | nan | nan | nan | 30.86% | 0.0s<br> 68 | nan | nan | nan | 30.86% | 0.0s<br> 69 | nan | nan | nan | 30.86% | 0.0s<br> 70 | nan | nan | nan | 30.86% | 0.0s<br> 71 | nan | nan | nan | 30.86% | 0.0s<br> 72 | nan | nan | nan | 30.86% | 0.0s<br> 73 | nan | nan | nan | 30.86% | 0.0s<br> 74 | nan | nan | nan | 30.86% | 0.0s<br> 75 | nan | nan | nan | 30.86% | 0.0s<br> 76 | nan | nan | nan | 30.86% | 0.0s<br> 77 | nan | nan | nan | 30.86% | 0.0s<br> 78 | nan | nan | nan | 30.86% | 0.0s<br> 79 | nan | nan | nan | 30.86% | 0.0s<br> 80 | nan | nan | nan | 30.86% | 0.0s<br> 81 | nan | nan | nan | 30.86% | 0.0s<br> 82 | nan | nan | nan | 30.86% | 0.0s<br> 83 | nan | nan | nan | 30.86% | 0.0s<br> 84 | nan | nan | nan | 30.86% | 0.0s<br> 85 | nan | nan | nan | 30.86% | 0.0s<br> 86 | nan | nan | nan | 30.86% | 0.0s<br> 87 | nan | nan | nan | 30.86% | 0.0s<br> 88 | nan | nan | nan | 30.86% | 0.0s<br> 89 | nan | nan | nan | 30.86% | 0.0s<br> 90 | nan | nan | nan | 30.86% | 0.0s<br> 91 | nan | nan | nan | 30.86% | 0.0s<br> 92 | nan | nan | nan | 30.86% | 0.0s<br> 93 | nan | nan | nan | 30.86% | 0.0s<br> 94 | nan | nan | nan | 30.86% | 0.0s<br> 95 | nan | nan | nan | 30.86% | 0.0s<br> 96 | nan | nan | nan | 30.86% | 0.0s<br> 97 | nan | nan | nan | 30.86% | 0.0s<br> 98 | nan | nan | nan | 30.86% | 0.0s<br> 99 | nan | nan | nan | 30.86% | 0.0s<br> 100 | nan | nan | nan | 30.86% | 0.0s<br>Total time: 21.955</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65311,
      "author_name": "msegala",
      "author_url": "",
      "post_date": "03/03/2015 01:55:11",
      "content": "<p>It may be to simple, try something more realistic like 60 pixels and a bit more complex network. I had issues like this when things were way off from ideal.&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65313,
      "author_name": "",
      "author_url": "",
      "post_date": "03/03/2015 02:27:06",
      "content": "<p>I am planning to do that but I need to make this network work to make sure am in the right direction</p>\n<p>I think may be the problem is with targets coz it suppose to be 121 but am sending it as int</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65314,
      "author_name": "hendrikw",
      "author_url": "",
      "post_date": "03/03/2015 02:35:25",
      "content": "<p>@Data-Lover, if you want your network to output probabilities, you should probably have a softmax (or similar) non-linearity on your output layer.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65335,
      "author_name": "akilaw",
      "author_url": "",
      "post_date": "03/03/2015 14:09:12",
      "content": "<p>Thanks Mike. I guess it better to start model averaging now. I tried to use large layers as you told. I couldn't get any improvement by doing that, may be I should try some more configurations.&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65353,
      "author_name": "elenacuoco",
      "author_url": "",
      "post_date": "03/03/2015 18:24:36",
      "content": "<p>This is a very similar version of CNN based on&nbsp; no-learn, lasagne as Mike's one</p>\n<p>https://github.com/elenacuoco/Bowl</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65357,
      "author_name": "msegala",
      "author_url": "",
      "post_date": "03/03/2015 19:23:11",
      "content": "<p>@Elena, what logloss score are you currently getting for your single best model?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65361,
      "author_name": "elenacuoco",
      "author_url": "",
      "post_date": "03/03/2015 21:07:41",
      "content": "<p>[quote=mike1886;65357]</p>\n<p>@Elena, what logloss score are you currently getting for your single best model?</p>\n<p>[/quote]</p>\n<p>For the moment ~1.2</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65363,
      "author_name": "",
      "author_url": "",
      "post_date": "03/03/2015 21:59:49",
      "content": "<p>Thanks Elena for sharing</p>\n<p>just one note don't do image reading and feature extraction at the same time because it make the program slow. read all images first then do feature extraction this will increase speed more than 10 times</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65372,
      "author_name": "akilaw",
      "author_url": "",
      "post_date": "03/04/2015 01:05:35",
      "content": "<p>Ok guys model averaging would definitely help. I averaged over four&nbsp;models and got to 0.785861&nbsp;from&nbsp;0.830915</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65380,
      "author_name": "pengpai",
      "author_url": "",
      "post_date": "03/04/2015 04:45:48",
      "content": "<p>@mike1886, where does your Maxout layer come from ? It seems that lasagne.layers have only provide the definition for dense, conv, maxpooling. And what does such maxout layer do ?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65428,
      "author_name": "stevenreitsma",
      "author_url": "",
      "post_date": "03/04/2015 18:53:53",
      "content": "<p>Add this line of code above your model definition:<br>Maxout = layers.pool.FeaturePoolLayer</p>\n<p>http://stats.stackexchange.com/questions/129698/what-is-maxout-in-neural-network</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 65505,
      "author_name": "",
      "author_url": "",
      "post_date": "03/05/2015 13:05:30",
      "content": "<p>Many thanks Mike1886 and Elena Cuocu</p>\n<p>I got my first CNN working. it is far from being good but at least it is working &nbsp;,)</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "65213": "",
    "65243": "",
    "65246": "",
    "65247": "",
    "65250": "",
    "65253": "",
    "65254": "",
    "65255": "",
    "65258": "",
    "65262": "",
    "65263": "",
    "65272": "",
    "65278": "",
    "65288": "",
    "65295": "",
    "65306": "",
    "65309": "",
    "65310": "",
    "65311": "",
    "65313": "",
    "65314": "",
    "65335": "",
    "65353": "",
    "65357": "",
    "65361": "",
    "65363": "",
    "65372": "",
    "65380": "",
    "65428": "",
    "65505": "",
    "3482188": "Spot on! This context underscores why automated plankton classification and tracking is so important. Historically, Kaggle has hosted amazing competitions focused on plankton imagery. Building accurate Computer Vision models to monitor these populations can directly help marine biologists detect ecological upheaval before it's too late. High-impact domain!"
  },
  "source": "meta"
}