<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: artem-evstafev</title>
    <description>The latest articles on DEV Community by artem-evstafev (@artemevstafev).</description>
    <link>https://dev.to/artemevstafev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F994688%2F5dd84a61-08d1-41f4-b094-5fcb6618bc6e.png</url>
      <title>DEV Community: artem-evstafev</title>
      <link>https://dev.to/artemevstafev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/artemevstafev"/>
    <language>en</language>
    <item>
      <title>Should I create a classification or regression model?</title>
      <dc:creator>artem-evstafev</dc:creator>
      <pubDate>Thu, 29 Dec 2022 10:43:38 +0000</pubDate>
      <link>https://dev.to/artemevstafev/should-i-create-a-classification-or-regression-model-add</link>
      <guid>https://dev.to/artemevstafev/should-i-create-a-classification-or-regression-model-add</guid>
      <description>&lt;p&gt;In many cases it's quite obvious that we have a classification or regression task and it's impossible to make such a mistake when you pick your model design. However, in some cases it's not so obvious, as the target variable can be a mix of regression and classification target variables. For example, our target variable can be equal to zero in vast majority of cases and varies a lot in all other cases. This is a very common situation in financial tasks, when we have to predict the default of the customer and potential damage depends from this customer's exposure, or when we try to identify fraud transactions and losses depend from the size of the transaction. In these cases, it can be quite difficult to pick a particular model design, so let's try to simulate this situation and investigate different approaches.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1994j4lhdnhxj93hv4sf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1994j4lhdnhxj93hv4sf.png" alt="Image description" width="800" height="351"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, let's introduce one more variable: &lt;em&gt;amount&lt;/em&gt;=10^(Normal distributed variable), this variable will show potential loss connected with every case when y &amp;gt; th. Let's imagine that in our case p = 0.99, and alpha = 0.5, so we have any losses only in 1% of cases and Gini coefficient of our model in about 50%. Let's imagine also that our threshold on the same level as p, so we can reject only 1% of cases and have to accept 99%. The main target metric for us is recall, the percent of all losses rejected by our model, when we can reject only 1% of cases.&lt;/p&gt;

&lt;p&gt;Let's consider 4 different options here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We can create a classification model not directly connected with money, range our cases and reject 1% of cases with highest probability of loss. (In our particular case we will use x as a score.)&lt;/li&gt;
&lt;li&gt;We can transform x to probability by normal cdf, and multiply this probability by money. It will be our expected loss and we can reject 1% of cases with highest expected loss.&lt;/li&gt;
&lt;li&gt;We can create a ridge regression model based on our x and amount and reject 1% of cases with highest ridge predictions.&lt;/li&gt;
&lt;li&gt;We can create a ridge regression model based on our x and log(amount) and reject 1% of cases with highest ridge predictions.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgsudysozjui7jg5ir519.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgsudysozjui7jg5ir519.png" alt="Image description" width="800" height="567"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All in all, we can see that classification task multiplied by amount of money gave the best result here (recall = 58%), on the second place is regression on amount and x (recall = 52%), on the third place is regression on log(amount) and x (recall = 51%) and on the last place is naive classification model (recall = 12%). So, the best solution in such kind of tasks is to create a classification model with final multiplication by money or a simple regression model.&lt;/p&gt;

</description>
      <category>emptystring</category>
    </item>
    <item>
      <title>Intuition behind ROC AUC and Gini coefficient</title>
      <dc:creator>artem-evstafev</dc:creator>
      <pubDate>Thu, 22 Dec 2022 16:09:07 +0000</pubDate>
      <link>https://dev.to/artemevstafev/intuition-behind-roc-auc-and-gini-coefficient-5eff</link>
      <guid>https://dev.to/artemevstafev/intuition-behind-roc-auc-and-gini-coefficient-5eff</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Anyone who ever tried to create any classification model, knows that there are not too many metrics that measure the quality of the model and don't depend directly from the model threshold. &lt;a href="https://en.wikipedia.org/wiki/Receiver_operating_characteristic"&gt;ROC AUC&lt;/a&gt; score one of the most widely accepted characteristics of the model, but it's not intuitively clear what does it mean? how good is the model with AUC = 70%? what is the potential room for improvement? in some cases, should I still use classification or switch to regression model? how it is connected with corresponding characteristics of regression model: coefficient of determination and correlation coefficient? In this article I will try to prove that &lt;strong&gt;Gini coefficient&lt;/strong&gt; (it's equal to 2 * AUC -1) approximately &lt;strong&gt;corresponds to correlation coefficient&lt;/strong&gt; in regression tasks and &lt;a href="https://en.wikipedia.org/wiki/Coefficient_of_determination"&gt;coefficient of determination&lt;/a&gt; = Gini^2.&lt;/p&gt;

&lt;h2&gt;
  
  
  Result
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ps-ruKVf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lo5l7y1jly5hymukul12.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ps-ruKVf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lo5l7y1jly5hymukul12.png" alt="Image description" width="880" height="623"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tvJZOUfE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g7xfcy48qenmletil6vy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tvJZOUfE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g7xfcy48qenmletil6vy.png" alt="Image description" width="880" height="409"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZQa315oa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wre1s4w370dqyhh35jqq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZQa315oa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wre1s4w370dqyhh35jqq.png" alt="Image description" width="880" height="518"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nHhShNuk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zjdpaf2dptfoiewtaftk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nHhShNuk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zjdpaf2dptfoiewtaftk.png" alt="Image description" width="880" height="114"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A4D59djJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g61t3dlzg0pzqda14hxs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A4D59djJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g61t3dlzg0pzqda14hxs.png" alt="Image description" width="880" height="676"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YQ1pXLh8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e8vh9nu59cmsw47s6a9y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YQ1pXLh8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e8vh9nu59cmsw47s6a9y.png" alt="Image description" width="880" height="679"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Wz7079mc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uztna5amu5imrm6a9tpg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Wz7079mc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uztna5amu5imrm6a9tpg.png" alt="Image description" width="880" height="625"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eUkSbXNz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/50vtrhex5r78q3g0ls1u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eUkSbXNz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/50vtrhex5r78q3g0ls1u.png" alt="Image description" width="880" height="530"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u2cAq5j2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k5w0h3vyohflnwgm9x1g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u2cAq5j2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k5w0h3vyohflnwgm9x1g.png" alt="Image description" width="880" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;All in all, we can see that Gini coefficient (= 2 * AUC - 1) corresponds to correlation coefficient in regression models and describes the portion of information that we know about hidden variable. For example, with AUC = 70%, Gini = 40%, and we can explain 16% of variance of hidden variable, and cannot explain 84% of its variance.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
