<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Murat Demiralay on Medium]]></title>
        <description><![CDATA[Stories by Murat Demiralay on Medium]]></description>
        <link>https://medium.com/@dmrlymrt80?source=rss-d160a9099d8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*W0FbxPiAiV0z3c4rNdf2VA.jpeg</url>
            <title>Stories by Murat Demiralay on Medium</title>
            <link>https://medium.com/@dmrlymrt80?source=rss-d160a9099d8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 15:54:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dmrlymrt80/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How Boruta Works and Tuning for Feature Selection]]></title>
            <link>https://dmrlymrt80.medium.com/how-boruta-works-and-tuning-for-feature-selection-dfe99b9ae28d?source=rss-d160a9099d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/dfe99b9ae28d</guid>
            <category><![CDATA[feature-engineering]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[boruta]]></category>
            <category><![CDATA[feature-selection]]></category>
            <category><![CDATA[feature-importance]]></category>
            <dc:creator><![CDATA[Murat Demiralay]]></dc:creator>
            <pubDate>Tue, 03 May 2022 17:07:54 GMT</pubDate>
            <atom:updated>2022-05-03T18:25:07.471Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*JmCI4g_HlGS8VPzXQYpO0w.png" /></figure><p>Feature selection might be the one of the most important step of machine learning project or kaggle competitions.There is also a lot of libraries one can use in terms of selection.</p><p>Why we should do feature selection ?</p><ol><li>Firstly, the reduction in model size and complexity makes it easier to interpret.</li><li>The smaller model is now faster and easier to train. Also with less features to create the feature engineering pipeline can also be simplified.</li><li>Feature selection can also reduce over fitting by removing noisy features.</li></ol><p>So feature selection algorithm should do two things right, discard redundant features, keep features that contribute the most to model performance.</p><p>In this article i would like to talk about one of the most robust feature selection algorithm called Boruta then how to implement them.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F3576273&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fso-itbegins-lord-of-the-rings-helms-deep-war-gif-3576273&amp;image=https%3A%2F%2Fc.tenor.com%2FSvQ5kuPc2qkAAAAC%2Fso-itbegins-lord-of-the-rings.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/82581f46568299e5db7e4faf914451cc/href">https://medium.com/media/82581f46568299e5db7e4faf914451cc/href</a></iframe><p>Boruta is an additive library and both has beneficial effects on feature selection part of the machine learning projects.</p><p>It has several steps as follows;</p><ol><li><strong>Creating Shadow Features</strong> 👤 👤</li></ol><p>First thing Boruta do is evaluating the feature importances.In traditional way all columns are competed against each other in terms of importance but Boruta create new features called “ Shadow Features” basically the shuffled version of a normal columns.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F4828474&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Flord-of-the-rings-gandalf-balrog-shadow-gandalf-the-gray-gif-4828474&amp;image=https%3A%2F%2Fc.tenor.com%2FT3gJ2kJCCiEAAAAC%2Flord-of-the-rings-gandalf.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/29591bcbe4719ec22a075c3af0ab3c33/href">https://medium.com/media/29591bcbe4719ec22a075c3af0ab3c33/href</a></iframe><p>a. <strong>Running Random Forest Classifier</strong> 🌳</p><p>Then run a random forest classifier as a feature importance(Mean Decrease Accuracy:Expresses how much accuracy the model losses by excluding each variable) and to evaluate the importance of each feature.</p><p>b. <strong>Assessing the Importances</strong></p><p>In this step,the threshold is defined as the highest features importance recorded among the shadow features. When the importance of a feature is higher than this threshold, this is called a “bingo”.</p><p>Basic idea behind this approach is feature only useful if it is capable of doing better than best randomized feature.</p><p>2. <strong>Iteration is the Key </strong>🔑</p><p>Does the data scientist rely on one iteration or does it take more than one trial and error to reach a more reliable result ?</p><p>Not surprisingly, 1000 trials are more reliable than 1 trial.</p><p>If the each trial result(reject or keep) projected on a binomial plot distribution there will be three different areas namely, rejection, acceptance,grey area.</p><ul><li>Rejection area 🔴 : Features that end up here are considered as noise, so they are dropped</li><li>Grey area ⚪️ : Boruta is uncertain about the features that are in this area</li><li>Acceptance area 🟢 : Features that end up here are considered as predictive, so they are kept.</li></ul><h3>Where does Boruta Differs ?</h3><h3>— Minimal-optimal feature selection vs all-relevant feature selection —</h3><p>Boruta follows an all-relevant feature selection method where it captures all features which are in some circumstances relevant to the outcome variable. In contrast, most of the traditional feature selection algorithms follow a minimal optimal method where they rely on a small subset of features which yields a minimal error on a chosen classifier.</p><p>To illustrate this, suppose that we have two variables, A and B. These variables are correlated with one another, and correlated with the objective variable. However, A is a stronger signal than B is. In a regular decision tree the A feature will be given high importance whle the B feature will be mostly ignored in A’s favor. If we were minimizing our variable count then we would remove B.</p><p>While fitting a random forest model on a data set, you can recursively get rid of features in each iteration which didn’t perform well in the process. This will eventually lead to a minimal optimal subset of features as the method minimizes the error of random forest model. This happens by selecting an over-pruned version of the input data set, which in turn, throws away some relevant features.</p><h3>Conclusion</h3><p>Feature selection seems to be a step that is often overlooked and should not be overemphasized.</p><p>But this and many article refer that the value of a feature selection should not be underestimate.After all , making significant decisions about features is critical to ensure the success of your predictive model.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dfe99b9ae28d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the difference between Label Encoding and One Hot Encoding]]></title>
            <link>https://dmrlymrt80.medium.com/understanding-the-difference-between-label-encoding-and-one-hot-encoding-27888ddf14b9?source=rss-d160a9099d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/27888ddf14b9</guid>
            <category><![CDATA[label-encoding]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[one-hot-encoding]]></category>
            <category><![CDATA[preprocess]]></category>
            <dc:creator><![CDATA[Murat Demiralay]]></dc:creator>
            <pubDate>Fri, 26 Mar 2021 15:47:09 GMT</pubDate>
            <atom:updated>2021-03-26T16:25:39.900Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ot8SS-l2cPwOaedrmAwjzg.png" /></figure><p>If you are interested in machine learning and while you watching a video, visiting a repository or reading a machine learning article there is some terms that you definitely encounter with.It is ENCODİNG!</p><p>Encoding is the process of converting <a href="https://techterms.com/definition/data">data</a> from one form to another.You don’t change any information about the data, only representation is changing.In machine learning encoding is the task of converting categorical features into numerical.Let’s get started to understand Label Encoding.</p><p>1.Label Encoding</p><p>Before we dive into Label Encoding there is one concepts we should cover.It is Ordinal Scale.</p><p>An Ordinal scale is a variable in which the value of the data is captured from an ordered set.Let’s say the Feedback column is collected using a five-point scale. The numerical code 1, is assigned to Poor, 2 for Fair, 3 for Good, 4 for Very Good, and 5 for Excellent. We can observe that 5 is better than 4, and 5 is much better than 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*zcYtqgm-k_2KWkkS-9Zr5w.png" /></figure><p>We can understand excellent is the best but for your model you have to tell to your algorithm that excellent is more better than poor.So you have to give a big number to imply that the excellent is the best.İn a nutshell if you have an ordinal column you should do this conversion.But don’t forget to scale the column after the preprocessing.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6a992ab44342651030250b7969ec702a/href">https://medium.com/media/6a992ab44342651030250b7969ec702a/href</a></iframe><p>This is an example how to do it manually.You can also use scikit-learn Labelencoder pre-defined library.</p><p>2.One Hot Encoding</p><p>As you see in the first example above some categorical variables are important or better in some manner.But some categorical variables like nationality(british,canadian,indian) are not important or better than one another.So how should we process this types of columns ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*Xz64oWL_LBzf8BJ6m2JMTg.png" /></figure><p>In order to process this types of columns we have to do one hot encoding.As you can see above,we have created 3 column from nationality column.So this way model is going to treat equally.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3db12df352057277832aea7f6e46afa6/href">https://medium.com/media/3db12df352057277832aea7f6e46afa6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27888ddf14b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dealing with Imbalanced Dataset]]></title>
            <link>https://dmrlymrt80.medium.com/dealing-with-imbalanced-dataset-8fbc5a81b43f?source=rss-d160a9099d8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8fbc5a81b43f</guid>
            <category><![CDATA[smote]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[imbalanced-data]]></category>
            <category><![CDATA[accuracy]]></category>
            <dc:creator><![CDATA[Murat Demiralay]]></dc:creator>
            <pubDate>Fri, 26 Mar 2021 13:17:41 GMT</pubDate>
            <atom:updated>2024-01-07T12:13:23.212Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial,we are tackle the problem of imbalanced dataset and get the knowledge of how to spot them easily and SMOTE technique</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*7634ahDOQbzg744hiFkcww.png" /></figure><p>Let’s say you just graduated from college and you looking for a job.One of the company that you applied before, sending you a case study including classification task.You done preprocessing,implementing various techniques,finding the right model etc. and then fit the model for test set see how it can manage the unseen data and you got the result of %93.52 accuraccy.You suddenly become so happy and you thought your model was done a great job.Then you go ahead and print the confusion matrix, output was something similar to this;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*Mhw8Zmz-FGkQx0QDNbtreQ.png" /></figure><p>Model really done a tremendous job by finding the True Positives(upper left) but only able to catch 1 True Negative(rest of them is classified wrongly).But how this is happened?</p><p>1.Metrics</p><p>So first mistake you done was only check for the accuracy metric.Accuracy metric,is a metric that summarizes the performance of a classification model as the number of correct predictions divided by the total number of predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*q-kSKo5gN52hgCT175D6iA.png" /></figure><p>Most common mistake made by beginners to imbalanced classification is using only accuracy metric.Achieving 90 percent classification accuracy, or even 99 percent classification accuracy might not be a valid score.</p><p>So in this case what you should do is check for other classification metrics.Such as precision,recall and F1 score.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eI1tl32tCun84qaTIn6uUg.png" /></figure><p>Once you print this score you most likely to see recall and F1 score is very small.</p><p>2.SMOTE(Synthetic Minority Oversampling Technique)</p><p>The reason why i wrote this blog is show you to SMOTE technique.As you can understand from it’s name it is an oversampling technique using minorty class.</p><p>Oversampling is,used to increase the amount of data by adding slightly modified copies of already existing data or newly created synthetic data from existing data but it does not cause any increase in the variety of training examples. İt’s look like this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*GcTw9AgZhKwq8lA713mMdA.png" /></figure><p>Smote on the other hand,not only increases the size of the training data set, it also increases the variety.</p><p>SMOTE creates new (artificial) training examples based on the original training examples. For instance, if it sees two examples (of the same class) near each other, it creates a third artificial one, bang in the middle of the original two.</p><p>SMOTE, when done right, is preferable over old random oversampling. One, however, has to be careful about the newly created examples and must make sure that they are ‘legal’. For example, for an input for which legal values are a table and chair, there is no legal in-between value.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f4ba248346c4781546bc6078e963160/href">https://medium.com/media/3f4ba248346c4781546bc6078e963160/href</a></iframe><p>That’s how easy implement and also how important it is.</p><p>İf you have further question do not hesitate to ask in the comments.</p><p>Also who might want to see my imbalanced dataset repo link is;</p><p><a href="https://www.kaggle.com/demiralaymuratt/sisasoft">sisasoft</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8fbc5a81b43f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>