{
  "id": 331886,
  "title": "Understanding competition metric ",
  "url": "/competitions/amex-default-prediction/discussion/331886",
  "author_name": "Somesh88",
  "post_date": "2022-06-19T09:29:05.095000",
  "votes": 14,
  "comment_count": 0,
  "views": 0,
  "content": "<h2>Understanding the metrics for competition</h2>\n<p>From competitions page the metric for this competition is based on the normalized ginni coefficient and default rate calculated at the 4% let's see what does this means individually </p>\n<p><strong>Ginni Coefficient</strong><br>\nBy definition in economics Ginni coefficient is a measure of statistical dispersion intended to represent the income inequality or the wealth inequality within a nation or a social group. </p>\n<p>for calculating the Ginni coefficient I came across really good diagram which explains how it's calculated<br>\n<img src=\"https://i.ibb.co/68VVNK2/41598-2019-54288-Fig1-HTML.webp\" alt=\"\"><br>\nfrom <a href=\"https://www.nature.com/articles/s41598-019-54288-7\" target=\"_blank\">https://www.nature.com/articles/s41598-019-54288-7</a></p>\n<p>for understandign this metric we need to find what the lorentz metrics really is. <br>\nThe lorent matric is the cummulative propotinal of household income versus cummulitive sum of income <br>\nif every household has the same income the lorentz curve lies at 45 degress it's the perfect equality line. </p>\n<p>The ginni coefficient is 0 if the Lorent curve is perfectly matched to the equality line. Otherwise the value of ginni coefficient is greater ( 1 is maximum ) <br>\nfor understanding this in more depth: <br>\n<a href=\"https://www.youtube.com/watch?v=BwSB__Ugo1s\" target=\"_blank\">https://www.youtube.com/watch?v=BwSB__Ugo1s</a></p>\n<p>For more information Ginni Coefficient : <a href=\"https://en.wikipedia.org/wiki/Gini_coefficient\" target=\"_blank\">https://en.wikipedia.org/wiki/Gini_coefficient</a><br>\n<strong>Default rate</strong> <br>\nwe are calculating the default rate by using target variables where the cummulative normal weight is less than 4% we are taking sum of target and divigind it with the sum of total no of true predictions <br>\n<code>np.sum(target[four_pct_mask]) / n_pos</code><br>\nhere four_pct_mask is the mask where the cummulative normal weight is &lt; 4% <br>\nn_pos: is the sum of total true predictions. </p>\n<p><strong>finally metric calculation</strong> <br>\nas stated in the competition metric information we can calculate this metric by using <code>0.5 * (g + d)</code> where g is the ginni coefficient and d is the default rate calculated as 4%</p>\n<p><strong>--------------------------</strong> </p>\n<p>Please correct me if I am wrong in comments to this notebook. And don't forget to upvote if you have learnt something new. </p>\n<p>The code for the evaluation metric for this competition is in the next cell. </p>",
  "messages": [
    {
      "id": 1825382,
      "postDate": "2022-06-19T09:29:05.097Z",
      "content": "<h2>Understanding the metrics for competition</h2>\n<p>From competitions page the metric for this competition is based on the normalized ginni coefficient and default rate calculated at the 4% let's see what does this means individually </p>\n<p><strong>Ginni Coefficient</strong><br>\nBy definition in economics Ginni coefficient is a measure of statistical dispersion intended to represent the income inequality or the wealth inequality within a nation or a social group. </p>\n<p>for calculating the Ginni coefficient I came across really good diagram which explains how it's calculated<br>\n<img src=\"https://i.ibb.co/68VVNK2/41598-2019-54288-Fig1-HTML.webp\" alt=\"\"><br>\nfrom <a href=\"https://www.nature.com/articles/s41598-019-54288-7\" target=\"_blank\">https://www.nature.com/articles/s41598-019-54288-7</a></p>\n<p>for understandign this metric we need to find what the lorentz metrics really is. <br>\nThe lorent matric is the cummulative propotinal of household income versus cummulitive sum of income <br>\nif every household has the same income the lorentz curve lies at 45 degress it's the perfect equality line. </p>\n<p>The ginni coefficient is 0 if the Lorent curve is perfectly matched to the equality line. Otherwise the value of ginni coefficient is greater ( 1 is maximum ) <br>\nfor understanding this in more depth: <br>\n<a href=\"https://www.youtube.com/watch?v=BwSB__Ugo1s\" target=\"_blank\">https://www.youtube.com/watch?v=BwSB__Ugo1s</a></p>\n<p>For more information Ginni Coefficient : <a href=\"https://en.wikipedia.org/wiki/Gini_coefficient\" target=\"_blank\">https://en.wikipedia.org/wiki/Gini_coefficient</a><br>\n<strong>Default rate</strong> <br>\nwe are calculating the default rate by using target variables where the cummulative normal weight is less than 4% we are taking sum of target and divigind it with the sum of total no of true predictions <br>\n<code>np.sum(target[four_pct_mask]) / n_pos</code><br>\nhere four_pct_mask is the mask where the cummulative normal weight is &lt; 4% <br>\nn_pos: is the sum of total true predictions. </p>\n<p><strong>finally metric calculation</strong> <br>\nas stated in the competition metric information we can calculate this metric by using <code>0.5 * (g + d)</code> where g is the ginni coefficient and d is the default rate calculated as 4%</p>\n<p><strong>--------------------------</strong> </p>\n<p>Please correct me if I am wrong in comments to this notebook. And don't forget to upvote if you have learnt something new. </p>\n<p>The code for the evaluation metric for this competition is in the next cell. </p>",
      "rawMarkdown": "## Understanding the metrics for competition \n\n\nFrom competitions page the metric for this competition is based on the normalized ginni coefficient and default rate calculated at the 4% let's see what does this means individually \n\n**Ginni Coefficient**\nBy definition in economics Ginni coefficient is a measure of statistical dispersion intended to represent the income inequality or the wealth inequality within a nation or a social group. \n\nfor calculating the Ginni coefficient I came across really good diagram which explains how it's calculated\n![](https://i.ibb.co/68VVNK2/41598-2019-54288-Fig1-HTML.webp)\nfrom https://www.nature.com/articles/s41598-019-54288-7\n\nfor understandign this metric we need to find what the lorentz metrics really is. \nThe lorent matric is the cummulative propotinal of household income versus cummulitive sum of income \nif every household has the same income the lorentz curve lies at 45 degress it's the perfect equality line. \n\nThe ginni coefficient is 0 if the Lorent curve is perfectly matched to the equality line. Otherwise the value of ginni coefficient is greater ( 1 is maximum ) \nfor understanding this in more depth: \nhttps://www.youtube.com/watch?v=BwSB__Ugo1s\n\nFor more information Ginni Coefficient : https://en.wikipedia.org/wiki/Gini_coefficient\n**Default rate** \nwe are calculating the default rate by using target variables where the cummulative normal weight is less than 4% we are taking sum of target and divigind it with the sum of total no of true predictions \n`np.sum(target[four_pct_mask]) / n_pos`\nhere four_pct_mask is the mask where the cummulative normal weight is < 4% \nn_pos: is the sum of total true predictions. \n\n\n**finally metric calculation** \nas stated in the competition metric information we can calculate this metric by using `0.5 * (g + d)` where g is the ginni coefficient and d is the default rate calculated as 4%\n\n**--------------------------** \n\nPlease correct me if I am wrong in comments to this notebook. And don't forget to upvote if you have learnt something new. \n\nThe code for the evaluation metric for this competition is in the next cell. \n\n",
      "votes": 13
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "1825382": "## Understanding the metrics for competition \n\n\nFrom competitions page the metric for this competition is based on the normalized ginni coefficient and default rate calculated at the 4% let's see what does this means individually \n\n**Ginni Coefficient**\nBy definition in economics Ginni coefficient is a measure of statistical dispersion intended to represent the income inequality or the wealth inequality within a nation or a social group. \n\nfor calculating the Ginni coefficient I came across really good diagram which explains how it's calculated\n![](https://i.ibb.co/68VVNK2/41598-2019-54288-Fig1-HTML.webp)\nfrom https://www.nature.com/articles/s41598-019-54288-7\n\nfor understandign this metric we need to find what the lorentz metrics really is. \nThe lorent matric is the cummulative propotinal of household income versus cummulitive sum of income \nif every household has the same income the lorentz curve lies at 45 degress it's the perfect equality line. \n\nThe ginni coefficient is 0 if the Lorent curve is perfectly matched to the equality line. Otherwise the value of ginni coefficient is greater ( 1 is maximum ) \nfor understanding this in more depth: \nhttps://www.youtube.com/watch?v=BwSB__Ugo1s\n\nFor more information Ginni Coefficient : https://en.wikipedia.org/wiki/Gini_coefficient\n**Default rate** \nwe are calculating the default rate by using target variables where the cummulative normal weight is less than 4% we are taking sum of target and divigind it with the sum of total no of true predictions \n`np.sum(target[four_pct_mask]) / n_pos`\nhere four_pct_mask is the mask where the cummulative normal weight is < 4% \nn_pos: is the sum of total true predictions. \n\n\n**finally metric calculation** \nas stated in the competition metric information we can calculate this metric by using `0.5 * (g + d)` where g is the ginni coefficient and d is the default rate calculated as 4%\n\n**--------------------------** \n\nPlease correct me if I am wrong in comments to this notebook. And don't forget to upvote if you have learnt something new. \n\nThe code for the evaluation metric for this competition is in the next cell. \n\n"
  }
}