{
  "id": 333297,
  "title": "Why add Code cell ordering in the AI4Code 'Getting Started' notebook?",
  "url": "/competitions/AI4Code/discussion/333297",
  "author_name": "",
  "post_date": "2022-06-25T18:14:42.956004800Z",
  "votes": 6,
  "comment_count": 1,
  "views": 0,
  "content": "<p>In this: <a href=\"https://www.kaggle.com/code/ryanholbrook/getting-started-with-ai4code?scriptVersionId=95868370&amp;cellId=28\" target=\"_blank\">https://www.kaggle.com/code/ryanholbrook/getting-started-with-ai4code?scriptVersionId=95868370&amp;cellId=28</a>,</p>\n<p>Why are we hstacking the \"code cell ordering\" as a feature? I see that the XGBRanker model doesn't perform as well, without this.</p>",
  "messages": [
    {
      "id": "1833207",
      "postDate": "06/25/2022 18:14:42",
      "content": "<p>In this: <a href=\"https://www.kaggle.com/code/ryanholbrook/getting-started-with-ai4code?scriptVersionId=95868370&amp;cellId=28\" target=\"_blank\">https://www.kaggle.com/code/ryanholbrook/getting-started-with-ai4code?scriptVersionId=95868370&amp;cellId=28</a>,</p>\n<p>Why are we hstacking the \"code cell ordering\" as a feature? I see that the XGBRanker model doesn't perform as well, without this.</p>",
      "rawMarkdown": "In this: https://www.kaggle.com/code/ryanholbrook/getting-started-with-ai4code?scriptVersionId=95868370&cellId=28,\n\nWhy are we hstacking the \"code cell ordering\" as a feature? I see that the XGBRanker model doesn't perform as well, without this.",
      "votes": null
    },
    {
      "id": "1835905",
      "postDate": "06/28/2022 07:51:02",
      "content": "<p>In my point of view, it can be caused for the following:</p>\n<ul>\n<li>The TF-IDF vectorizer provides the model with information about the text. Only using the text information does not help the model because there could be cells nearly the same text but different cell rank. This makes it difficult for the model to learn a good representation of the ranks knowing the text of the cells. </li>\n<li>The code cells are relatively ordered while the markdown are unordered. However, using only the text features, the model has no feature with this kind of information. Hence, the model may not learn the correct relative order of code cells, which affects the performance.</li>\n</ul>\n<p>Adding a cell ordering features helps with these problems. The model can learn that having a \"cell ordering\" of 0 is for a markdown, else a code cell. Moreover, having the code cell with their relative ordering may help the model in predicting the rank (notice it \"may\" help, it is not necessary since we are treating each cell as independent. Thus, the cell being predicted right now have no information about the other cells for the same notebook.).</p>\n<p>Last, I would not use this method because it does not give information about the cells in the same notebook. Although, adding features notebook related can help enhancing the model performance.</p>\n<p>Hope this is helpful in some way.</p>",
      "rawMarkdown": "In my point of view, it can be caused for the following:\n- The TF-IDF vectorizer provides the model with information about the text. Only using the text information does not help the model because there could be cells nearly the same text but different cell rank. This makes it difficult for the model to learn a good representation of the ranks knowing the text of the cells. \n- The code cells are relatively ordered while the markdown are unordered. However, using only the text features, the model has no feature with this kind of information. Hence, the model may not learn the correct relative order of code cells, which affects the performance.\n\nAdding a cell ordering features helps with these problems. The model can learn that having a \"cell ordering\" of 0 is for a markdown, else a code cell. Moreover, having the code cell with their relative ordering may help the model in predicting the rank (notice it \"may\" help, it is not necessary since we are treating each cell as independent. Thus, the cell being predicted right now have no information about the other cells for the same notebook.).\n\nLast, I would not use this method because it does not give information about the cells in the same notebook. Although, adding features notebook related can help enhancing the model performance.\n\nHope this is helpful in some way.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1835905,
      "author_name": "fmakarem",
      "author_url": "",
      "post_date": "06/28/2022 07:51:02",
      "content": "<p>In my point of view, it can be caused for the following:</p>\n<ul>\n<li>The TF-IDF vectorizer provides the model with information about the text. Only using the text information does not help the model because there could be cells nearly the same text but different cell rank. This makes it difficult for the model to learn a good representation of the ranks knowing the text of the cells. </li>\n<li>The code cells are relatively ordered while the markdown are unordered. However, using only the text features, the model has no feature with this kind of information. Hence, the model may not learn the correct relative order of code cells, which affects the performance.</li>\n</ul>\n<p>Adding a cell ordering features helps with these problems. The model can learn that having a \"cell ordering\" of 0 is for a markdown, else a code cell. Moreover, having the code cell with their relative ordering may help the model in predicting the rank (notice it \"may\" help, it is not necessary since we are treating each cell as independent. Thus, the cell being predicted right now have no information about the other cells for the same notebook.).</p>\n<p>Last, I would not use this method because it does not give information about the cells in the same notebook. Although, adding features notebook related can help enhancing the model performance.</p>\n<p>Hope this is helpful in some way.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1833207": "In this: https://www.kaggle.com/code/ryanholbrook/getting-started-with-ai4code?scriptVersionId=95868370&cellId=28,\n\nWhy are we hstacking the \"code cell ordering\" as a feature? I see that the XGBRanker model doesn't perform as well, without this.",
    "1835905": "In my point of view, it can be caused for the following:\n- The TF-IDF vectorizer provides the model with information about the text. Only using the text information does not help the model because there could be cells nearly the same text but different cell rank. This makes it difficult for the model to learn a good representation of the ranks knowing the text of the cells. \n- The code cells are relatively ordered while the markdown are unordered. However, using only the text features, the model has no feature with this kind of information. Hence, the model may not learn the correct relative order of code cells, which affects the performance.\n\nAdding a cell ordering features helps with these problems. The model can learn that having a \"cell ordering\" of 0 is for a markdown, else a code cell. Moreover, having the code cell with their relative ordering may help the model in predicting the rank (notice it \"may\" help, it is not necessary since we are treating each cell as independent. Thus, the cell being predicted right now have no information about the other cells for the same notebook.).\n\nLast, I would not use this method because it does not give information about the cells in the same notebook. Although, adding features notebook related can help enhancing the model performance.\n\nHope this is helpful in some way."
  },
  "source": "meta"
}