{
  "id": 78783,
  "title": "Does target value -33.21928095=-10/lg2 mean customer is not loyal at all",
  "url": "/competitions/elo-merchant-category-recommendation/discussion/78783",
  "author_name": "",
  "post_date": "2019-01-27T21:06:30.450967500Z",
  "votes": 18,
  "comment_count": 9,
  "views": 0,
  "content": "<p>I found that -33.21928095 comes from -10/lg2, where 2^33.21928095=10,00,000,000 or in other words, 2^-33.21928095=10^-10 (very close to 0). So I am thinking how is the loyalty score calculated? Does  -33.21928095 mean customer is not loyal at all? But I found card_id='C_ID_e34ea29439', whose target value is  -33.21928095,  had 136 records in historical_transactions and 2 records in historical_transactions</p>",
  "messages": [
    {
      "id": "462199",
      "postDate": "01/27/2019 21:06:30",
      "content": "<p>I found that -33.21928095 comes from -10/lg2, where 2^33.21928095=10,00,000,000 or in other words, 2^-33.21928095=10^-10 (very close to 0). So I am thinking how is the loyalty score calculated? Does  -33.21928095 mean customer is not loyal at all? But I found card_id='C_ID_e34ea29439', whose target value is  -33.21928095,  had 136 records in historical_transactions and 2 records in historical_transactions</p>",
      "rawMarkdown": "I found that -33.21928095 comes from -10/lg2, where 2^33.21928095=10,00,000,000 or in other words, 2^-33.21928095=10^-10 (very close to 0). So I am thinking how is the loyalty score calculated? Does  -33.21928095 mean customer is not loyal at all? But I found card_id='C_ID_e34ea29439', whose target value is  -33.21928095,  had 136 records in historical_transactions and 2 records in historical_transactions",
      "votes": null
    },
    {
      "id": "462207",
      "postDate": "01/27/2019 21:34:02",
      "content": "<p>-33.21928095 could be nan equivalent or -10 in some scale or sum of answers from questionnaire in scale fro 0 to 10 or sum of points in cardholder account or or or </p>\n\n<p>Why NaN\n 1. Check historical transactions\n 2. Remove Cards that are in new_merchant\n 3. Agg by card_id (size)\n 4. Check cards with size 2,3,4...\nThere are some similar profiles but some have -33 and some positive loyalty score (with some variation there should be 1-2-5 points difference but not 30)</p>\n\n<p>And all other theories have some base but we dont know what is Elo Score and how it is calculated.</p>\n\n<p>~~~~\nstrange_items = historical_df[~(historical_df['card_id'].isin(new_merchant_df['card_id']))]\\\n                .groupby(['card_id'])['authorized_flag'].agg(['size'])\\\n                                .reset_index().rename(columns={'size': 'number_of_transactions'})\nstrange_items = strange_items[strange_items['number_of_transactions']&lt;7]\nstrange_items = train[(train['card_id'].isin(strange_items['card_id']))&amp;((train['target']&lt;-33)|(train['target']&gt;0))]\n~~~~</p>",
      "rawMarkdown": "33.21928095 could be nan equivalent or -10 in some scale or sum of answers from questionnaire in scale fro 0 to 10 or sum of points in cardholder account or or or \n\nWhy NaN\n 1. Check historical transactions\n 2. Remove Cards that are in new_merchant\n 3. Agg by card_id (size)\n 4. Check cards with size 2,3,4...\nThere are some similar profiles but some have -33 and some positive loyalty score (with some variation there should be 1-2-5 points difference but not 30)\n\nAnd all other theories have some base but we dont know what is Elo Score and how it is calculated.\n\n~~~~\nstrange_items = historical_df[~(historical_df['card_id'].isin(new_merchant_df['card_id']))]\\\n                .groupby(['card_id'])['authorized_flag'].agg(['size'])\\\n                                .reset_index().rename(columns={'size': 'number_of_transactions'})\nstrange_items = strange_items[strange_items['number_of_transactions']&lt;7]\nstrange_items = train[(train['card_id'].isin(strange_items['card_id']))&amp;((train['target']&lt;-33)|(train['target']&gt;0))]\n~~~~",
      "votes": null
    },
    {
      "id": "462783",
      "postDate": "01/28/2019 22:10:09",
      "content": "<p>I tried to train the model without those outliers, replaced by mean, median. The score on train and cv reduced to 1.5~1.6, but LB went to 3.8+</p>",
      "rawMarkdown": "I tried to train the model without those outliers, replaced by mean, median. The score on train and cv reduced to 1.5~1.6, but LB went to 3.8+",
      "votes": null
    },
    {
      "id": "462826",
      "postDate": "01/29/2019 01:09:58",
      "content": "<p>This is quite difficult. I am still confused about this.</p>",
      "rawMarkdown": "This is quite difficult. I am still confused about this.",
      "votes": null
    },
    {
      "id": "463375",
      "postDate": "01/29/2019 22:15:44",
      "content": "<p>@jieWu Yeah, Removing the outliers and training the model doesn't seem a good practice here. Though you can use this method for post processing of predictions. That might help you.</p>",
      "rawMarkdown": "jieWu Yeah, Removing the outliers and training the model doesn't seem a good practice here. Though you can use this method for post processing of predictions. That might help you.",
      "votes": null
    },
    {
      "id": "463387",
      "postDate": "01/29/2019 22:46:47",
      "content": "<p>If outliers were NaNs, there would most likely be a single value for all outliers, and probably, it would be an integer, not a float.\nAlso, if  you look at a histogram of values below -33, the shape of the histogram is very similar to the shape of histogram for the non-outliers.  It might mean that these values carry some sort of a signal, and the signal is important. This would explain (to me at least) why removing the outliers impacts the  LB score so much</p>",
      "rawMarkdown": "If outliers were NaNs, there would most likely be a single value for all outliers, and probably, it would be an integer, not a float.\nAlso, if  you look at a histogram of values below -33, the shape of the histogram is very similar to the shape of histogram for the non-outliers.  It might mean that these values carry some sort of a signal, and the signal is important. This would explain (to me at least) why removing the outliers impacts the  LB score so much",
      "votes": null
    },
    {
      "id": "463403",
      "postDate": "01/29/2019 23:44:43",
      "content": "<p>Follow idea from <a href=\"https://www.kaggle.com/waitingli/combining-your-model-with-a-model-without-outlier\">https://www.kaggle.com/waitingli/combining-your-model-with-a-model-without-outlier</a>  I did these:\n1: I tried to build models either without 'outliers' or replace 'outliers' by mean, and use those models to predict test data. 2: Build a classification model to predict 'outlier'.  3: (My best model) Build a model with 'outlier', and predict on test data. 4: Use target value from 3 to replace the target value from 1, if the card_id is predicted (from 2) as 'outlier'.  But this did not improve my best result at all.</p>",
      "rawMarkdown": "Follow idea from https://www.kaggle.com/waitingli/combining-your-model-with-a-model-without-outlier  I did these:\n1: I tried to build models either without 'outliers' or replace 'outliers' by mean, and use those models to predict test data. 2: Build a classification model to predict 'outlier'.  3: (My best model) Build a model with 'outlier', and predict on test data. 4: Use target value from 3 to replace the target value from 1, if the card_id is predicted (from 2) as 'outlier'.  But this did not improve my best result at all.",
      "votes": null
    },
    {
      "id": "463404",
      "postDate": "01/29/2019 23:45:51",
      "content": "<p>Yes, those so called 'outlier' seems are very important.</p>",
      "rawMarkdown": "Yes, those so called 'outlier' seems are very important.",
      "votes": null
    },
    {
      "id": "465973",
      "postDate": "02/04/2019 12:55:01",
      "content": "<p>I am pretty sure the -33 comes from someone log(x+epsilon) the response instead of log(x+1) where epsilonis a small number. In theat case -33 arrises if x=0.</p>",
      "rawMarkdown": "I am pretty sure the -33 comes from someone log(x+epsilon) the response instead of log(x+1) where epsilonis a small number. In theat case -33 arrises if x=0.",
      "votes": null
    },
    {
      "id": "466084",
      "postDate": "02/04/2019 16:43:12",
      "content": "<p>Yes, it's log(10^-10)</p>",
      "rawMarkdown": "Yes, it's log(10^-10)",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 462207,
      "author_name": "kyakovlev",
      "author_url": "",
      "post_date": "01/27/2019 21:34:02",
      "content": "<p>-33.21928095 could be nan equivalent or -10 in some scale or sum of answers from questionnaire in scale fro 0 to 10 or sum of points in cardholder account or or or </p>\n\n<p>Why NaN\n 1. Check historical transactions\n 2. Remove Cards that are in new_merchant\n 3. Agg by card_id (size)\n 4. Check cards with size 2,3,4...\nThere are some similar profiles but some have -33 and some positive loyalty score (with some variation there should be 1-2-5 points difference but not 30)</p>\n\n<p>And all other theories have some base but we dont know what is Elo Score and how it is calculated.</p>\n\n<p>~~~~\nstrange_items = historical_df[~(historical_df['card_id'].isin(new_merchant_df['card_id']))]\\\n                .groupby(['card_id'])['authorized_flag'].agg(['size'])\\\n                                .reset_index().rename(columns={'size': 'number_of_transactions'})\nstrange_items = strange_items[strange_items['number_of_transactions']&lt;7]\nstrange_items = train[(train['card_id'].isin(strange_items['card_id']))&amp;((train['target']&lt;-33)|(train['target']&gt;0))]\n~~~~</p>",
      "votes": null,
      "replies": [
        {
          "id": 462783,
          "author_name": "lftuwujie",
          "author_url": "",
          "post_date": "01/28/2019 22:10:09",
          "content": "<p>I tried to train the model without those outliers, replaced by mean, median. The score on train and cv reduced to 1.5~1.6, but LB went to 3.8+</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 463375,
          "author_name": "harshit92",
          "author_url": "",
          "post_date": "01/29/2019 22:15:44",
          "content": "<p>@jieWu Yeah, Removing the outliers and training the model doesn't seem a good practice here. Though you can use this method for post processing of predictions. That might help you.</p>",
          "votes": null,
          "replies": []
        },
        {
          "id": 463404,
          "author_name": "lftuwujie",
          "author_url": "",
          "post_date": "01/29/2019 23:45:51",
          "content": "<p>Yes, those so called 'outlier' seems are very important.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 462826,
      "author_name": "longyin2",
      "author_url": "",
      "post_date": "01/29/2019 01:09:58",
      "content": "<p>This is quite difficult. I am still confused about this.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 463387,
      "author_name": "calabist",
      "author_url": "",
      "post_date": "01/29/2019 22:46:47",
      "content": "<p>If outliers were NaNs, there would most likely be a single value for all outliers, and probably, it would be an integer, not a float.\nAlso, if  you look at a histogram of values below -33, the shape of the histogram is very similar to the shape of histogram for the non-outliers.  It might mean that these values carry some sort of a signal, and the signal is important. This would explain (to me at least) why removing the outliers impacts the  LB score so much</p>",
      "votes": null,
      "replies": [
        {
          "id": 463403,
          "author_name": "lftuwujie",
          "author_url": "",
          "post_date": "01/29/2019 23:44:43",
          "content": "<p>Follow idea from <a href=\"https://www.kaggle.com/waitingli/combining-your-model-with-a-model-without-outlier\">https://www.kaggle.com/waitingli/combining-your-model-with-a-model-without-outlier</a>  I did these:\n1: I tried to build models either without 'outliers' or replace 'outliers' by mean, and use those models to predict test data. 2: Build a classification model to predict 'outlier'.  3: (My best model) Build a model with 'outlier', and predict on test data. 4: Use target value from 3 to replace the target value from 1, if the card_id is predicted (from 2) as 'outlier'.  But this did not improve my best result at all.</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 465973,
      "author_name": "trainedonatoaster",
      "author_url": "",
      "post_date": "02/04/2019 12:55:01",
      "content": "<p>I am pretty sure the -33 comes from someone log(x+epsilon) the response instead of log(x+1) where epsilonis a small number. In theat case -33 arrises if x=0.</p>",
      "votes": null,
      "replies": [
        {
          "id": 466084,
          "author_name": "lftuwujie",
          "author_url": "",
          "post_date": "02/04/2019 16:43:12",
          "content": "<p>Yes, it's log(10^-10)</p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "462199": "I found that -33.21928095 comes from -10/lg2, where 2^33.21928095=10,00,000,000 or in other words, 2^-33.21928095=10^-10 (very close to 0). So I am thinking how is the loyalty score calculated? Does  -33.21928095 mean customer is not loyal at all? But I found card_id='C_ID_e34ea29439', whose target value is  -33.21928095,  had 136 records in historical_transactions and 2 records in historical_transactions",
    "462207": "33.21928095 could be nan equivalent or -10 in some scale or sum of answers from questionnaire in scale fro 0 to 10 or sum of points in cardholder account or or or \n\nWhy NaN\n 1. Check historical transactions\n 2. Remove Cards that are in new_merchant\n 3. Agg by card_id (size)\n 4. Check cards with size 2,3,4...\nThere are some similar profiles but some have -33 and some positive loyalty score (with some variation there should be 1-2-5 points difference but not 30)\n\nAnd all other theories have some base but we dont know what is Elo Score and how it is calculated.\n\n~~~~\nstrange_items = historical_df[~(historical_df['card_id'].isin(new_merchant_df['card_id']))]\\\n                .groupby(['card_id'])['authorized_flag'].agg(['size'])\\\n                                .reset_index().rename(columns={'size': 'number_of_transactions'})\nstrange_items = strange_items[strange_items['number_of_transactions']&lt;7]\nstrange_items = train[(train['card_id'].isin(strange_items['card_id']))&amp;((train['target']&lt;-33)|(train['target']&gt;0))]\n~~~~",
    "462783": "I tried to train the model without those outliers, replaced by mean, median. The score on train and cv reduced to 1.5~1.6, but LB went to 3.8+",
    "462826": "This is quite difficult. I am still confused about this.",
    "463375": "jieWu Yeah, Removing the outliers and training the model doesn't seem a good practice here. Though you can use this method for post processing of predictions. That might help you.",
    "463387": "If outliers were NaNs, there would most likely be a single value for all outliers, and probably, it would be an integer, not a float.\nAlso, if  you look at a histogram of values below -33, the shape of the histogram is very similar to the shape of histogram for the non-outliers.  It might mean that these values carry some sort of a signal, and the signal is important. This would explain (to me at least) why removing the outliers impacts the  LB score so much",
    "463403": "Follow idea from https://www.kaggle.com/waitingli/combining-your-model-with-a-model-without-outlier  I did these:\n1: I tried to build models either without 'outliers' or replace 'outliers' by mean, and use those models to predict test data. 2: Build a classification model to predict 'outlier'.  3: (My best model) Build a model with 'outlier', and predict on test data. 4: Use target value from 3 to replace the target value from 1, if the card_id is predicted (from 2) as 'outlier'.  But this did not improve my best result at all.",
    "463404": "Yes, those so called 'outlier' seems are very important.",
    "465973": "I am pretty sure the -33 comes from someone log(x+epsilon) the response instead of log(x+1) where epsilonis a small number. In theat case -33 arrises if x=0.",
    "466084": "Yes, it's log(10^-10)"
  },
  "source": "meta"
}