{
  "id": 72231,
  "title": "Are you predicting the correct target variable?",
  "url": "/competitions/ga-customer-revenue-prediction/discussion/72231",
  "author_name": "",
  "post_date": "2018-11-21T12:34:42.606348500Z",
  "votes": 17,
  "comment_count": 9,
  "views": 0,
  "content": "<p>Most recent kernels are not predicting the correct target variable.</p>\n\n<p>(a) The period to predict is 62 days long. The test period for the LB is 168 days long.  I have not seen any kernel correcting for this.</p>\n\n<p>(b) A (maximum likelihood extimate for a) customers purchase in a period can be written as expected number of visists in that period * expected transaction value per visit.  However we have to work with the condition that the known customer returns at least once, so we have to work with   the conditional expectation of max(1, number of visists ). I have not seen any kernel correcting for this either. </p>",
  "messages": [
    {
      "id": "425311",
      "postDate": "11/21/2018 12:34:42",
      "content": "<p>Most recent kernels are not predicting the correct target variable.</p>\n\n<p>(a) The period to predict is 62 days long. The test period for the LB is 168 days long.  I have not seen any kernel correcting for this.</p>\n\n<p>(b) A (maximum likelihood extimate for a) customers purchase in a period can be written as expected number of visists in that period * expected transaction value per visit.  However we have to work with the condition that the known customer returns at least once, so we have to work with   the conditional expectation of max(1, number of visists ). I have not seen any kernel correcting for this either. </p>",
      "rawMarkdown": "Most recent kernels are not predicting the correct target variable.\n\n(a) The period to predict is 62 days long. The test period for the LB is 168 days long.  I have not seen any kernel correcting for this.\n\n(b) A (maximum likelihood extimate for a) customers purchase in a period can be written as expected number of visists in that period * expected transaction value per visit.  However we have to work with the condition that the known customer returns at least once, so we have to work with   the conditional expectation of max(1, number of visists ). I have not seen any kernel correcting for this either.",
      "votes": null
    },
    {
      "id": "425437",
      "postDate": "11/21/2018 15:47:36",
      "content": "<p>Can u elaborate? What do u mean by period?</p>",
      "rawMarkdown": "Can u elaborate? What do u mean by period?",
      "votes": null
    },
    {
      "id": "425501",
      "postDate": "11/21/2018 17:28:24",
      "content": "<p>I am doing that:</p>\n\n<p><a href=\"https://github.com/luisduque440/google_analytics\">https://github.com/luisduque440/google_analytics</a></p>\n\n<p>So far, I have mostly focused on doing feature engineering, which basically consists on getting a dataframe that has one row for each (different) fullvisitorid in the training period, and the following sets of columns:</p>\n\n<p>1) Fixed fields (for categorical variables): i.e. country, browser, in the trainining period\n2) Moving average of the numerical features in the training period, for example: totaltransactionrevenuelast month, last2months, last3_months, …). ( 'last month', 'last two months', … refer to periods of time computed backwards from the last day of the training period)\n3)Average value of the numerical features per month in the training period (i.e. totaltransactiorevenue 2 months ago, 3 months ago, 4 months ago, …). ('two months ago', '3 months ago', are again, computed based on the last day of training period)\n4) The total spent in the evaluation data set for each fullvisitor id in the training period (i.e. the target)</p>\n\n<p>To do this, I consider several periods of 9 months and split them in the exact same way the Kaggle competition does,:</p>\n\n<p>&lt;---------------- train period (168 days)---------------------------&gt;&lt;-------gap (46 days)-------&gt;&lt;---evaluation(62 days)-----&gt;\n|-------------------------------------------------------------------------|---------------------------------|---------------------------------|</p>\n\n<p>I am still testing this code, but seems to be working well.</p>\n\n<p>Best,</p>\n\n<p>Luis</p>",
      "rawMarkdown": "I am doing that:\n\nhttps://github.com/luisduque440/google_analytics\n\nSo far, I have mostly focused on doing feature engineering, which basically consists on getting a dataframe that has one row for each (different) fullvisitorid in the training period, and the following sets of columns:\n\n1) Fixed fields (for categorical variables): i.e. country, browser, in the trainining period\n2) Moving average of the numerical features in the training period, for example: totaltransactionrevenuelast month, last2months, last3_months, …). ( 'last month', 'last two months', … refer to periods of time computed backwards from the last day of the training period)\n3)Average value of the numerical features per month in the training period (i.e. totaltransactiorevenue 2 months ago, 3 months ago, 4 months ago, …). ('two months ago', '3 months ago', are again, computed based on the last day of training period)\n4) The total spent in the evaluation data set for each fullvisitor id in the training period (i.e. the target)\n\n\nTo do this, I consider several periods of 9 months and split them in the exact same way the Kaggle competition does,:\n\n&lt;---------------- train period (168 days)---------------------------&gt;&lt;-------gap (46 days)-------&gt;&lt;---evaluation(62 days)-----&gt;\n|-------------------------------------------------------------------------|---------------------------------|---------------------------------|\n\nI am still testing this code, but seems to be working well.\n\nBest,\n\nLuis",
      "votes": null
    },
    {
      "id": "425758",
      "postDate": "11/22/2018 04:02:46",
      "content": "<p>This is my kernel: <a href=\"https://www.kaggle.com/super13579/ga-v2-future-purchase-prediction\">https://www.kaggle.com/super13579/ga-v2-future-purchase-prediction</a> <br>\na) I am trying to predict customer will back purchase or not then doing the regression of revenue <br>\nMy period just like the test set <br>\nusing 168 days to be training set  and target set 62 days long\nb) Thanks your information! </p>",
      "rawMarkdown": "This is my kernel: https://www.kaggle.com/super13579/ga-v2-future-purchase-prediction  \na) I am trying to predict customer will back purchase or not then doing the regression of revenue  \nMy period just like the test set  \nusing 168 days to be training set  and target set 62 days long\nb) Thanks your information!",
      "votes": null
    },
    {
      "id": "426047",
      "postDate": "11/22/2018 14:02:42",
      "content": "<p>I have the same approach.\nNotice: some of categorical fields may change in time. E.g. traffic channel or carrier.\nMoreover, some data is damaged and one transaction may be written two or more times.</p>",
      "rawMarkdown": "I have the same approach.\nNotice: some of categorical fields may change in time. E.g. traffic channel or carrier.\nMoreover, some data is damaged and one transaction may be written two or more times.",
      "votes": null
    },
    {
      "id": "426060",
      "postDate": "11/22/2018 14:39:14",
      "content": "<p>Oh! Did not realize about repeated transactions, thanks a lot</p>",
      "rawMarkdown": "Oh! Did not realize about repeated transactions, thanks a lot",
      "votes": null
    },
    {
      "id": "426672",
      "postDate": "11/23/2018 16:14:25",
      "content": "<p>Hi <a href=\"/eguliy\">@eguliy</a>, what do you exactly mean by damaged data? Have you identified duplicate rows? If not, how do you recognise that a certain transaction is contained more than once in the data? (by the way the initial granularity of the data is one row = one visit, whereas one visit can include several transactions, but our target variable totals.transactionRevenue as we know corresponds to the last transaction conducted during the visit.)</p>",
      "rawMarkdown": "Hi @eguliy, what do you exactly mean by damaged data? Have you identified duplicate rows? If not, how do you recognise that a certain transaction is contained more than once in the data? (by the way the initial granularity of the data is one row = one visit, whereas one visit can include several transactions, but our target variable totals.transactionRevenue as we know corresponds to the last transaction conducted during the visit.)",
      "votes": null
    },
    {
      "id": "427721",
      "postDate": "11/26/2018 03:01:23",
      "content": "<p>MrOoiler,</p>\n\n<p>Thank you for point this out! I was about to post a question about what we were actually predicting. The data tab states that we are predicting the Dec ~ Jan time frame of Total transaction per users. What I've seen is people trying to predict the transaction Amounts for Test_v2.csv.  </p>\n\n<p>There are several ways to attack this, here are a few off the top of my head.\n1) predict total revenue per month (or day, however you feel)\n2) as MrOoiler pointed out. prredict the number of transactions, then predict the cost of each transactions. I disagree with MrOoiler point about people have to have at least one transaction from Dec - Jan; they do not. The actual test is live, and a customer has choice to not buy anything during that time period. \n3) Build a classifier to determine if someone is going to have one transaction (or Not), Two transactions (or not), three transactions (or not), etc. This is different from point two!\n4) Monte Carlo to establish a distribution for each person of either Total transactions or Total Purchases</p>\n\n<p>Let me know of other approaches you all would take to figure this out.</p>",
      "rawMarkdown": "MrOoiler,\n\nThank you for point this out! I was about to post a question about what we were actually predicting. The data tab states that we are predicting the Dec ~ Jan time frame of Total transaction per users. What I've seen is people trying to predict the transaction Amounts for Test_v2.csv.  \n\nThere are several ways to attack this, here are a few off the top of my head.\n1) predict total revenue per month (or day, however you feel)\n2) as MrOoiler pointed out. prredict the number of transactions, then predict the cost of each transactions. I disagree with MrOoiler point about people have to have at least one transaction from Dec - Jan; they do not. The actual test is live, and a customer has choice to not buy anything during that time period. \n3) Build a classifier to determine if someone is going to have one transaction (or Not), Two transactions (or not), three transactions (or not), etc. This is different from point two!\n4) Monte Carlo to establish a distribution for each person of either Total transactions or Total Purchases\n\nLet me know of other approaches you all would take to figure this out.",
      "votes": null
    },
    {
      "id": "428021",
      "postDate": "11/26/2018 16:15:30",
      "content": "<p>Are you sure that you're interpreting (b) correctly? As far as I understand, we have to predict the Dec-Jan revenue from the customers that had at least one purchase in May01st-Oct15th dataset. The \"Competition Relaunch Details\" says \"Your true performance and final standing will be based on the private future-looking dataset, which will also be calculated for <strong>all</strong> users in test_v2.csv\" - they don't say that the private dataset will only include customers that return in Dec-Jan. Which information made you think otherwise?</p>",
      "rawMarkdown": "Are you sure that you're interpreting (b) correctly? As far as I understand, we have to predict the Dec-Jan revenue from the customers that had at least one purchase in May01st-Oct15th dataset. The \"Competition Relaunch Details\" says \"Your true performance and final standing will be based on the private future-looking dataset, which will also be calculated for **all** users in test_v2.csv\" - they don't say that the private dataset will only include customers that return in Dec-Jan. Which information made you think otherwise?",
      "votes": null
    },
    {
      "id": "428050",
      "postDate": "11/26/2018 17:06:47",
      "content": "<p>Yes, that is certainly a possible interpretation. Which makes this even more of a lottery, and this competition certainly the worst ever hosted by Kaggle.  Because in that case an all-zero prediction might be your best bet.  Of all customers in the test2 period (296530) approx 2100 will come back in Dec-Jan, and only about 150 of them will spend some money. </p>",
      "rawMarkdown": "Yes, that is certainly a possible interpretation. Which makes this even more of a lottery, and this competition certainly the worst ever hosted by Kaggle.  Because in that case an all-zero prediction might be your best bet.  Of all customers in the test2 period (296530) approx 2100 will come back in Dec-Jan, and only about 150 of them will spend some money.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 425437,
      "author_name": "qnkhuat",
      "author_url": "",
      "post_date": "11/21/2018 15:47:36",
      "content": "<p>Can u elaborate? What do u mean by period?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 425501,
      "author_name": "luisduque440",
      "author_url": "",
      "post_date": "11/21/2018 17:28:24",
      "content": "<p>I am doing that:</p>\n\n<p><a href=\"https://github.com/luisduque440/google_analytics\">https://github.com/luisduque440/google_analytics</a></p>\n\n<p>So far, I have mostly focused on doing feature engineering, which basically consists on getting a dataframe that has one row for each (different) fullvisitorid in the training period, and the following sets of columns:</p>\n\n<p>1) Fixed fields (for categorical variables): i.e. country, browser, in the trainining period\n2) Moving average of the numerical features in the training period, for example: totaltransactionrevenuelast month, last2months, last3_months, …). ( 'last month', 'last two months', … refer to periods of time computed backwards from the last day of the training period)\n3)Average value of the numerical features per month in the training period (i.e. totaltransactiorevenue 2 months ago, 3 months ago, 4 months ago, …). ('two months ago', '3 months ago', are again, computed based on the last day of training period)\n4) The total spent in the evaluation data set for each fullvisitor id in the training period (i.e. the target)</p>\n\n<p>To do this, I consider several periods of 9 months and split them in the exact same way the Kaggle competition does,:</p>\n\n<p>&lt;---------------- train period (168 days)---------------------------&gt;&lt;-------gap (46 days)-------&gt;&lt;---evaluation(62 days)-----&gt;\n|-------------------------------------------------------------------------|---------------------------------|---------------------------------|</p>\n\n<p>I am still testing this code, but seems to be working well.</p>\n\n<p>Best,</p>\n\n<p>Luis</p>",
      "votes": null,
      "replies": [
        {
          "id": 426047,
          "author_name": "eguliy",
          "author_url": "",
          "post_date": "11/22/2018 14:02:42",
          "content": "<p>I have the same approach.\nNotice: some of categorical fields may change in time. E.g. traffic channel or carrier.\nMoreover, some data is damaged and one transaction may be written two or more times.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 426060,
          "author_name": "luisduque440",
          "author_url": "",
          "post_date": "11/22/2018 14:39:14",
          "content": "<p>Oh! Did not realize about repeated transactions, thanks a lot</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 426672,
          "author_name": "antoniorossi",
          "author_url": "",
          "post_date": "11/23/2018 16:14:25",
          "content": "<p>Hi <a href=\"/eguliy\">@eguliy</a>, what do you exactly mean by damaged data? Have you identified duplicate rows? If not, how do you recognise that a certain transaction is contained more than once in the data? (by the way the initial granularity of the data is one row = one visit, whereas one visit can include several transactions, but our target variable totals.transactionRevenue as we know corresponds to the last transaction conducted during the visit.)</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 425758,
      "author_name": "super13579",
      "author_url": "",
      "post_date": "11/22/2018 04:02:46",
      "content": "<p>This is my kernel: <a href=\"https://www.kaggle.com/super13579/ga-v2-future-purchase-prediction\">https://www.kaggle.com/super13579/ga-v2-future-purchase-prediction</a> <br>\na) I am trying to predict customer will back purchase or not then doing the regression of revenue <br>\nMy period just like the test set <br>\nusing 168 days to be training set  and target set 62 days long\nb) Thanks your information! </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 427721,
      "author_name": "duckienukeem",
      "author_url": "",
      "post_date": "11/26/2018 03:01:23",
      "content": "<p>MrOoiler,</p>\n\n<p>Thank you for point this out! I was about to post a question about what we were actually predicting. The data tab states that we are predicting the Dec ~ Jan time frame of Total transaction per users. What I've seen is people trying to predict the transaction Amounts for Test_v2.csv.  </p>\n\n<p>There are several ways to attack this, here are a few off the top of my head.\n1) predict total revenue per month (or day, however you feel)\n2) as MrOoiler pointed out. prredict the number of transactions, then predict the cost of each transactions. I disagree with MrOoiler point about people have to have at least one transaction from Dec - Jan; they do not. The actual test is live, and a customer has choice to not buy anything during that time period. \n3) Build a classifier to determine if someone is going to have one transaction (or Not), Two transactions (or not), three transactions (or not), etc. This is different from point two!\n4) Monte Carlo to establish a distribution for each person of either Total transactions or Total Purchases</p>\n\n<p>Let me know of other approaches you all would take to figure this out.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 428021,
      "author_name": "denysbondar",
      "author_url": "",
      "post_date": "11/26/2018 16:15:30",
      "content": "<p>Are you sure that you're interpreting (b) correctly? As far as I understand, we have to predict the Dec-Jan revenue from the customers that had at least one purchase in May01st-Oct15th dataset. The \"Competition Relaunch Details\" says \"Your true performance and final standing will be based on the private future-looking dataset, which will also be calculated for <strong>all</strong> users in test_v2.csv\" - they don't say that the private dataset will only include customers that return in Dec-Jan. Which information made you think otherwise?</p>",
      "votes": null,
      "replies": [
        {
          "id": 428050,
          "author_name": "mrooijer",
          "author_url": "",
          "post_date": "11/26/2018 17:06:47",
          "content": "<p>Yes, that is certainly a possible interpretation. Which makes this even more of a lottery, and this competition certainly the worst ever hosted by Kaggle.  Because in that case an all-zero prediction might be your best bet.  Of all customers in the test2 period (296530) approx 2100 will come back in Dec-Jan, and only about 150 of them will spend some money. </p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "425311": "Most recent kernels are not predicting the correct target variable.\n\n(a) The period to predict is 62 days long. The test period for the LB is 168 days long.  I have not seen any kernel correcting for this.\n\n(b) A (maximum likelihood extimate for a) customers purchase in a period can be written as expected number of visists in that period * expected transaction value per visit.  However we have to work with the condition that the known customer returns at least once, so we have to work with   the conditional expectation of max(1, number of visists ). I have not seen any kernel correcting for this either.",
    "425437": "Can u elaborate? What do u mean by period?",
    "425501": "I am doing that:\n\nhttps://github.com/luisduque440/google_analytics\n\nSo far, I have mostly focused on doing feature engineering, which basically consists on getting a dataframe that has one row for each (different) fullvisitorid in the training period, and the following sets of columns:\n\n1) Fixed fields (for categorical variables): i.e. country, browser, in the trainining period\n2) Moving average of the numerical features in the training period, for example: totaltransactionrevenuelast month, last2months, last3_months, …). ( 'last month', 'last two months', … refer to periods of time computed backwards from the last day of the training period)\n3)Average value of the numerical features per month in the training period (i.e. totaltransactiorevenue 2 months ago, 3 months ago, 4 months ago, …). ('two months ago', '3 months ago', are again, computed based on the last day of training period)\n4) The total spent in the evaluation data set for each fullvisitor id in the training period (i.e. the target)\n\n\nTo do this, I consider several periods of 9 months and split them in the exact same way the Kaggle competition does,:\n\n&lt;---------------- train period (168 days)---------------------------&gt;&lt;-------gap (46 days)-------&gt;&lt;---evaluation(62 days)-----&gt;\n|-------------------------------------------------------------------------|---------------------------------|---------------------------------|\n\nI am still testing this code, but seems to be working well.\n\nBest,\n\nLuis",
    "425758": "This is my kernel: https://www.kaggle.com/super13579/ga-v2-future-purchase-prediction  \na) I am trying to predict customer will back purchase or not then doing the regression of revenue  \nMy period just like the test set  \nusing 168 days to be training set  and target set 62 days long\nb) Thanks your information!",
    "426047": "I have the same approach.\nNotice: some of categorical fields may change in time. E.g. traffic channel or carrier.\nMoreover, some data is damaged and one transaction may be written two or more times.",
    "426060": "Oh! Did not realize about repeated transactions, thanks a lot",
    "426672": "Hi @eguliy, what do you exactly mean by damaged data? Have you identified duplicate rows? If not, how do you recognise that a certain transaction is contained more than once in the data? (by the way the initial granularity of the data is one row = one visit, whereas one visit can include several transactions, but our target variable totals.transactionRevenue as we know corresponds to the last transaction conducted during the visit.)",
    "427721": "MrOoiler,\n\nThank you for point this out! I was about to post a question about what we were actually predicting. The data tab states that we are predicting the Dec ~ Jan time frame of Total transaction per users. What I've seen is people trying to predict the transaction Amounts for Test_v2.csv.  \n\nThere are several ways to attack this, here are a few off the top of my head.\n1) predict total revenue per month (or day, however you feel)\n2) as MrOoiler pointed out. prredict the number of transactions, then predict the cost of each transactions. I disagree with MrOoiler point about people have to have at least one transaction from Dec - Jan; they do not. The actual test is live, and a customer has choice to not buy anything during that time period. \n3) Build a classifier to determine if someone is going to have one transaction (or Not), Two transactions (or not), three transactions (or not), etc. This is different from point two!\n4) Monte Carlo to establish a distribution for each person of either Total transactions or Total Purchases\n\nLet me know of other approaches you all would take to figure this out.",
    "428021": "Are you sure that you're interpreting (b) correctly? As far as I understand, we have to predict the Dec-Jan revenue from the customers that had at least one purchase in May01st-Oct15th dataset. The \"Competition Relaunch Details\" says \"Your true performance and final standing will be based on the private future-looking dataset, which will also be calculated for **all** users in test_v2.csv\" - they don't say that the private dataset will only include customers that return in Dec-Jan. Which information made you think otherwise?",
    "428050": "Yes, that is certainly a possible interpretation. Which makes this even more of a lottery, and this competition certainly the worst ever hosted by Kaggle.  Because in that case an all-zero prediction might be your best bet.  Of all customers in the test2 period (296530) approx 2100 will come back in Dec-Jan, and only about 150 of them will spend some money."
  },
  "source": "meta"
}