{
  "id": 287682,
  "title": "How can I create the lag of the Target?",
  "url": "/competitions/g-research-crypto-forecasting/discussion/287682",
  "author_name": "",
  "post_date": "2021-11-15T08:28:17.720486100Z",
  "votes": 11,
  "comment_count": 6,
  "views": 0,
  "content": "<p>I am confused on how the train and test data are provided in the Code Competitions.</p>\n<p>I wish to create a feature based on the lag of the Target. But my understanding is that we are provided with a training set and we can then loop over the test set in which the Target is not present.<br>\nIs the training set static, or is it updated before each loop iteration?<br>\nAnd if the training set is not updated before each loop iteration, do I need to append each test data to the training set and recalculate the Target myself along the way?</p>",
  "messages": [
    {
      "id": "1582748",
      "postDate": "11/15/2021 08:28:17",
      "content": "<p>I am confused on how the train and test data are provided in the Code Competitions.</p>\n<p>I wish to create a feature based on the lag of the Target. But my understanding is that we are provided with a training set and we can then loop over the test set in which the Target is not present.<br>\nIs the training set static, or is it updated before each loop iteration?<br>\nAnd if the training set is not updated before each loop iteration, do I need to append each test data to the training set and recalculate the Target myself along the way?</p>",
      "rawMarkdown": "I am confused on how the train and test data are provided in the Code Competitions.\n\nI wish to create a feature based on the lag of the Target. But my understanding is that we are provided with a training set and we can then loop over the test set in which the Target is not present.\nIs the training set static, or is it updated before each loop iteration?\nAnd if the training set is not updated before each loop iteration, do I need to append each test data to the training set and recalculate the Target myself along the way?",
      "votes": null
    },
    {
      "id": "1583408",
      "postDate": "11/15/2021 20:29:17",
      "content": "<p>The second one:</p>\n<blockquote>\n  <p>if the training set is not updated before each loop iteration, do I need to append each test data to the training set and recalculate the Target myself along the way?</p>\n</blockquote>\n<p>The training set is static they will only include new data on the supplemental_train.csv.</p>",
      "rawMarkdown": "The second one:\n\n> if the training set is not updated before each loop iteration, do I need to append each test data to the training set and recalculate the Target myself along the way?\n\nThe training set is static they will only include new data on the supplemental_train.csv.",
      "votes": null
    },
    {
      "id": "1584013",
      "postDate": "11/16/2021 07:57:07",
      "content": "<p>Thank you.<br>\nI am still not clear on how to compute the Target lag feature though. It seems I will need to recalculate the Target for previous timestamps inside the iteration loop.</p>",
      "rawMarkdown": "Thank you.\nI am still not clear on how to compute the Target lag feature though. It seems I will need to recalculate the Target for previous timestamps inside the iteration loop.",
      "votes": null
    },
    {
      "id": "1584049",
      "postDate": "11/16/2021 08:30:45",
      "content": "<p>When you want to create target based features, you need to know future. In this case you already know target at each time and don't need any model :) The best you can do is calculate difference between market return and asset return at time t by youself. Note, that target at time t looks 16 minutes ahead into the future. Then if your lag feature is previous target, you are still looking 15 minutes ahead</p>",
      "rawMarkdown": "When you want to create target based features, you need to know future. In this case you already know target at each time and don't need any model :) The best you can do is calculate difference between market return and asset return at time t by youself. Note, that target at time t looks 16 minutes ahead into the future. Then if your lag feature is previous target, you are still looking 15 minutes ahead",
      "votes": null
    },
    {
      "id": "1584061",
      "postDate": "11/16/2021 08:35:14",
      "content": "<p>Yes, you need to make all the calculations on the iteration loop, so you have to be very careful with the features that your model uses.</p>",
      "rawMarkdown": "Yes, you need to make all the calculations on the iteration loop, so you have to be very careful with the features that your model uses.",
      "votes": null
    },
    {
      "id": "1584100",
      "postDate": "11/16/2021 09:16:00",
      "content": "<p>Yes, I agree. What I want to do is a lag of 16 minutes of the Target, which is something that we should be able to calculate most of the time I think.</p>",
      "rawMarkdown": "Yes, I agree. What I want to do is a lag of 16 minutes of the Target, which is something that we should be able to calculate most of the time I think.",
      "votes": null
    },
    {
      "id": "1584188",
      "postDate": "11/16/2021 10:37:08",
      "content": "<p>It seems like the target would not be present in supplemental train, but it is still possible to create features based on it simply because you can replicate the target (well, sort of, replicating it exactly is an ongoing discussion, but current estimates have low MAE and should be very usable), so I guess the solution is instead of using the target directly replicate it using supplemental train data.</p>",
      "rawMarkdown": "It seems like the target would not be present in supplemental train, but it is still possible to create features based on it simply because you can replicate the target (well, sort of, replicating it exactly is an ongoing discussion, but current estimates have low MAE and should be very usable), so I guess the solution is instead of using the target directly replicate it using supplemental train data.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1583408,
      "author_name": "agenlu",
      "author_url": "",
      "post_date": "11/15/2021 20:29:17",
      "content": "<p>The second one:</p>\n<blockquote>\n  <p>if the training set is not updated before each loop iteration, do I need to append each test data to the training set and recalculate the Target myself along the way?</p>\n</blockquote>\n<p>The training set is static they will only include new data on the supplemental_train.csv.</p>",
      "votes": null,
      "replies": [
        {
          "id": 1584013,
          "author_name": "timhenry",
          "author_url": "",
          "post_date": "11/16/2021 07:57:07",
          "content": "<p>Thank you.<br>\nI am still not clear on how to compute the Target lag feature though. It seems I will need to recalculate the Target for previous timestamps inside the iteration loop.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 1584061,
          "author_name": "agenlu",
          "author_url": "",
          "post_date": "11/16/2021 08:35:14",
          "content": "<p>Yes, you need to make all the calculations on the iteration loop, so you have to be very careful with the features that your model uses.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1584049,
      "author_name": "taernw",
      "author_url": "",
      "post_date": "11/16/2021 08:30:45",
      "content": "<p>When you want to create target based features, you need to know future. In this case you already know target at each time and don't need any model :) The best you can do is calculate difference between market return and asset return at time t by youself. Note, that target at time t looks 16 minutes ahead into the future. Then if your lag feature is previous target, you are still looking 15 minutes ahead</p>",
      "votes": null,
      "replies": [
        {
          "id": 1584100,
          "author_name": "timhenry",
          "author_url": "",
          "post_date": "11/16/2021 09:16:00",
          "content": "<p>Yes, I agree. What I want to do is a lag of 16 minutes of the Target, which is something that we should be able to calculate most of the time I think.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1584188,
      "author_name": "olegsidorshin",
      "author_url": "",
      "post_date": "11/16/2021 10:37:08",
      "content": "<p>It seems like the target would not be present in supplemental train, but it is still possible to create features based on it simply because you can replicate the target (well, sort of, replicating it exactly is an ongoing discussion, but current estimates have low MAE and should be very usable), so I guess the solution is instead of using the target directly replicate it using supplemental train data.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1582748": "I am confused on how the train and test data are provided in the Code Competitions.\n\nI wish to create a feature based on the lag of the Target. But my understanding is that we are provided with a training set and we can then loop over the test set in which the Target is not present.\nIs the training set static, or is it updated before each loop iteration?\nAnd if the training set is not updated before each loop iteration, do I need to append each test data to the training set and recalculate the Target myself along the way?",
    "1583408": "The second one:\n\n> if the training set is not updated before each loop iteration, do I need to append each test data to the training set and recalculate the Target myself along the way?\n\nThe training set is static they will only include new data on the supplemental_train.csv.",
    "1584013": "Thank you.\nI am still not clear on how to compute the Target lag feature though. It seems I will need to recalculate the Target for previous timestamps inside the iteration loop.",
    "1584049": "When you want to create target based features, you need to know future. In this case you already know target at each time and don't need any model :) The best you can do is calculate difference between market return and asset return at time t by youself. Note, that target at time t looks 16 minutes ahead into the future. Then if your lag feature is previous target, you are still looking 15 minutes ahead",
    "1584061": "Yes, you need to make all the calculations on the iteration loop, so you have to be very careful with the features that your model uses.",
    "1584100": "Yes, I agree. What I want to do is a lag of 16 minutes of the Target, which is something that we should be able to calculate most of the time I think.",
    "1584188": "It seems like the target would not be present in supplemental train, but it is still possible to create features based on it simply because you can replicate the target (well, sort of, replicating it exactly is an ongoing discussion, but current estimates have low MAE and should be very usable), so I guess the solution is instead of using the target directly replicate it using supplemental train data."
  },
  "source": "meta"
}