<?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[ogi_on_ds - Medium]]></title>
        <description><![CDATA[I will share the resources I find on a daily basis, certain pieces of code, and posts about my habit of taking notes. - Medium]]></description>
        <link>https://medium.com/ogi-on-ds?source=rss----9df790f5a716---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>ogi_on_ds - Medium</title>
            <link>https://medium.com/ogi-on-ds?source=rss----9df790f5a716---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 25 May 2026 22:23:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/ogi-on-ds" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Introduction to Machine Learning 1: What is Machine Learning?]]></title>
            <link>https://medium.com/ogi-on-ds/introduction-to-machine-learning-1-what-is-machine-learning-57f96e414d18?source=rss----9df790f5a716---4</link>
            <guid isPermaLink="false">https://medium.com/p/57f96e414d18</guid>
            <category><![CDATA[supervised-learning]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[introduction]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Ogulcan Ertunc]]></dc:creator>
            <pubDate>Tue, 09 Mar 2021 15:52:01 GMT</pubDate>
            <atom:updated>2021-03-24T20:33:45.183Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction to Machine Learning: What is Machine Learning?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*NL70LmBUPYNunKfU.jpeg" /><figcaption><a href="https://carlolepelaars.nl/2018/10/15/100daysofmlcode-summary/">https://carlolepelaars.nl/2018/10/15/100daysofmlcode-summary/</a></figcaption></figure><p>When most people hear “Machine Learning”, they picture a robot: a deadly Terminator or a dangerous computer, which wants to destroy humanity just like in the Matrix movie.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FBg8eMbirQ8CZ2%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FBg8eMbirQ8CZ2%2Fsource.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FBg8eMbirQ8CZ2%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="217" frameborder="0" scrolling="no"><a href="https://medium.com/media/f96a6295130514ed3c8ea273d04468fa/href">https://medium.com/media/f96a6295130514ed3c8ea273d04468fa/href</a></iframe><p>But welcome to reality, Machine Learning is not just a futuristic fantasy; it’s already here. In fact, it has been around for decades in some specialized applications, such as movie recommendation systems in online Movie/Series Platforms.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FnGnKGLOqzhfGM%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FnGnKGLOqzhfGM%2Fsource.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FnGnKGLOqzhfGM%2F200.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="181" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c3f1da423fa82331d79d5ee2c341cc2/href">https://medium.com/media/0c3f1da423fa82331d79d5ee2c341cc2/href</a></iframe><p>But in my opinion, the first ML app that really became indispensable, the spam filter. It’s not exactly Skynet or Agent (from Matrix), but it does technically qualify as a Machine Learning. It has actually learned so well that you seldom need to flag an email as spam anymore. So grab a coffee and let’s get started!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3oFyDpRagf96Uz9rzO%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3oFyDpRagf96Uz9rzO%2Fsource.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F3oFyDpRagf96Uz9rzO%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/9135c80ddc9fc61e202081a7ff020bc9/href">https://medium.com/media/9135c80ddc9fc61e202081a7ff020bc9/href</a></iframe><h3>What is Machine Learning?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EUZ2gU6XDmSJH5Jw" /><figcaption>Photo by <a href="https://unsplash.com/@askkell?utm_source=medium&amp;utm_medium=referral">Andy Kelly</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>It is something between science and art of programming computers so they can learn from data.</p><blockquote>Field of study that gives computers the ability to learn without being explicitly programmed.</blockquote><blockquote>— Arthur Samuel, 1959</blockquote><p>In the spam filter I have given as an example, examples of spam emails consist of mail data previously marked by users, and non-spam, which we can call “raw”, consists of mail data from those that are not marked by users, and it is a machine learning program that can learn to mark spam from this sample set. The examples used by the system to learn are called training sets.</p><p>Each training instance is called a training instance/sample. In this case, the task is to find out if a mail is a spam for new emails and flag the spam email, the experience is training data and the performance metric needs to be defined: for example, you can use the proportion of correctly classified emails. This particular measure of performance is called accuracy and is often used in classification tasks. However, accuracy can be misleading in most cases. In these cases, it would be better to look at Precision to measure the really correct ones. I will explain later what the measure of successful techniques is.</p><h3>So Why use Machine Learning?</h3><p>Sometimes the problem is difficult/complicated and repeated, and you don’t want to spend your time on this kind of thing. So you can create your own machine learning program. And if you can train it enough, it can solve your problems. Easy, right?</p><h4>So Machine Learning is great for:</h4><ul><li>Problems where existing solutions require a lot of tweaking or long lists of rules: a machine learning algorithm can often simplify code and outperform the traditional approach. However, this may take a long time or may require high computing power.</li><li>Complex problems where using the traditional approach does not provide a good solution. Perhaps the best machine learning techniques can find a solution.</li><li>Volatile environments: A machine learning system can adapt to new data.</li><li>Gain insights into complex problems and large amounts of data.</li></ul><p>Best and Basic Examples of Applications</p><p>Let’s look at some concrete examples of Machine Learning task along with the techniques that can tackle them:</p><ul><li><strong>Detecting a Covid patient through the lung film.</strong><br>This is semantic segmentation, where each pixel in the image is classified, typically using CNN.</li><li><strong>Automatically classifying Medium articles<br></strong>This is natural language processing(NLP), and more specifically text classification which can be tackled using recurrent neural networks(RNNs), CNNs or Transformers.</li><li><strong>Forecasting some companies revenue next year, based on many performance metrics</strong><br>This is a regression task that may be tackled using any regression model such as Random Forest Regression, Polynomial Regression, or artificial neural network. If you want to improve it you can also use Transformers for it.</li><li><strong>Detecting credit card fraud<br></strong>This is anomaly detection</li><li><strong>Customer Segmentation<br></strong>Segmenting clients based on their purchases so that you can design a different marketing strategy for each segment</li></ul><h4>Wow, Almost every example has a different algorithm, What are the types of machine learning?</h4><p>Actually, there are so many different types of ML algorithms that it is useful to classify them in broad categories but basically, there are three algorithms.</p><ol><li><strong>Supervised Learning<br></strong>The purpose of a supervised learning algorithm is to use the dataset to generate a model. Field a feature vector x as input and extract information allowing the label to be extracted</li><li><strong>Unsupervised Learning<br></strong>In unsupervised learning, the dataset is a collection of unlabeled samples. Again, x is a feature vector, and the purpose of an unsupervised learning algorithm is to take the feature vector x as input and convert it to either another vector or a value that can be used to solve a practical problem.</li><li><strong>Semi-supervised Learning<br></strong>In semi-supervised learning, the dataset contains both labeled and unlabeled examples.<br>Usually, the quantity of unlabeled examples is much higher than the number of labeled examples. The goal of a semi-supervised learning algorithm is the same as the goal of the supervised learning algorithm. The hope here is that using many unlabeled examples can help the learning algorithm to find (we might say “produce” or “compute”) a better model.</li><li><strong>Reinforcement Learning<br></strong>Reinforcement learning is a subfield of machine learning where the machine “lives” in an environment and can perceive the state of that environment as a feature vector. The machine can take action in any situation. Different actions bring different rewards and can move the machine to another environment situation. The purpose of the reinforcement learning algorithm is to learn a policy.</li></ol><p><em>References</em></p><ol><li>THE HUNDRED-PAGE MACHINE LEARNING BOOK, Andriy Burkov</li><li>Hands on Machine Learning with Scikit-Learn, Keras and Tensorflow, Aurelien Geron</li><li><a href="https://www.expert.ai/blog/machine-learning-definition/">https://www.expert.ai/blog/machine-learning-definition/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57f96e414d18" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ogi-on-ds/introduction-to-machine-learning-1-what-is-machine-learning-57f96e414d18">Introduction to Machine Learning 1: What is Machine Learning?</a> was originally published in <a href="https://medium.com/ogi-on-ds">ogi_on_ds</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Logic Behind A/B Testing with Sample Python Code]]></title>
            <link>https://medium.com/ogi-on-ds/the-logic-behind-a-b-testing-with-sample-python-code-a4ed76e99f93?source=rss----9df790f5a716---4</link>
            <guid isPermaLink="false">https://medium.com/p/a4ed76e99f93</guid>
            <category><![CDATA[statistical-analysis]]></category>
            <category><![CDATA[ab-test]]></category>
            <category><![CDATA[advertising]]></category>
            <category><![CDATA[hypothesis-testing]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Ogulcan Ertunc]]></dc:creator>
            <pubDate>Sat, 06 Feb 2021 22:56:59 GMT</pubDate>
            <atom:updated>2021-02-18T20:53:10.652Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*zSEyiM6tT9q11b7WlX8a5w.jpeg" /></figure><p>In that topic, we will consider the evaluation of the advertising methods of a large company.</p><p>The data we have includes the new advertisement proposal method of a large company and the old advertisement proposal method. Thanks to this data, the company wants to compare the old method, that is, the current method, with the new method. Here, we will look for a conclusion about which method is more successful. In this way, the company can continue with the method we decided and get more profit or Impressions/clicks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ywwo71lNqllDcQBD.png" /></figure><p>Now we want to understand the performance between methods.</p><h4>Should we just “observe” the performance of these two methods and conclude?</h4><p>Of course no, we should choose the more methodical/statistical approach to compare the performances between these two methods, so what is this approach?</p><p>As can be understood from our topic, the statistical method we will try is the A/B Test.</p><h4>So, what is this A / B Test?</h4><p>Today, the A / B Test is “a random online experiment that consists of two variants A and B”. This test quantitatively compares two samples with a single “measure of choice” in the assessment to determine whether there is any statistical significance between them.</p><p>However, we understand that the job is essentially a modern online adaptation of statistical experimental frameworks called Hypothesis tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HBVa0XaOwdwKUvwK" /></figure><h3>So how should we apply the test?</h3><h3>0.Importing libraries and necessary data</h3><pre>import pandas as pd<br>import seaborn as sns<br>import matplotlib.pyplot as plt<br>import statistics<br>from scipy import stats<br>from scipy.stats import shapiro<br>import statsmodels.stats.api as sms<br>import warnings<br>warnings.filterwarnings(&quot;ignore&quot;)</pre><pre>control_data = pd.read_excel(&quot;Lectures/Week 5/Dosyalar/ab_testing_data.xlsx&quot;, sheet_name=&quot;Control Group&quot;)<br>test_data = pd.read_excel(&quot;Lectures/Week 5/Dosyalar/ab_testing_data.xlsx&quot;, sheet_name=&quot;Test Group&quot;)<br><br>control_data[&quot;Group&quot;] = &quot;A&quot;<br>test_data[&quot;Group&quot;] = &quot;B&quot;<br><br>is_any_outlier(control_data, &quot;Purchase&quot;)<br>is_any_outlier(test_data, &quot;Purchase&quot;)<br>control_data.head()<br>test_data.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*QSxNx2HMuDLG8XvD_M5jHQ.png" /></figure><h3>1.Preferred Metrics</h3><p>Normally we should look at which advertising method is expected to bring us a conversion, ie “Click Through Rate”, but we do not have any data directly presenting it, so we need to do Impression / Click. Before that, we will make an analysis of the Purchase column.</p><p>If we define the clickthrough rate (CTR) as phat, it will be phat = Impression/click.</p><p>We’ll set a Significance Level, a will be the metric we’ll take from p-values and use to compare hypotheses. I prefer the generally accepted value of 5%. = 0.05</p><h3>2.Applying the Hypothesis</h3><p>Before applying the hypothesis, we have to do an assumption check first, here are the steps we will consider;</p><ol><li>Assumptions of normality</li><li>Homogeneity of variance</li></ol><h4>2.1 Let’s adjust our table for Assumptions of normality</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*Cj77bRfN708OKfgPnGYBtA.png" /></figure><pre>AB_test = control_data.append(test_data)<br>test_statistics, pvalue = shapiro(AB_test.loc[AB_test[&quot;Group&quot;] == &quot;A&quot;, &quot;Purchase&quot;])<br>print(&#39;Test Statistics is  %.4f, p-value = %.4f&#39; % (test_statistics, pvalue))<br>test_statistics, pvalue = shapiro(AB_test.loc[AB_test[&quot;Group&quot;] == &quot;B&quot;, &quot;Purchase&quot;])<br>print(&#39;Test Statistics is  %.4f, p-value = %.4f&#39; % (test_statistics, pvalue))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*S330P1iKAN8yrQVRJUx6Rg.png" /></figure><p>Using these hypotheses, we can arrive at a decision, if the p-value is &lt;0.05, then H0 is Rejected, if the p-value is&gt; 0.05, then H0 cannot be rejected.</p><p>When we apply this test to our dataset, we cannot reject the H0 hypothesis because our p-value is not less than 0.05 in both A and B groups. Therefore, the normal distribution assumption is provided.</p><h4>2.2 Assumptions of homogeneity of variance:</h4><p>First, let’s make our hypotheses about the homogeneity of variance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*3mjynYlyxIAaT4v3oyoEhg.png" /></figure><pre>stats.levene(AB_test.loc[AB_test[&quot;Group&quot;] == &quot;A&quot;, &quot;Purchase&quot;],<br>             AB_test.loc[AB_test[&quot;Group&quot;] == &quot;B&quot;, &quot;Purchase&quot;])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*RN5ihXAVyO4qcl9YkvMtfg.png" /></figure><p>Here, we applied our test with the levene function to our test A and B groups over the Purchase variable. We got the value of p-value = 0.10 from our test, since this value is not less than 0.05, H0 could not be rejected, and variances are homogeneous.</p><p>Since we see that our assumptions are satisfied in this step, we will conduct two independent samples t-test (parametric test).</p><h3>3. (AB Test) Independent samples t-test</h3><p>Since we see that our assumptions are satisfied in this step, we will conduct two independent samples t-test (parametric test).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*y2dcv5z43riyVW0tOgwoSw.png" /></figure><pre>test_statistics, pvalue = stats.ttest_ind(AB_test.loc[AB_test[&quot;Group&quot;] == &quot;A&quot;, &quot;Purchase&quot;],<br>                                           AB_test.loc[AB_test[&quot;Group&quot;] == &quot;B&quot;, &quot;Purchase&quot;],<br>                                           equal_var=True)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*1i8yz2uwTU2oNLCy_XRoGA.png" /></figure><p>We cannot reject our H0 hypothesis because our p-value is 0.34 (p value&gt; 0.05) as a result of the t-test we have done.</p><p>Long story short, when we examine the values of the two methods we have, we can say that there is no need to process the new method since there is no statistically significant difference between the two group averages. However, since the data set we have is not large enough, it will not be right to make this decision so soon. Perhaps the number of observations can be increased and the result can be more accurate.</p><h4># Bonus Now let’s take a quick look at Click-through Rate.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/0*O3G-FwyOYK2n_Osx.jpg" /></figure><p><strong><em>Click-Through Rate (CTR)<br></em></strong>It is the ratio of users who visit the website, see the ad and click the ad.<br>Clicks / Impression</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/0*Vy849ms9zWBpO7zn.jpg" /></figure><pre>control_data[&#39;ctr&#39;] = control_data[&quot;Click&quot;]/control_data[&quot;Impression&quot;]<br>test_data[&#39;ctr&#39;] = test_data[&quot;Click&quot;]/test_data[&quot;Impression&quot;]</pre><pre>ogi_AB(control_data,test_data, &quot;ctr&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*rtQQuy385xnoDUatJSEW0w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*17rt3wAiatDzdKpMrzPY6Q.png" /></figure><p>Group A has a higher value compared to the overall rates seen for now. At first glance, we see that the click-through rate is in favor of the control group. So while the ad is showing, the rate of site visitors clicking seems to be better in the current system.</p><p>But this will be a simple view, will there be a statistically significant difference here, so we need to do our AB test.</p><p>I would like to express my sincere thanks to <a href="https://www.linkedin.com/in/mvahitkeskin/">Vahit Keskin</a> and my mentor <a href="https://www.linkedin.com/in/atillayardimci/">Atilla Yardimci</a> who helped and taught the completion of this project</p><p>The notebook associated with this article is on <a href="https://github.com/ogulcanertunc/Data-Science-Projects/tree/main/Python/the-logic-behind-A-B-Testing-">Github </a>if you want to follow along.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4ed76e99f93" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ogi-on-ds/the-logic-behind-a-b-testing-with-sample-python-code-a4ed76e99f93">The Logic Behind A/B Testing with Sample Python Code</a> was originally published in <a href="https://medium.com/ogi-on-ds">ogi_on_ds</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>