{
  "id": 255973,
  "title": "How do i need to submit my predictions to CSV via TensorFlow?",
  "url": "/competitions/digit-recognizer/discussion/255973",
  "author_name": "Dino Wun",
  "post_date": "2021-07-30T07:25:53.247000",
  "votes": 2,
  "comment_count": 3,
  "views": null,
  "content": "<p>After I am being confident about my predictions over the digits in the MNIST with Matplotlib and TensorFlow, I ran into a problem that I need to submit my predictions with the CSV. I tried everything to use NumPy to save my predictions using np.savetxt(), but that ended in failure because my predictions were 3D, not 2D and 1D. What can I do to save my predictions via TensorFlow (and NumPy)?</p>",
  "messages": [
    {
      "id": 1404712,
      "postDate": "2021-07-30T07:25:53.247Z",
      "content": "<p>After I am being confident about my predictions over the digits in the MNIST with Matplotlib and TensorFlow, I ran into a problem that I need to submit my predictions with the CSV. I tried everything to use NumPy to save my predictions using np.savetxt(), but that ended in failure because my predictions were 3D, not 2D and 1D. What can I do to save my predictions via TensorFlow (and NumPy)?</p>",
      "rawMarkdown": "After I am being confident about my predictions over the digits in the MNIST with Matplotlib and TensorFlow, I ran into a problem that I need to submit my predictions with the CSV. I tried everything to use NumPy to save my predictions using np.savetxt(), but that ended in failure because my predictions were 3D, not 2D and 1D. What can I do to save my predictions via TensorFlow (and NumPy)?",
      "votes": 2
    },
    {
      "id": 1498684,
      "postDate": "2021-09-01T06:01:33.437Z",
      "content": "<p><a href=\"https://www.kaggle.com/vsushant/cnn-based-architecture-99?scriptVersionId=73654701\" target=\"_blank\">https://www.kaggle.com/vsushant/cnn-based-architecture-99?scriptVersionId=73654701</a></p>\n<p>Check this out for reference. </p>",
      "rawMarkdown": "[https://www.kaggle.com/vsushant/cnn-based-architecture-99?scriptVersionId=73654701](https://www.kaggle.com/vsushant/cnn-based-architecture-99?scriptVersionId=73654701)\n\nCheck this out for reference. "
    },
    {
      "id": 1474856,
      "postDate": "2021-08-16T09:55:06.413Z",
      "content": "<p>I think this notebook may help you.<br>\n<a href=\"https://www.kaggle.com/curiousprogrammer/lenet-5-cnn-with-keras-99-48/output\" target=\"_blank\">https://www.kaggle.com/curiousprogrammer/lenet-5-cnn-with-keras-99-48/output</a></p>",
      "rawMarkdown": "I think this notebook may help you.\nhttps://www.kaggle.com/curiousprogrammer/lenet-5-cnn-with-keras-99-48/output"
    },
    {
      "id": 1466012,
      "postDate": "2021-08-11T09:14:13.890Z",
      "content": "<p>To submit your predictions, you need to create a .csv file and have the following format:</p>\n<blockquote>\n  <p>ImageId,Label<br>\n  1,0<br>\n  2,0<br>\n  3,0<br>\n  etc.</p>\n</blockquote>\n<p>The value of ImageID is the image index in test.csv, when label is its recognized number which predicted by your model. In your case, 3D values can be explained as (batch_size, num_class, probability). You need to find the class name with the highest probability for each sample in the batch. <br>\nHere is a good example: <a href=\"https://www.kaggle.com/abhaporwal/mnist-digit-cnn\" target=\"_blank\">https://www.kaggle.com/abhaporwal/mnist-digit-cnn</a><br>\nGood luck!</p>",
      "rawMarkdown": "To submit your predictions, you need to create a .csv file and have the following format:\n> ImageId,Label\n1,0\n2,0\n3,0\netc.\n\nThe value of ImageID is the image index in test.csv, when label is its recognized number which predicted by your model. In your case, 3D values can be explained as (batch_size, num_class, probability). You need to find the class name with the highest probability for each sample in the batch. \nHere is a good example: https://www.kaggle.com/abhaporwal/mnist-digit-cnn\nGood luck!"
    }
  ],
  "comments": [
    {
      "id": 1498684,
      "author_name": "V SUSHANT",
      "author_url": "",
      "post_date": "2021-09-01T06:01:33.437000",
      "content": "<p><a href=\"https://www.kaggle.com/vsushant/cnn-based-architecture-99?scriptVersionId=73654701\" target=\"_blank\">https://www.kaggle.com/vsushant/cnn-based-architecture-99?scriptVersionId=73654701</a></p>\n<p>Check this out for reference. </p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 1474856,
      "author_name": "Vu Nguyen Thai",
      "author_url": "",
      "post_date": "2021-08-16T09:55:06.413000",
      "content": "<p>I think this notebook may help you.<br>\n<a href=\"https://www.kaggle.com/curiousprogrammer/lenet-5-cnn-with-keras-99-48/output\" target=\"_blank\">https://www.kaggle.com/curiousprogrammer/lenet-5-cnn-with-keras-99-48/output</a></p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 1466012,
      "author_name": "Kei",
      "author_url": "",
      "post_date": "2021-08-11T09:14:13.890000",
      "content": "<p>To submit your predictions, you need to create a .csv file and have the following format:</p>\n<blockquote>\n  <p>ImageId,Label<br>\n  1,0<br>\n  2,0<br>\n  3,0<br>\n  etc.</p>\n</blockquote>\n<p>The value of ImageID is the image index in test.csv, when label is its recognized number which predicted by your model. In your case, 3D values can be explained as (batch_size, num_class, probability). You need to find the class name with the highest probability for each sample in the batch. <br>\nHere is a good example: <a href=\"https://www.kaggle.com/abhaporwal/mnist-digit-cnn\" target=\"_blank\">https://www.kaggle.com/abhaporwal/mnist-digit-cnn</a><br>\nGood luck!</p>",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1404712": "After I am being confident about my predictions over the digits in the MNIST with Matplotlib and TensorFlow, I ran into a problem that I need to submit my predictions with the CSV. I tried everything to use NumPy to save my predictions using np.savetxt(), but that ended in failure because my predictions were 3D, not 2D and 1D. What can I do to save my predictions via TensorFlow (and NumPy)?",
    "1498684": "[https://www.kaggle.com/vsushant/cnn-based-architecture-99?scriptVersionId=73654701](https://www.kaggle.com/vsushant/cnn-based-architecture-99?scriptVersionId=73654701)\n\nCheck this out for reference. ",
    "1474856": "I think this notebook may help you.\nhttps://www.kaggle.com/curiousprogrammer/lenet-5-cnn-with-keras-99-48/output",
    "1466012": "To submit your predictions, you need to create a .csv file and have the following format:\n> ImageId,Label\n1,0\n2,0\n3,0\netc.\n\nThe value of ImageID is the image index in test.csv, when label is its recognized number which predicted by your model. In your case, 3D values can be explained as (batch_size, num_class, probability). You need to find the class name with the highest probability for each sample in the batch. \nHere is a good example: https://www.kaggle.com/abhaporwal/mnist-digit-cnn\nGood luck!"
  }
}