{
  "id": 299496,
  "title": "How Should I Make Sense of the Target Provided?",
  "url": "/competitions/g-research-crypto-forecasting/discussion/299496",
  "author_name": "",
  "post_date": "2022-01-08T10:40:44.426818500Z",
  "votes": null,
  "comment_count": 2,
  "views": 0,
  "content": "<p>Hi Kagglers.<br>\nI am sorry to ask this naive question, but what does this <strong>Target</strong> mean? <br>\nI know it cannot be price since some of its values are negative. How exactly should I make sense of it in my prediction? What are we predicting? What is my target? What am I aiming for?<br>\nThanks</p>",
  "messages": [
    {
      "id": "1642408",
      "postDate": "01/08/2022 10:40:44",
      "content": "<p>Hi Kagglers.<br>\nI am sorry to ask this naive question, but what does this <strong>Target</strong> mean? <br>\nI know it cannot be price since some of its values are negative. How exactly should I make sense of it in my prediction? What are we predicting? What is my target? What am I aiming for?<br>\nThanks</p>",
      "rawMarkdown": "Hi Kagglers.\nI am sorry to ask this naive question, but what does this **Target** mean? \nI know it cannot be price since some of its values are negative. How exactly should I make sense of it in my prediction? What are we predicting? What is my target? What am I aiming for?\nThanks",
      "votes": null
    },
    {
      "id": "1643007",
      "postDate": "01/08/2022 22:20:43",
      "content": "<p><strong>Target</strong><br>\nThe target calculation is based on the close price of the asset and can be derived from the provided data using the methodology in <a href=\"https://www.kaggle.com/cstein06/tutorial-to-the-g-research-crypto-competition\" target=\"_blank\">https://www.kaggle.com/cstein06/tutorial-to-the-g-research-crypto-competition</a>. The relevant function is provided below:</p>\n<pre><code>def ResidualizeMarket(df, mktColumn, window):\n  if mktColumn not in df.columns:\n    return df\n\n  mkt = df[mktColumn]\n\n  num = df.multiply(mkt.values, axis=0).rolling(window).mean().values  #numerator of linear regression coefficient\n  denom = mkt.multiply(mkt.values, axis=0).rolling(window).mean().values  #denominator of linear regression coefficient\n  beta = np.nan_to_num( num.T / denom, nan=0., posinf=0., neginf=0.)  #if regression fell over, use beta of 0\n\n  resultRet = df - (beta * mkt.values).T  #perform residualization\n  resultBeta = 0.*df + beta.T  #shape beta\n\n  return resultRet.drop(columns=[mktColumn]), resultBeta.drop(columns=[mktColumn])\n</code></pre>",
      "rawMarkdown": "**Target**\nThe target calculation is based on the close price of the asset and can be derived from the provided data using the methodology in https://www.kaggle.com/cstein06/tutorial-to-the-g-research-crypto-competition. The relevant function is provided below:\n\n```\ndef ResidualizeMarket(df, mktColumn, window):\n  if mktColumn not in df.columns:\n    return df\n\n  mkt = df[mktColumn]\n\n  num = df.multiply(mkt.values, axis=0).rolling(window).mean().values  #numerator of linear regression coefficient\n  denom = mkt.multiply(mkt.values, axis=0).rolling(window).mean().values  #denominator of linear regression coefficient\n  beta = np.nan_to_num( num.T / denom, nan=0., posinf=0., neginf=0.)  #if regression fell over, use beta of 0\n\n  resultRet = df - (beta * mkt.values).T  #perform residualization\n  resultBeta = 0.*df + beta.T  #shape beta\n\n  return resultRet.drop(columns=[mktColumn]), resultBeta.drop(columns=[mktColumn])\n```",
      "votes": null
    },
    {
      "id": "1643148",
      "postDate": "01/09/2022 05:35:18",
      "content": "<p>Oh, thank you so much</p>",
      "rawMarkdown": "Oh, thank you so much",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1643007,
      "author_name": "yus002",
      "author_url": "",
      "post_date": "01/08/2022 22:20:43",
      "content": "<p><strong>Target</strong><br>\nThe target calculation is based on the close price of the asset and can be derived from the provided data using the methodology in <a href=\"https://www.kaggle.com/cstein06/tutorial-to-the-g-research-crypto-competition\" target=\"_blank\">https://www.kaggle.com/cstein06/tutorial-to-the-g-research-crypto-competition</a>. The relevant function is provided below:</p>\n<pre><code>def ResidualizeMarket(df, mktColumn, window):\n  if mktColumn not in df.columns:\n    return df\n\n  mkt = df[mktColumn]\n\n  num = df.multiply(mkt.values, axis=0).rolling(window).mean().values  #numerator of linear regression coefficient\n  denom = mkt.multiply(mkt.values, axis=0).rolling(window).mean().values  #denominator of linear regression coefficient\n  beta = np.nan_to_num( num.T / denom, nan=0., posinf=0., neginf=0.)  #if regression fell over, use beta of 0\n\n  resultRet = df - (beta * mkt.values).T  #perform residualization\n  resultBeta = 0.*df + beta.T  #shape beta\n\n  return resultRet.drop(columns=[mktColumn]), resultBeta.drop(columns=[mktColumn])\n</code></pre>",
      "votes": null,
      "replies": [
        {
          "id": 1643148,
          "author_name": "zammie",
          "author_url": "",
          "post_date": "01/09/2022 05:35:18",
          "content": "<p>Oh, thank you so much</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1642408": "Hi Kagglers.\nI am sorry to ask this naive question, but what does this **Target** mean? \nI know it cannot be price since some of its values are negative. How exactly should I make sense of it in my prediction? What are we predicting? What is my target? What am I aiming for?\nThanks",
    "1643007": "**Target**\nThe target calculation is based on the close price of the asset and can be derived from the provided data using the methodology in https://www.kaggle.com/cstein06/tutorial-to-the-g-research-crypto-competition. The relevant function is provided below:\n\n```\ndef ResidualizeMarket(df, mktColumn, window):\n  if mktColumn not in df.columns:\n    return df\n\n  mkt = df[mktColumn]\n\n  num = df.multiply(mkt.values, axis=0).rolling(window).mean().values  #numerator of linear regression coefficient\n  denom = mkt.multiply(mkt.values, axis=0).rolling(window).mean().values  #denominator of linear regression coefficient\n  beta = np.nan_to_num( num.T / denom, nan=0., posinf=0., neginf=0.)  #if regression fell over, use beta of 0\n\n  resultRet = df - (beta * mkt.values).T  #perform residualization\n  resultBeta = 0.*df + beta.T  #shape beta\n\n  return resultRet.drop(columns=[mktColumn]), resultBeta.drop(columns=[mktColumn])\n```",
    "1643148": "Oh, thank you so much"
  },
  "source": "meta"
}