{
  "id": 157795,
  "title": "Fastai Multicategory labels get truncated",
  "url": "/competitions/prostate-cancer-grade-assessment/discussion/157795",
  "author_name": "Son of Anton v3.0",
  "post_date": "2020-06-12T05:15:59.084000",
  "votes": 2,
  "comment_count": 8,
  "views": 0,
  "content": "<p>My labels are of the form\narray([0., 0., 0., 0., 0., 0.], dtype=float32) . When I create an ImageList, the y value is truncated to the first two values of the label array. \n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2262353%2F0e2fb8b43d2ec8cea211bf21daf9d064%2FCapture1.PNG?generation=1591938909716954&amp;alt=media\" alt=\"\">\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2262353%2Fec760fa0e8f4cfde4871152a55b39b93%2FCapture2.PNG?generation=1591938903711990&amp;alt=media\" alt=\"\">\nHow can we prevent this from happening?</p>",
  "messages": [
    {
      "id": 885135,
      "postDate": "2020-06-13T23:54:40.577Z",
      "content": "<p>How are you building your ImageList? My v1 is a bit out of practice but I can try to see anything noticeable. If possible I’d recommend learning to use the v2, it’s high and mid level API is much more user friendly </p>",
      "rawMarkdown": "How are you building your ImageList? My v1 is a bit out of practice but I can try to see anything noticeable. If possible I’d recommend learning to use the v2, it’s high and mid level API is much more user friendly ",
      "votes": 1,
      "replies": [
        {
          "id": 885375,
          "postDate": "2020-06-14T06:27:34.960Z",
          "content": "<p>I used the code used by <a href=\"/iafoss\">@iafoss</a>  in his <a href=\"https://www.kaggle.com/iafoss/panda-concat-tile-pooling-starter-0-79-lb\">https://www.kaggle.com/iafoss/panda-concat-tile-pooling-starter-0-79-lb</a> kernel. Instead of isup_grade. I created a column called ord_label which one hot encodes the isup grade column in an ordinal fashion. For instance, 0 will be like [0,0,0,0,0,0] and 3 will be like [1,1,1,0,0,0].</p>",
          "rawMarkdown": "I used the code used by @iafoss  in his https://www.kaggle.com/iafoss/panda-concat-tile-pooling-starter-0-79-lb kernel. Instead of isup_grade. I created a column called ord_label which one hot encodes the isup grade column in an ordinal fashion. For instance, 0 will be like [0,0,0,0,0,0] and 3 will be like [1,1,1,0,0,0]."
        },
        {
          "id": 905386,
          "postDate": "2020-06-28T14:05:21.900Z",
          "content": "<p>I'm currently using FastAI version 1 so my results might be a little different. Instead of creating a column which has all the one hot encoded predictions I created a target column for each.</p>\n\n<p>If your using FastAIs databunch object you can simply add this line to it once you've expanded your dataframe appropriately.\n<code>label_col=['grade_1', 'grade_2', 'grade_3', 'grade_4', 'grade_5']</code></p>",
          "rawMarkdown": "I'm currently using FastAI version 1 so my results might be a little different. Instead of creating a column which has all the one hot encoded predictions I created a target column for each.\n\nIf your using FastAIs databunch object you can simply add this line to it once you've expanded your dataframe appropriately.\n`label_col=['grade_1', 'grade_2', 'grade_3', 'grade_4', 'grade_5']`"
        },
        {
          "id": 905390,
          "postDate": "2020-06-28T14:09:08.643Z",
          "content": "<p>I did the same and overcame the issue. </p>",
          "rawMarkdown": "I did the same and overcame the issue. "
        }
      ]
    },
    {
      "id": 882734,
      "postDate": "2020-06-12T05:15:59.083Z",
      "content": "<p>My labels are of the form\narray([0., 0., 0., 0., 0., 0.], dtype=float32) . When I create an ImageList, the y value is truncated to the first two values of the label array. \n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2262353%2F0e2fb8b43d2ec8cea211bf21daf9d064%2FCapture1.PNG?generation=1591938909716954&amp;alt=media\" alt=\"\">\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2262353%2Fec760fa0e8f4cfde4871152a55b39b93%2FCapture2.PNG?generation=1591938903711990&amp;alt=media\" alt=\"\">\nHow can we prevent this from happening?</p>",
      "rawMarkdown": " My labels are of the form\narray([0., 0., 0., 0., 0., 0.], dtype=float32) . When I create an ImageList, the y value is truncated to the first two values of the label array. \n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2262353%2F0e2fb8b43d2ec8cea211bf21daf9d064%2FCapture1.PNG?generation=1591938909716954&amp;alt=media)\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2262353%2Fec760fa0e8f4cfde4871152a55b39b93%2FCapture2.PNG?generation=1591938903711990&amp;alt=media)\nHow can we prevent this from happening?\n",
      "votes": 2
    },
    {
      "id": 899510,
      "postDate": "2020-06-24T09:29:53.447Z",
      "content": "<p><a href=\"/venky2506\">@venky2506</a> \nI dont face such issue\n<code>\nlearn2.data.train_ds.x.items[-3],data.train_ds.y[-3].data\n('../input/tiles_set_200/train_images/train_images/ffcee00fd033d3ece1408035a7fd4ea7.png',\n array([1., 1., 0., 0., 0., 0.], dtype=float32),\n</code></p>",
      "rawMarkdown": "@venky2506 \nI dont face such issue\n```\nlearn2.data.train_ds.x.items[-3],data.train_ds.y[-3].data\n('../input/tiles_set_200/train_images/train_images/ffcee00fd033d3ece1408035a7fd4ea7.png',\n array([1., 1., 0., 0., 0., 0.], dtype=float32),\n```\n  \n "
    },
    {
      "id": 883430,
      "postDate": "2020-06-12T16:21:09.183Z",
      "content": "<p>Are you using fastaiv1 or fastaiv2?</p>",
      "rawMarkdown": "Are you using fastaiv1 or fastaiv2?",
      "replies": [
        {
          "id": 883456,
          "postDate": "2020-06-12T16:40:55.553Z",
          "content": "<p>Version 1</p>",
          "rawMarkdown": "Version 1\n"
        }
      ]
    },
    {
      "id": 885374,
      "postDate": "2020-06-14T06:27:10.953Z",
      "rawMarkdown": "",
      "isDeleted": true
    }
  ],
  "comments": [
    {
      "id": 885135,
      "author_name": "Zach Mueller",
      "author_url": "",
      "post_date": "2020-06-13T23:54:40.577000",
      "content": "<p>How are you building your ImageList? My v1 is a bit out of practice but I can try to see anything noticeable. If possible I’d recommend learning to use the v2, it’s high and mid level API is much more user friendly </p>",
      "votes": 1,
      "replies": [
        {
          "id": 885375,
          "author_name": "Son of Anton v3.0",
          "author_url": "",
          "post_date": "2020-06-14T06:27:34.960000",
          "content": "<p>I used the code used by <a href=\"/iafoss\">@iafoss</a>  in his <a href=\"https://www.kaggle.com/iafoss/panda-concat-tile-pooling-starter-0-79-lb\">https://www.kaggle.com/iafoss/panda-concat-tile-pooling-starter-0-79-lb</a> kernel. Instead of isup_grade. I created a column called ord_label which one hot encodes the isup grade column in an ordinal fashion. For instance, 0 will be like [0,0,0,0,0,0] and 3 will be like [1,1,1,0,0,0].</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 905386,
          "author_name": "Neil Kloper",
          "author_url": "",
          "post_date": "2020-06-28T14:05:21.900000",
          "content": "<p>I'm currently using FastAI version 1 so my results might be a little different. Instead of creating a column which has all the one hot encoded predictions I created a target column for each.</p>\n\n<p>If your using FastAIs databunch object you can simply add this line to it once you've expanded your dataframe appropriately.\n<code>label_col=['grade_1', 'grade_2', 'grade_3', 'grade_4', 'grade_5']</code></p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 905390,
          "author_name": "Son of Anton v3.0",
          "author_url": "",
          "post_date": "2020-06-28T14:09:08.643000",
          "content": "<p>I did the same and overcame the issue. </p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 899510,
      "author_name": "Jaideep",
      "author_url": "",
      "post_date": "2020-06-24T09:29:53.447000",
      "content": "<p><a href=\"/venky2506\">@venky2506</a> \nI dont face such issue\n<code>\nlearn2.data.train_ds.x.items[-3],data.train_ds.y[-3].data\n('../input/tiles_set_200/train_images/train_images/ffcee00fd033d3ece1408035a7fd4ea7.png',\n array([1., 1., 0., 0., 0., 0.], dtype=float32),\n</code></p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 883430,
      "author_name": "Kurian Benoy",
      "author_url": "",
      "post_date": "2020-06-12T16:21:09.183000",
      "content": "<p>Are you using fastaiv1 or fastaiv2?</p>",
      "votes": 0,
      "replies": [
        {
          "id": 883456,
          "author_name": "Son of Anton v3.0",
          "author_url": "",
          "post_date": "2020-06-12T16:40:55.553000",
          "content": "<p>Version 1</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 885374,
      "author_name": "",
      "author_url": "",
      "post_date": "2020-06-14T06:27:10.953000",
      "content": "",
      "votes": 0,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "885135": "How are you building your ImageList? My v1 is a bit out of practice but I can try to see anything noticeable. If possible I’d recommend learning to use the v2, it’s high and mid level API is much more user friendly ",
    "882734": " My labels are of the form\narray([0., 0., 0., 0., 0., 0.], dtype=float32) . When I create an ImageList, the y value is truncated to the first two values of the label array. \n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2262353%2F0e2fb8b43d2ec8cea211bf21daf9d064%2FCapture1.PNG?generation=1591938909716954&amp;alt=media)\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-user-content/o/inbox%2F2262353%2Fec760fa0e8f4cfde4871152a55b39b93%2FCapture2.PNG?generation=1591938903711990&amp;alt=media)\nHow can we prevent this from happening?\n",
    "899510": "@venky2506 \nI dont face such issue\n```\nlearn2.data.train_ds.x.items[-3],data.train_ds.y[-3].data\n('../input/tiles_set_200/train_images/train_images/ffcee00fd033d3ece1408035a7fd4ea7.png',\n array([1., 1., 0., 0., 0., 0.], dtype=float32),\n```\n  \n ",
    "883430": "Are you using fastaiv1 or fastaiv2?",
    "885374": ""
  }
}