{
  "id": 71865,
  "title": "Some small findings on fullVisitorId",
  "url": "/competitions/ga-customer-revenue-prediction/discussion/71865",
  "author_name": "Carl Tsai",
  "post_date": "2018-11-17T14:03:33.214000",
  "votes": 2,
  "comment_count": 0,
  "views": 0,
  "content": "<p>I did some small experiments and found that there are only 2759 unique fullVisitorIds appear on both train_v2.csv and test_v2.csv. The number of unique fullVisitorIds with \"totals_transactionRevenue &gt; 0\" appearing on both data is even lesser (only 195). It seems that only few users would make transaction again. Since we are not able to get the \"future fullVisitorIds\" during 12/2018~1/2019, I think those users who keep making transactions are key for accurate prediction.</p>\n\n<p>The following is my experiment code and I hope it could provide some help on analysis.\nPlease correct me if there is anything wrong.</p>\n\n<p>```\ntrain['totals_totalTransactionRevenue'] = train['totals_totalTransactionRevenue'].fillna(0)\ntmpDf = train.loc[train['totals_transactionRevenue'] &gt; 0, ['fullVisitorId', 'totals_transactionRevenue']]\ntrainUserTotalRevenue = pd.DataFrame()\ntrainUserTotalRevenue['sum'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].sum()\ntrainUserTotalRevenue['count'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].count()</p>\n\n<p>test['totals_totalTransactionRevenue'] = test['totals_totalTransactionRevenue'].fillna(0)\ntmpDf = test.loc[test['totals_transactionRevenue'] &gt; 0, ['fullVisitorId', 'totals_transactionRevenue']]\nTestUserTotalRevenue = pd.DataFrame()\nTestUserTotalRevenue['sum'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].sum()\nTestUserTotalRevenue['count'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].count()</p>\n\n<p>unique_train_user = train['fullVisitorId'].unique()\nunique_test_user = test['fullVisitorId'].unique()</p>\n\n<p>print(len(set(unique_train_user).intersection(set(unique_test_user))))\nprint(len(set(trainUserTotalRevenue.index).intersection(set(unique_test_user))))\n```</p>",
  "messages": [
    {
      "id": 423109,
      "postDate": "2018-11-17T14:03:33.213Z",
      "content": "<p>I did some small experiments and found that there are only 2759 unique fullVisitorIds appear on both train_v2.csv and test_v2.csv. The number of unique fullVisitorIds with \"totals_transactionRevenue &gt; 0\" appearing on both data is even lesser (only 195). It seems that only few users would make transaction again. Since we are not able to get the \"future fullVisitorIds\" during 12/2018~1/2019, I think those users who keep making transactions are key for accurate prediction.</p>\n\n<p>The following is my experiment code and I hope it could provide some help on analysis.\nPlease correct me if there is anything wrong.</p>\n\n<p>```\ntrain['totals_totalTransactionRevenue'] = train['totals_totalTransactionRevenue'].fillna(0)\ntmpDf = train.loc[train['totals_transactionRevenue'] &gt; 0, ['fullVisitorId', 'totals_transactionRevenue']]\ntrainUserTotalRevenue = pd.DataFrame()\ntrainUserTotalRevenue['sum'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].sum()\ntrainUserTotalRevenue['count'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].count()</p>\n\n<p>test['totals_totalTransactionRevenue'] = test['totals_totalTransactionRevenue'].fillna(0)\ntmpDf = test.loc[test['totals_transactionRevenue'] &gt; 0, ['fullVisitorId', 'totals_transactionRevenue']]\nTestUserTotalRevenue = pd.DataFrame()\nTestUserTotalRevenue['sum'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].sum()\nTestUserTotalRevenue['count'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].count()</p>\n\n<p>unique_train_user = train['fullVisitorId'].unique()\nunique_test_user = test['fullVisitorId'].unique()</p>\n\n<p>print(len(set(unique_train_user).intersection(set(unique_test_user))))\nprint(len(set(trainUserTotalRevenue.index).intersection(set(unique_test_user))))\n```</p>",
      "rawMarkdown": " I did some small experiments and found that there are only 2759 unique fullVisitorIds appear on both train_v2.csv and test_v2.csv. The number of unique fullVisitorIds with \"totals_transactionRevenue &gt; 0\" appearing on both data is even lesser (only 195). It seems that only few users would make transaction again. Since we are not able to get the \"future fullVisitorIds\" during 12/2018~1/2019, I think those users who keep making transactions are key for accurate prediction.\n\nThe following is my experiment code and I hope it could provide some help on analysis.\nPlease correct me if there is anything wrong.\n\n```\ntrain['totals_totalTransactionRevenue'] = train['totals_totalTransactionRevenue'].fillna(0)\ntmpDf = train.loc[train['totals_transactionRevenue'] &gt; 0, ['fullVisitorId', 'totals_transactionRevenue']]\ntrainUserTotalRevenue = pd.DataFrame()\ntrainUserTotalRevenue['sum'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].sum()\ntrainUserTotalRevenue['count'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].count()\n\ntest['totals_totalTransactionRevenue'] = test['totals_totalTransactionRevenue'].fillna(0)\ntmpDf = test.loc[test['totals_transactionRevenue'] &gt; 0, ['fullVisitorId', 'totals_transactionRevenue']]\nTestUserTotalRevenue = pd.DataFrame()\nTestUserTotalRevenue['sum'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].sum()\nTestUserTotalRevenue['count'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].count()\n\nunique_train_user = train['fullVisitorId'].unique()\nunique_test_user = test['fullVisitorId'].unique()\n\nprint(len(set(unique_train_user).intersection(set(unique_test_user))))\nprint(len(set(trainUserTotalRevenue.index).intersection(set(unique_test_user))))\n```",
      "votes": 2
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "423109": " I did some small experiments and found that there are only 2759 unique fullVisitorIds appear on both train_v2.csv and test_v2.csv. The number of unique fullVisitorIds with \"totals_transactionRevenue &gt; 0\" appearing on both data is even lesser (only 195). It seems that only few users would make transaction again. Since we are not able to get the \"future fullVisitorIds\" during 12/2018~1/2019, I think those users who keep making transactions are key for accurate prediction.\n\nThe following is my experiment code and I hope it could provide some help on analysis.\nPlease correct me if there is anything wrong.\n\n```\ntrain['totals_totalTransactionRevenue'] = train['totals_totalTransactionRevenue'].fillna(0)\ntmpDf = train.loc[train['totals_transactionRevenue'] &gt; 0, ['fullVisitorId', 'totals_transactionRevenue']]\ntrainUserTotalRevenue = pd.DataFrame()\ntrainUserTotalRevenue['sum'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].sum()\ntrainUserTotalRevenue['count'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].count()\n\ntest['totals_totalTransactionRevenue'] = test['totals_totalTransactionRevenue'].fillna(0)\ntmpDf = test.loc[test['totals_transactionRevenue'] &gt; 0, ['fullVisitorId', 'totals_transactionRevenue']]\nTestUserTotalRevenue = pd.DataFrame()\nTestUserTotalRevenue['sum'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].sum()\nTestUserTotalRevenue['count'] = tmpDf.groupby('fullVisitorId')['totals_transactionRevenue'].count()\n\nunique_train_user = train['fullVisitorId'].unique()\nunique_test_user = test['fullVisitorId'].unique()\n\nprint(len(set(unique_train_user).intersection(set(unique_test_user))))\nprint(len(set(trainUserTotalRevenue.index).intersection(set(unique_test_user))))\n```"
  }
}