<?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 Priyanka Dandale on Medium]]></title>
        <description><![CDATA[Stories by Priyanka Dandale on Medium]]></description>
        <link>https://medium.com/@priyanka-dandale?source=rss-57d95c3ad691------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WeRWIQuRH9t7AQ-SEwFgIA.jpeg</url>
            <title>Stories by Priyanka Dandale on Medium</title>
            <link>https://medium.com/@priyanka-dandale?source=rss-57d95c3ad691------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 12:10:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@priyanka-dandale/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[Build and Deploy ML Web-App in Python’s Streamlit]]></title>
            <link>https://python.plainenglish.io/build-and-deploy-ml-web-app-in-pythons-streamlit-68428380fac5?source=rss-57d95c3ad691------2</link>
            <guid isPermaLink="false">https://medium.com/p/68428380fac5</guid>
            <category><![CDATA[streamlit]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Priyanka Dandale]]></dc:creator>
            <pubDate>Mon, 10 Jan 2022 16:35:44 GMT</pubDate>
            <atom:updated>2022-12-14T11:47:19.858Z</atom:updated>
            <content:encoded><![CDATA[<h4>An intuitive style of building a Machine Learning web app using Python Streamlit library.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*TtPtCklI98anOSGYcjigiw.png" /></figure><p>In the past few years, <strong>Python</strong> has exploded 🚀in popularity. The programming language has surpassed Java in popularity, but, for many, this is no surprise. With the rise in machine learning, data analysis, NLP, artificial intelligence, and web application development, many developers utilize Python for its powerful and abundant libraries, easy-to-learn syntax, and portability.</p><p>Without a doubt, it’s a great time to be a Python developer. Today, you will learn how Python has been utilized in <strong>“Iris Variety Prediction”</strong> web app development and deployed this application for free! 😁</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VKEcpBoYJg6555BQgx2_4Q.png" /></figure><h3>What is Streamlit?</h3><blockquote><a href="https://streamlit.io/">Streamlit</a> is an open-source Python library that makes it easy to create and share beautiful, custom web apps for machine learning and data science. In just a few minutes you can build and deploy powerful data apps.</blockquote><p>Let’s get started with how easy it is to build a simple ML web app using it. You can check my other medium article for developing a web app using Flask and Python <a href="https://priyanka-dandale.medium.com/create-basic-web-application-%EF%B8%8F-and-deployment-using-python-eb027e57c5ee"><strong><em>here</em></strong></a> and deploying using Heroku. In that article, I have used HTML, CSS, Flask, and Python but mind you, now you don’t need any prior knowledge of streamlit or good coding experience. Also, you don’t need to know HTML, CSS, or Javascript to build this <strong>“Iris Variety Prediction”</strong> app.</p><h3>Installation Guide</h3><ul><li>Open the Anaconda command prompt and create a new virtual environment — conda create — name env4 . It will create a new environment with the name <em>“env4”</em> for you! (Note: it is conda create ‘minus minus name’ your_env_name and not ‘ — name’.)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s_jGNTJXM3D27vYEDKX5kw.png" /></figure><ul><li>Activate your newly created env — conda activate env4.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*n83gGBWIkTV44mhjpF-HNQ.png" /></figure><ul><li>Installation (on windows) of streamlit is through normal pipcommand — pip install streamlit. For other platforms, kindly check the <a href="https://docs.streamlit.io/library/get-started/installation#install-streamlit-on-macoslinux"><strong><em>here</em></strong></a>.</li><li>To test your installation, run streamlit hello in the command prompt. Once the installation is successful, you will see just like the below image once you run the command streamlit hello.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*YtlQrYorMbd_SFeXdEPvYQ.png" /></figure><ul><li>It opens in the default browser localhost:8501.The Documentation page opens, with a few sample demos.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v1rcKi1RRWjULIUJFt-LaQ.png" /><figcaption>Image by Author — streamlit hello</figcaption></figure><h3>Dataset</h3><p>We will need <strong>‘IRIS’</strong> data which can be downloaded from <a href="https://www.kaggle.com/arshid/iris-flower-dataset/version/1"><strong><em>Kaggle</em></strong></a>. The Iris flower data set is a multivariate data set introduced by the British statistician and biologist Ronald Fisher in his 1936 paper. It is sometimes called Anderson’s Iris data set because Edgar Anderson collected the data to quantify the morphologic variation of Iris flowers of three related species. The data set consists of 50 samples from each of three species of Iris (Iris Setosa, Iris virginica, and Iris versicolor). Four features were measured from each sample: the length and the width of the sepals and petals, in centimeters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*RLJ6a3bgZXcHuH20M4MbHA.png" /><figcaption>Image by Author — Iris data excel</figcaption></figure><p>The dataset contains a set of 150 records under 5 attributes — Petal Length, Petal Width, Sepal Length, Sepal Width, and Class(Species).</p><h3>Building the model object</h3><p>Now to build the actual stuff and witness the magic of streamlit, open a new file in Spyder or any other Python IDE to create the <strong>‘model.py’</strong> file and copy the below Python code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/851b856e53d95d94d8991b9feb941c07/href">https://medium.com/media/851b856e53d95d94d8991b9feb941c07/href</a></iframe><p>code line 40 to 41 above will import pickle library and will save the classifier model object as “classifier.pkl” file in the same directory of your dataset.</p><h3>Building the app</h3><p>Finally to build the app, open a new file in Spyder or any other Python IDE to create the <strong>‘app.py’</strong> file and copy the below Python code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ab7b5156dcac92edd422349ea15e14a/href">https://medium.com/media/1ab7b5156dcac92edd422349ea15e14a/href</a></iframe><ul><li>line 6 -12 — importing required libraries</li><li>line 14 -15 — importing classsifier.pkl model object which is already saved</li><li>line 17 -20 — defining a function to predict the variety based on those values of four columns are provided</li><li>line 22 -36 — defining the main function to design the structure of the webpage, take input from the user through the webpage and show the output after clicking on the button ‘Click here to Predict’.</li><li>line 38 -39 — to execute code only if the file was run directly, and not imported.</li></ul><h3><strong>Requirements file</strong></h3><p>To generate the requirements file where all the requirements of your application get automatically generated — type below and hit enter:</p><blockquote><em>pip freeze &gt; requirements.txt</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AlHtax_ghhk-sCXaf3i7_Q.png" /></figure><p>In the same directory, you will see the requirements.txt file after the successful execution of the above command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g6Fri3ksKXpgs09ZuAEc0A.png" /></figure><blockquote><strong>Note that you have to save the IRIS data, model.py, classifier.pkl, requirements.txt and app.py files in the same folder or directory.</strong></blockquote><h3>Execute the code</h3><p>Now go to your Anaconda prompt and activate your newly created environment.</p><p>Change directory to the folder which contains all the five files by using cd command. For me, I have saved all five files in the “IRIS_APP” folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GMZLkPadrACO7_8JVKB-ag.png" /></figure><p>Now type streamlit run app.py and press enter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F8I6qDLfJHZkUzwZjxXjfw.png" /></figure><p>Go to the Local URL : <a href="http://localhost:8501/">http://localhost:8501</a> or a new page will open in your default browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q5kTqucWqIq9InJUiqoCFg.png" /><figcaption>Image by Author</figcaption></figure><h3>Deploy the WEB APP</h3><p>Ta Daa…!! 😃</p><p>‘Streamlit’ has got your back by actually allowing hosting of the web app on their servers and that too for <strong>Free!!!</strong></p><p>Let’s deploy your ML model-based app on the website now.</p><ul><li>All you have to do is <a href="https://share.streamlit.io/"><strong><em>Signup</em></strong> </a>on to their website with a Google account, GitHub account, or your email. Preferably GitHub, since that is the place where your code has to be.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bgmviWQAVDOi6u6F40TtLA.png" /><figcaption>Image by Author — streamlit.io</figcaption></figure><ul><li>Give your username and password when asked and continue…</li><li>Choose a Community plan for free deploying and sharing your apps.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gbeg_YAEJhnmumhfo2AnFA.png" /><figcaption>Image by Author — streamlit.io</figcaption></figure><ul><li>Give a few more details to set up your account and “Launch your workspace”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EAmS9BjGQ_kSOvwrqESVQw.png" /><figcaption>Image by Author — streamlit.io</figcaption></figure><ul><li>Click on the “New app” button on the right of the Streamlit deploy page and “Authorize” it.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CFw_IZuPsmKRZ8CDl-8tKA.png" /><figcaption>Image by Author — streamlit.io</figcaption></figure><ul><li>Paste the link of the Github repo where the app code lies.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IspYZOeoeNDEFjHKlQGOzA.png" /><figcaption>Image by Author — streamlit.io</figcaption></figure><ul><li>Click the “Deploy!” button. Taa Daa, that’s it!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6NUP7ITVLeZdYN70dwq3Dg.png" /><figcaption>Image by Author</figcaption></figure><p>Check my <a href="https://share.streamlit.io/priyanka-dandale/iris_webapp_python_streamlit/main/app.py"><strong><em>“Iris Variety Prediction” app</em></strong></a> here. 🤗</p><p>____________________________________________________________</p><p><em>Thanks for reading ❤</em></p><p><em>For any suggestions or queries, leave your comments below and follow for updates.</em></p><p><em>If you liked the article, please hit the 👏 icon to support it. This will help other Medium users find it. Share it, so that others can read it!</em></p><p><em>Happy Learning! 😊</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68428380fac5" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/build-and-deploy-ml-web-app-in-pythons-streamlit-68428380fac5">🚀Build and Deploy ML Web-App in Python’s Streamlit</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create Basic Web Application ️ and Deployment Using Python!!]]></title>
            <link>https://medium.com/geekculture/create-basic-web-application-%EF%B8%8F-and-deployment-using-python-eb027e57c5ee?source=rss-57d95c3ad691------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb027e57c5ee</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[flask]]></category>
            <dc:creator><![CDATA[Priyanka Dandale]]></dc:creator>
            <pubDate>Sun, 09 Jan 2022 10:30:36 GMT</pubDate>
            <atom:updated>2022-01-11T07:25:35.263Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*HpHufqCa7DLFJfjeYoMYKw.png" /></figure><p>Hello Guys!!! 🤗</p><p>Today you are going to get introduce yourself to <strong>Flask</strong> for <strong>Python</strong> and create a basic web application for “<strong>Credit score rating”</strong> which includes an <strong>HTML</strong> template containing the structure of a web page, a <strong>CSS</strong> stylesheet containing design instructions, a <strong>Python</strong> backend that communicates with a web server and tops it off by deploying this application for free to <strong>Heroku</strong>! 😁</p><h4>Quick Overview of Flask</h4><ul><li><strong>HTML </strong>— Flask is using a programming language called HTML to create a structure of a web page.</li><li><strong>CSS </strong>— It is used to style this structure and make it look more attractive.</li><li><strong>Javascript</strong> — It is used to interact with the different elements on the web page.</li><li><strong>Python</strong> — It is used to communicate with the webserver also known as backend. It is only a tiny fraction of Flask.</li></ul><p>All the files are available at <a href="https://github.com/Priyanka-Dandale/Credit-Score-Rating-App"><strong>my GitHub repository</strong></a>.</p><h4>Follow the steps to get your web app ready!</h4><ol><li><strong>Create Folders </strong>— First, create an empty folder ‘ CreditScoreRatingApp’ on your PC. Inside it create other folders like:</li></ol><ul><li>‘templates’ to store all our HTML files,</li><li>‘static’ — inside it create ‘CSS’ folder to save all our stylesheets,</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ADvyholyn6rsHOBrqbm27A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TjbyofXpU_eo1EHZK5aXaA.png" /></figure><p>2. <strong>‘templates’ folder for HTML file </strong>— Open a new notepad file and copy the below HTML code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/580de29fd197bb4071a69724e7277b6a/href">https://medium.com/media/580de29fd197bb4071a69724e7277b6a/href</a></iframe><p>Save it in the ‘templates’ folder with ‘index’ name and extension as ‘.html’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_QC55ARDy2q389wE25__Dw.png" /></figure><p>If you click on index.html, it will show below the web page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N6QUrC-CcA-kMiz1mL3eyg.png" /></figure><p>3. <strong>‘static’ — ‘CSS’ folder for CSS file </strong>— Open a new file in notepad and copy the below CSS code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2436d4c6ed544c529ebec8182c32f72e/href">https://medium.com/media/2436d4c6ed544c529ebec8182c32f72e/href</a></iframe><p>Save it in the ‘CSS’ folder with the ‘main’ name and extension as ‘.css’.</p><p>4. In the <strong>‘CreditScoreRatingApp’ folder, </strong>add Python file— Open a new file in Spyder or any other Python IDE to create the <strong>‘app.py’</strong> file and copy the below Python code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/99894202d6882c72f41c2031621a0e9a/href">https://medium.com/media/99894202d6882c72f41c2031621a0e9a/href</a></iframe><p>If user input is, it will show respective messages:</p><ul><li>300 to 349— ‘Your score is Poor!!!’</li><li>350 to 599— ‘Your score is Average!!!’</li><li>600 to 799 — ‘Your score is Good!!!’</li><li>800 to 900 — ‘Your score is Excellent!!!’</li><li>Anything except above will show input is invalid and the max limit is 900 and the min limit is 300.</li></ul><p>5. In the <strong>‘CreditScoreRatingApp’ folder </strong>add <strong>.flaskenv</strong> file — Open a new file in notepad and copy the below code.</p><blockquote>FLASK_APP = app.py</blockquote><p>6. Now open the Anaconda command prompt and create a new virtual environment with the below commands:</p><blockquote>conda create — name env2 (please check exact syntax below)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XUrUFfF9Aue1JzTHxsGj5A.png" /></figure><p>Then activate your newly created environment with the below line of code:</p><blockquote>conda activate env2</blockquote><p>You need to install flask on the new environment with the below code:</p><blockquote>conda install -c anaconda flask</blockquote><p>Now go to your directory of the ‘CreditScoreRatingApp’ folder. cd for change directory:</p><blockquote>cd Downloads\Web App\CreditScoreRatingApp</blockquote><p>Type flask run and hit enter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b4FPY3sLMUztKPYGqdZXtg.png" /></figure><p>Go to URL ‘http://127.0.0.1:5000/priyankad’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IkxbROHM-GdoYzGUnxt_-w.png" /></figure><p>Enter a value in empty input box e.g. 850 and hit SUBMIT button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-V-oCwgCdypzz7DN7T0R0g.png" /></figure><p>Your webpage is completely functional now.</p><p>🤔 <strong>Remember if you make any changes to HTML, CSS or Python file then to you need to clear cache — Go to Settings option n Chrome — Privacy and security — clear browsing data — Cached images and files — Clear data.</strong></p><h4>You need to create two additional files:</h4><ol><li><strong>Procfile:</strong></li></ol><p>On the Anaconda prompt, type Ctrl + C to quit. Then install gunicorn using:</p><blockquote>pip install gunicorn</blockquote><p>Type below to create a new empty file in the same folder directory</p><blockquote>echo &gt; Procfile</blockquote><p>Go to ‘CreditScoreRatingApp’ folder and open ‘Procfile’ with notepad and delete text “ECHO is on.” and type <strong><em>‘web: gunicorn app:app’ </em></strong>where first app is for your Python file name ‘app.py’ and save it.</p><p>2<strong>. Requirements file</strong></p><p>To generate requirements file where all the requirements of your application get automatically generated — type below and hit enter:</p><blockquote>pip freeze &gt; requirements.txt</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LJdLQuVspunL8OtDn0XRrw.png" /></figure><h3>Deployment using HEROKU 😎</h3><p>Go to “<a href="https://www.heroku.com/">https://www.heroku.com</a>” and login or sign up for new free account. Once you have created a new account, navigate to your dashboard on clicking on grid icon:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8L-ejgXQZi2HF9YFMlb91A.png" /></figure><p>Click on ‘Create a new app’ and app name and choose a region then click on ‘Create app’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KiFPQV8VvJw8K459GrWXRQ.png" /></figure><p>Go to settings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X0Veh7jyvXPGeU-BCmu2yA.png" /></figure><p>Scroll a bit below and click on ‘Add buildpack’ and select Python and save changes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z1tBK_vatQRzPOzO39ev4w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qH8mpyfhoOQ5e-BsxUG6tw.png" /></figure><p>Scroll up and click on ‘Deploy’:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DmxVQ9-2rCHTEpPt33p7Xw.png" /></figure><p>We will connect and deploy our application using Github — Click on GitHub then click on ‘Connect to GitHub’ and give your Username and password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1EDAJx9qKOrRIHwFoRCXMg.png" /></figure><p>Give your repository name and click on ‘Connect’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QJQQLYe7ranPQveXfo5yiw.png" /></figure><p>Go to ‘Manual deploy’ section and select whichever branch you need as I will select ‘main’ and click on ‘Deploy Branch’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hJfs6aZbdFactvjUeYb5jA.png" /></figure><p>Scroll a bit down:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FGxDBq3SNTfmnLvarO8zuQ.png" /></figure><p>Once you see ‘Deploy to Heroku’ message, click on ‘View’ and you will see below webpage:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hpk71lmD7dEQ6sSqLoNulQ.png" /></figure><p>Remember that you have to specify ‘/priyankad’ route in the URL:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*arb3VGWDAbTNqLkM9UtKbQ.png" /></figure><h3>Voila!!! 😊</h3><p>____________________________________________________________</p><p>Thanks for reading ❤</p><p>For any suggestions or queries, leave your comments below and follow for updates.</p><p>If you liked the article, please hit the 👏 icon to support it. This will help other Medium users find it. Share it, so that others can read it!</p><p>Happy Learning! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb027e57c5ee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/create-basic-web-application-%EF%B8%8F-and-deployment-using-python-eb027e57c5ee">Create Basic Web Application 🖥️ and 🚀Deployment🚀 Using Python!!</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Line chart for average performance metric by category using DAX — PowerBI]]></title>
            <link>https://priyanka-dandale.medium.com/line-chart-for-average-performance-metric-by-category-using-dax-powerbi-4dc245ff911c?source=rss-57d95c3ad691------2</link>
            <guid isPermaLink="false">https://medium.com/p/4dc245ff911c</guid>
            <category><![CDATA[power-bi-step-by-step]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[visualization]]></category>
            <dc:creator><![CDATA[Priyanka Dandale]]></dc:creator>
            <pubDate>Fri, 24 Sep 2021 06:36:43 GMT</pubDate>
            <atom:updated>2021-09-24T06:38:01.739Z</atom:updated>
            <content:encoded><![CDATA[<h3>Line chart for average performance metric by category using DAX — PowerBI</h3><p>Friends, let us understand the DAX formula for finding the average performance metric with a simple example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wQ-78YYn-wCHgJV2YGIaCQ.png" /></figure><p>Suppose your objective is to find the average performance scores for females and males using the gender column of data and plot them using a line chart. For this consider the below sample data available in an <a href="https://github.com/Priyanka-Dandale/PowerBI">excel file</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*07JC-pkpxRK7PhCoUj8LHw.png" /></figure><p>Below are the findings for the average performance score in excel using the pivot table —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*1hIM1i2TnuOHEhMUt_tpIA.png" /></figure><p>Our objective is to plot below line chart —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*meHbvbsxk7wkFL_YYD7bPw.png" /></figure><p>The formula to find average performance scores is —</p><blockquote>Average performance score of females in 2015 = Sum of performance scores for females in 2015 / Count of total females in 2015</blockquote><p>Similarly, the formula applies for males —</p><blockquote>Average performance score of males in 2015 = Sum of performance scores for males in 2015 / Count of total males in 2015</blockquote><p>Now, to plot the above line chart in Power-BI, initially, you need to create two new measures for average performance scores for females and males.</p><p>Follow the below steps —</p><p><strong>Step1</strong> — Import the data to PowerBI —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w_ufTxNH6-DIdZlm31xv5w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vlZLaJvUpaBTOVmK3_lyzA.png" /></figure><p><strong>Step2</strong> — Create two ‘New Measures’ from the ‘Modeling’ option using the above formulas which in DAX (Data Analysis Expressions) can be written in the format —</p><blockquote>Average Performance Score Female = CALCULATE(AVERAGE(data[Performance Score]), Filter(data,data[Gender]=”Female”))</blockquote><p>And for males,</p><blockquote>Average Performance Score Male = CALCULATE(AVERAGE(data[Performance Score]),Filter(data,data[Gender]=”Male”))</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CwVvMjlSq6qqInMpFT5kWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_iQPidjhSd3o0f1OikURyA.png" /></figure><p><strong>Step3</strong> — Select ‘Line chart’ from the ‘Visualizations’ section and make the highlighted selections in ‘Axis’ and ‘Values’. Make a note to select the ‘Don’t summarize’ for the ‘ Year’ column by clicking on it as it is basically a numeric column so by default it will be summarized to ‘ Sum’ —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*INI4qD42meaxX4Fa6kC1uQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DY6PLYrsg4FsY6G4zb9U7w.png" /></figure><p><strong>Step4 </strong>— Do some formatting from the ‘Format’ section like modifying title, font, font-size, legend formatting, making data labels ‘On’ and so on, and then you are done! 😊</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PxDFQGc5lxFObIcWKNDO7w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wQ-78YYn-wCHgJV2YGIaCQ.png" /></figure><p>____________________________________________________________</p><p>Thanks for reading ❤</p><p>For any suggestions or queries, leave your comments below and follow for updates.</p><p>If you liked the article, please hit the 👏 icon to support it. This will help other Medium users find it. Share it, so that others can read it!</p><p>Happy Learning! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4dc245ff911c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Find Percentage of Female from Gender Column — Power-BI]]></title>
            <link>https://priyanka-dandale.medium.com/find-percentage-of-female-from-gender-column-power-bi-84862b412766?source=rss-57d95c3ad691------2</link>
            <guid isPermaLink="false">https://medium.com/p/84862b412766</guid>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[visualization]]></category>
            <dc:creator><![CDATA[Priyanka Dandale]]></dc:creator>
            <pubDate>Thu, 23 Sep 2021 12:15:30 GMT</pubDate>
            <atom:updated>2021-09-24T04:40:47.282Z</atom:updated>
            <content:encoded><![CDATA[<h3>Find Percentage of Female from Gender Column — Power-BI</h3><p>Friends, there is a very simple formula to find female or male percentages from a gender column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UOGCr7fpDP4-ngH7j9LLoA.png" /></figure><p>Suppose your objective is to plot a line chart of year-wise female employee percentages from the employee data in Power-BI. The required plot is given below which is created in excel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*5HjA0Rz8oaUkwn5kEMAWRA.png" /></figure><p>Below is the sample employee data ‘data’ provided to you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oEqHdCKF2U2-05Tctee4JA.png" /></figure><p>You are going to use only two columns Gender and Year to plot the above chart.</p><p>In Power-BI, you need to create a ‘New Measure’ for this as —</p><blockquote><strong>%Female = COUNTROWS(FILTER(RELATEDTABLE(data),data[Gender]= “Female”)) / COUNTROWS(data)</strong></blockquote><p><strong>OR</strong></p><blockquote><strong>%Female = COUNTROWS(FILTER(RELATEDTABLE(data),data[Gender]= “Female”)) / COUNTROWS(RELATEDTABLE(data))</strong></blockquote><ul><li>The COUNTROWS function counts the number of rows in the specified table, or in a table defined by an expression.</li><li>The FILTER function returns a table that represents a subset of another table or expression.</li><li>The RELATEDTABLE function evaluates a table expression in a context modified by the given filters.</li></ul><p>Once this is created, follow the below steps:</p><p>Select ‘Line chart’ from the visualizations section:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3PfE13llVV5cIQf6-XvvNw.png" /></figure><p>In ‘Axis’, add the ‘Year’ column. Note you need to select ‘Don’t Summarize’ for the column ‘Year’ before adding it to the axis (Click on Year column from Fields section and select ‘Don’t summarize’).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*mCk3KT0lVmoCpp4zLOXg8Q.png" /></figure><p>And add the ‘%Female’ measure to the ‘Values’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1sVKQNCbX5gyS1bAvS5MWw.png" /></figure><p>Do some formatting for Y and X-axis and for data labels then you are done!</p><p>____________________________________________________________</p><p>Thanks for reading ❤</p><p>For any suggestions or queries, leave your comments below and follow for updates.</p><p>If you liked the article, please hit the 👏 icon to support it. This will help other Medium users find it. Share it, so that others can read it!</p><p>Happy Learning! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84862b412766" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to show distribution % by legend on a lines chart in PowerBI?]]></title>
            <link>https://priyanka-dandale.medium.com/how-to-show-distribution-by-legend-on-a-lines-chart-in-powerbi-20f414ce2bb8?source=rss-57d95c3ad691------2</link>
            <guid isPermaLink="false">https://medium.com/p/20f414ce2bb8</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[power-bi]]></category>
            <category><![CDATA[analysis]]></category>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[line]]></category>
            <dc:creator><![CDATA[Priyanka Dandale]]></dc:creator>
            <pubDate>Wed, 22 Sep 2021 06:46:51 GMT</pubDate>
            <atom:updated>2021-09-22T06:46:51.279Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi guys, PowerBI is easy to learn but a bit complex visual requirements sometimes trouble us! Let’s see the story of Jack!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YjcrSXiLtMPQ_QU5kvPQdw.png" /></figure><p>Jack was a new employee in the XYZ organization. His manager itself took his interview in one of the rounds. He mentioned PowerBI visualization skills in his resume and marked them as his top skill. When he newly joined the organization, his manager gave him work to replicate a Tableau dashboard in PowerBI. He was very excited to complete that work on time and to impress his Boss.</p><p>He was been provided the following data. You can find this data <strong><em>‘Wildlife Population’</em></strong> at my <a href="https://github.com/Priyanka-Dandale/PowerBI/blob/main/wildlife%20population.xlsx">Github repository link</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*pODj4NEh_ozFKRuQszKm1A.png" /><figcaption>Part of the data</figcaption></figure><p>His objective is to get the below values- notice the year-wise gender and genderwise yearly distribution female-male columns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*dEPv9Xsb4OB2Kgb9YCnhMg.png" /></figure><ul><li>year-wise gender distribution for the year 2012 for females = 386/522 = 73.95%</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*Y10M7AsuRPkzL9U0k_uZPA.png" /></figure><ul><li>gender-wise yearly distribution for the year 2012 for males = 136/1227 = 11.08%</li></ul><p>Below is the chart which he was trying to develop. Isn’t it a simple line chart? — Of course yes, but the calculations are different.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MkgJdNdVAC8JJdQMShwezw.png" /></figure><p>He started by importing the data into PowerBI and validated import with a table icon with the above four column names.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PYoES1ixwfB3gXM0HUTggg.png" /></figure><p>Selected the line chart visual and made the highlighted selections and kept the Data labels ‘On’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eUqLcoeJEqEiuyA1ETR9GA.png" /></figure><p>But that didn’t serve his purpose.</p><p>He created a ‘Measure’ and replaced ‘Count’ under ‘Values’ by measure and converted it into %. 😀</p><blockquote>genderwise_% = SUM(‘Wildlife population’[Count]) / CALCULATE(SUM(‘Wildlife population’[Count]), ALLSELECTED(<strong>‘Wildlife population’[Year]</strong>))</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N_j_AbWEhNCe4xPBwrUiIg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5ddtoAe9V5GLEvLiwJWT1Q.png" /></figure><p>Note — If you replace ‘Year’ with ‘Gender’ then it will give you a year-wise gender distribution being year on x-axis.</p><blockquote>yearwise_% = SUM(‘Wildlife population’[Count])/CALCULATE(SUM(‘Wildlife population’[Count]),ALLSELECTED(<strong>‘Wildlife population’[Gender]</strong>))</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cooxOnS6rJHcL882LOGrFQ.png" /></figure><p>The difference between the two is —</p><p>Genderwise yearly distribution— It will sum up to 100 i.e., it gives you the percentage gender-wise distribution of counts by the years.</p><p>Year-wise gender distribution — It will sum up to 100 i.e., it gives you the percentage yearly distribution of counts by the gender.</p><p>____________________________________________________________</p><p>Thanks for reading ❤</p><p>For any suggestions or queries, leave your comments below and follow for updates.</p><p>If you liked the article, please hit the 👏 icon to support it. This will help other Medium users find it. Share it, so that others can read it!</p><p>Happy Learning! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20f414ce2bb8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create a Tensorflow Environment in Jupyter Notebook and Use it?]]></title>
            <link>https://priyanka-dandale.medium.com/how-to-create-a-tensorflow-environment-in-jupyter-notebook-and-use-it-e3815002c031?source=rss-57d95c3ad691------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3815002c031</guid>
            <category><![CDATA[jupyter-notebook]]></category>
            <category><![CDATA[environment]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Priyanka Dandale]]></dc:creator>
            <pubDate>Wed, 25 Aug 2021 06:15:57 GMT</pubDate>
            <atom:updated>2021-08-26T07:57:50.942Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/259/0*nGOniKFoO4thHzne" /></figure><p><strong>Anaconda</strong> will enable you to create virtual environments and installl packages needed for data science. With <strong>virtual environments</strong>, you can install specific package versions for a particular project or a tutorial without worrying about version conflicts.</p><p><strong>First, </strong><a href="https://www.anaconda.com/download"><strong><em>download Anaconda</em></strong></a><strong> for your system and choose your required Python version.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*-HW0z5oAdhujy-RIbueagA.png" /></figure><p>On downloading and installing Anaconda, you get <strong>Python</strong>, <strong>Jupyter Notebook, conda</strong>, and hundreds of other open-source packages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*Ut5oc-r4zVZcQ02U-bT3lg.png" /></figure><p><strong>Conda</strong> is an open-source package management system and environment management system that runs on Windows, macOS, and Linux. Conda quickly installs, runs, and updates packages and their dependencies. Conda easily creates, saves, loads, and switches between environments on your local computer. It was created for Python programs, but it can package and distribute software for any language.</p><p><strong>Conda</strong> as a package manager helps you find and install packages. If you need a package that requires a different version of Python, you do not need to switch to a different environment manager, because conda is also an environment manager.</p><p>With just a few commands, you can set up a totally separate environment to run that different version of Python, while continuing to run your usual version of Python in your normal environment.</p><p>Here are some helpful commands using conda:</p><pre><strong># update conda in your default environment </strong><br><em>$ conda upgrade conda<br>$ conda upgrade --all</em></pre><pre><strong># create a new environment with conda</strong><br><em>$ conda create -n [my-env-name]<br>$ conda create -n [my-env-name] python=[python-version]</em></pre><pre><strong># activate the environment you created</strong><br><em>$ source activate [my-env-name]</em></pre><pre><strong># take a look at the environment you created</strong><br><em>$ conda info<br>$ conda list</em></pre><pre><strong># install a package with conda and verify it&#39;s installed</strong><br><em>$ conda install numpy<br>$ conda list</em></pre><pre><strong># take a look at the list of environments you currently have</strong><br><em>$ conda info -e</em></pre><pre><strong># remove an environment</strong><br>$ conda env remove --name [my-env-name]</pre><h4>Creating virtual environments with Conda</h4><p>Let us see how to create a Tensorflow virtual environment using conda:</p><p><strong>Step1:</strong> Open up your Anaconda Prompt command line, bash, or shell terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XRoj3tygdKAw7XRVwDNnXw.png" /></figure><p>Then type the following command to create an environment.</p><blockquote><strong>conda create -n tensorflow-environment pip python=3.8.8</strong></blockquote><p>The command above tells conda to create a new environment named “<strong><em>tensorflow-environment” </em></strong>using the latest version 3.8.8 of python.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*gol1hpeNuVMNvXokfidfLg.png" /></figure><p>It will ask you to proceed with the installation of the new packages or not: once you select ‘y’ for yes, it will download the required packages for you!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RQPHskKm0ONJeP4XVenEBA.png" /></figure><p><strong>Step2:</strong> For us to be able to use our newly created environments we need to activate them on the command line.</p><p>The command for activating the environment goes like given in your console:</p><blockquote><strong>conda activate tensorflow-environment</strong></blockquote><p>Once your environment is activated, your prompt changes immediately, looking like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jUkaVtbifezAL39eyN46ZQ.png" /></figure><p>Now you are inside your newly created tensorflow-environment!!</p><p><strong>Step3:</strong> After you activate it, you can install any package you need in this environment.</p><p>For example, I am going to install Tensorflow in this environment. The command to do so:</p><blockquote><strong>conda install -c conda-forge tensorflow</strong></blockquote><p>Once TensorFlow is installed on your tensorflow-environment, your prompt changes immediately, looking like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aEKw251H_qxbwkahCsLMiQ.png" /></figure><p>It will again ask you to proceed with the installation of the new packages or not: once you select ‘y’ for yes, it will download the required packages for you and then be done!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XiQnzJkPwvny_2T7DLTF5Q.png" /></figure><p>.</p><p>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gx3Jg8TSloGoVTqNM4ilRw.png" /></figure><p>Now you have successfully installed Tensorflow. Congratulations!! 😀</p><p><strong>Step4: </strong>Now comes the step to set this conda environment on your jupyter notebook, to do so you need to install ipykernel.</p><blockquote><strong>conda install -c anaconda ipykernel</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kfjm2sdB4MYWXt-6yuJy0g.png" /></figure><p>It will again ask you to proceed with the installation of the new packages or not: once you select ‘y’ for yes, it will download the required packages for you and then be done!!</p><p>After installing this, type below command</p><blockquote><strong>python -m ipykernel install — user — name tensorflow-environment</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CABXsG_C4Pxq2_S-nAk0zQ.png" /></figure><p>Note: Have a look at two hyphens before user and name in the above command. 🤓</p><p>Using the above command, you now have the newly created tensorflow environment in your Jupyter notebook.</p><p><strong>Step 5:</strong> Now check your Jupyter Notebook, to see the shining “tensorflow-environment” on the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a1AvsLXQ-dZFsgk2BU-PwQ.png" /></figure><p>Click on “tensorflow-environment” under the New →Notebook tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PxkcbPurWPQU_7tsMLpJzw.png" /></figure><p>Voila!! 😄</p><p>Thanks for reading ❤</p><p>For any suggestions or queries, leave your comments below and follow for updates.</p><p>If you liked the article, please hit the 👏 icon to support it. This will help other Medium users find it. Share it, so that others can read it!</p><p>Happy Learning! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3815002c031" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is the Standard Normal Distribution and how do we interpret it?]]></title>
            <link>https://priyanka-dandale.medium.com/what-is-the-standard-normal-distribution-and-how-do-we-interpret-it-6906b3c8e5c7?source=rss-57d95c3ad691------2</link>
            <guid isPermaLink="false">https://medium.com/p/6906b3c8e5c7</guid>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[normal-distribution]]></category>
            <dc:creator><![CDATA[Priyanka Dandale]]></dc:creator>
            <pubDate>Tue, 24 Aug 2021 10:49:51 GMT</pubDate>
            <atom:updated>2021-08-25T03:07:02.187Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vRkdGd0ngFBgGn-vcE67Vg.jpeg" /></figure><p>What is so special about normal probability distribution? Why do so many data science and machine learning articles revolve around normal probability distribution?</p><p><strong><em>The world of machine learning and data science revolves around the concepts of probability distributions and the core of the probability distribution concept is focused on Normal distributions.</em></strong> This article illustrates what normal distribution is and why it is widely used, in particular for a data scientist and a machine learning expert.</p><p>We have abundant data but data alone is not interesting. Data must be interpreted in order to add meaning. Data can be “distributed” (spread out) in different ways as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/0*zqIhq-EvWAANS7BJ.png" /></figure><p>There are cases where data is distributed like a “bell curve” where the data tends to be around a central value (i.e., mean) with no bias left or right, no multiple modes, and it gets close to a “Normal Distribution” (symmetrical and unimodal).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*Jdseewnnc7PTk3qDma_1vA.jpeg" /></figure><p>In above, the “Bell Curve” is a Normal Distribution and the blue histogram shows some data that follows it closely but not perfectly (which is usual). And the distribution is usually known as a bell curve because it looks like a bell.</p><h4>Examples that mainly follow a Normal Distribution</h4><ol><li>Blood pressure</li><li>Height of students in a class</li><li>Errors while taking measurements</li><li>Marks in a test, etc</li></ol><h4><strong>Some Basic Terminology</strong></h4><ol><li><strong>Mean(μ)</strong> — is the average of a data set.</li><li><strong>Median</strong> — is the middle of the set of numbers.</li><li><strong>Mode</strong> — is the most common number(peak) in a data set. A unimodal distribution only has one peak in the distribution, a bimodal distribution has two peaks, and a multimodal distribution has three or more peaks.</li><li><strong>Bias</strong> — is the tendency of a statistic to overestimate or underestimate a parameter.</li></ol><p>5. <strong>Skewness </strong>— refers to a distortion or asymmetry that deviates from the symmetrical bell curve, or normal distribution, in a set of data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*ECd_grwmIwgBiyFk" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*VqKSvRkhmaJMzfiZ.gif" /></figure><p>6. <strong>Standard deviation(σ) </strong>— is a measure of the amount of variation or dispersion of a set of values. A low standard deviation indicates that the values tend to be close to the mean of the set, while a high standard deviation indicates that the values are spread out over a wider range.</p><p><strong>Example of IQ scores of students in a class:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4VDFjCdcjj_hKhJjCUzgcA.jpeg" /></figure><h4><strong>Characteristics of Normal Distribution</strong></h4><ul><li>mean = median = mode</li><li>Symmetrical about the center</li><li>Unimodal</li><li>50% of values less than the mean and 50% greater than the mean</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/0*X20Y4Fga2OuwCaF2.jpg" /></figure><h4><strong>The shape of the Normal Distribution</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XrUa_B7MM8-HM4mv4T_7WQ.png" /></figure><ul><li><strong>68.3%</strong> of values are within <strong>1 standard deviation </strong>(1σ) of the mean</li><li><strong>95.5%</strong> of values are within <strong>2 standard deviations</strong> (2σ) of the mean</li><li><strong>99.7%</strong> of values are within <strong>3 standard deviations</strong> (3σ) of the mean</li></ul><p>It is always good to know the standard deviation because we can say that any value is:</p><ul><li><strong>likely</strong> to be within 1 standard deviation (1σ)(68.3 out of 100 should be)</li><li><strong>very likely</strong> to be within 2 standard deviations (2σ) (95.5 out of 100 should be)</li><li><strong>almost certainly</strong> within 3 standard deviations (3σ) (997 out of 1000 should be)</li></ul><h4>Example</h4><h4>95.5% of students at school got marks in a test between 32 and 98.</h4><p>Assuming this data is <strong>normally distributed</strong> we can calculate the mean and standard deviation</p><p>The mean is halfway between 32 and 98:</p><p>Mean(μ)= (32+98) / 2 = 65</p><p>95.5 % is 2 standard deviations on either side of the mean (a total of 4 standard deviations) so:</p><p>1 standard deviation (σ)= (98–32) /4 = 66 / 4 = 16.5</p><h3><strong>Standard Normal Distribution</strong></h3><p><strong>What is a “Z-score”?</strong></p><p>The number of <strong>standard deviations from the mean</strong> is also called the “Standard Score”, “sigma” or “Z-score”. Simply, a Z-score describes the position of a raw score in terms of its distance from the mean, when measured in standard deviation units.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/0*1OXPNOTWU_dNdgfP.jpg" /></figure><ul><li><strong>Z</strong> is the “z-score” (Standard Score)</li><li><strong>x</strong> is the value to be standardized</li><li><strong>μ</strong> (mu) is the mean</li><li><strong>σ</strong> (sigma) is the standard deviation</li></ul><p>A Z-score can be placed on a normal distribution curve. Z-scores range from -3 standard deviations (which would fall to the far left) up to +3 standard deviations (which would fall to the far right).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zI8FHRUzOP8NV24X.jpg" /><figcaption><strong>μ</strong> = 0 and <strong>σ </strong>= 1</figcaption></figure><ul><li>Z-score = 0 — indicates that the data point’s score is identical to the mean score.</li><li>Z-score=1.0 — indicate a value that is one standard deviation from the mean.</li><li>Z-scores may be positive or negative, with a positive value indicating the score is above the mean and a negative score indicating it is below the mean.</li></ul><h4>Standardizing</h4><p>We can take any Normal Distribution and convert it to The Standard Normal Distribution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*sljp3pO2nR9p8Go_xwWUOA.png" /></figure><p>The <strong>Standard Normal Distribution</strong>, also called the <strong><em>z</em>-distribution</strong>, is a special normal distribution where the mean(μ) is 0 and the standard deviation(σ) is 1 and is denoted by <strong><em>Z(0,1)</em></strong>.</p><h4><strong>Why Standardize the values?</strong></h4><p>Let me explain this with the help of an example.</p><p>Suppose your teacher is marking your final exam of 100 marks with a passing criterion of 45 marks.</p><p>Below are the results of you and your classmates:</p><p><strong>30, </strong>75<strong>, 26, </strong>72<strong>, 18, 44, 35, 12, </strong>56<strong>, 33, 28</strong></p><p>According to the above marks, most will fail and only 3 would pass !! 😰</p><p>The exam must have been really hard, so the teacher decides to Standardize all the scores and only fail people more than 1 standard deviation below the mean.😎</p><p>The <strong>Mean is 39</strong>, and the <strong>Standard Deviation is 19.4</strong>, and these are the Standard Scores:</p><p>-0.46, 1.85, -0.67, 1.70, <strong>-1.08</strong>, -0.26, -0.21,<strong>-1.39</strong>, 0.87, 0.21,-0.05</p><p>Now only 2 students will fail (&lt; -1, the ones lower than −1 standard deviation since σ =1) 😇</p><p><strong>Use the standard normal distribution to find the probability</strong></p><p>The Standard Normal Distribution is a <strong>probability distribution</strong>, so the area under the curve between two points tells you the probability of variables taking on a range of values. The total area under the curve is 1 or 100%.</p><p>Every <em>z</em>-score has an associated <em>p</em>-value that tells you the probability of all values below or above that <em>z</em>-score occurring. This is the area under the curve left or right of that <em>z</em>-score.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*iJe0KIPa0SJ3Hpiy.png" /></figure><p>This is how the Normal distribution is important in the world of data science and machine learning!!</p><p>Thanks for reading ❤</p><p>For any suggestions or queries, leave your comments below and follow for updates.</p><p>If you liked the article, please hit the 👏 icon to support it. This will help other Medium users find it. Share it, so that others can read it!</p><p>Happy Learning! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6906b3c8e5c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is the difference between Probability and Likelihood?]]></title>
            <link>https://priyanka-dandale.medium.com/what-is-the-difference-between-probability-and-likelihood-9a1caafcf921?source=rss-57d95c3ad691------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a1caafcf921</guid>
            <category><![CDATA[difference]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[probability]]></category>
            <dc:creator><![CDATA[Priyanka Dandale]]></dc:creator>
            <pubDate>Fri, 20 Aug 2021 11:46:29 GMT</pubDate>
            <atom:updated>2021-08-21T02:24:28.836Z</atom:updated>
            <content:encoded><![CDATA[<p>Let us understand these two statistical terms in an easy way!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*dpAHx48g0xrTDi-TS_DaIw.png" /></figure><p>For me, visualizations are easy to understand so I will try to put the difference between Probability and Likelihood using simple visualization. The following explanation applies to all the continuous distributions but for now, let’s start by looking at the probability with respect to a normal distribution.</p><p><strong>Example:</strong></p><p>Let’s imagine that the below distribution is of 3 years old kids height. On the low end, we have 2.4 feet and on the high end, we have 3.4 feet. It has an average of 2.9 feet in height and a standard deviation of 0.5.</p><p>The <strong>probability</strong> that we will weigh a randomly selected height between 2.9 and 3.0 feet is the area under the curve between 2.9 and 3.0 feet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3eK6fQfyFMcbWXDpSq09kQ.png" /></figure><p>In this case, the area under the curve = 0.21, which means there is a 21% chance that a randomly selected 3-year old kid would have a height between 2.9 and 3.0 feet.</p><p>Statistically, we say this with the following notation,</p><p>Prob(height between 2.9 feet and 3.0 feet | mean = 2.9 and standard deviation =0.5) = 0.21 i.e., 21% is the probability of height of a 3-yearold kid is between 2.9 feet and 3.0 feet given that the mean of the distribution is 2.9 and the standard deviation is 0.5.</p><p>The highlighted part of the below equation can be changed based on our requirement of the study.</p><p>Prob(<strong><em>height between 2.9 feet and 3.0 feet </em></strong>| mean = 2.9 and standard deviation =0.5) = 0.21</p><p>Example: If we want to find the probability that the height of a 3-year kid is greater than 2.9 then the equation would be like below:</p><p>Prob(<strong><em>height &gt; 2.9 feet </em></strong>| mean = 2.9 and standard deviation =0.5) = ??</p><p>where mean and standard deviation will be the same.</p><p>Now let&#39;s talk about <strong>likelihood</strong> in the same context.</p><p>To start with the likelihood, we assume that we have already found out the height of our 3-year old kid understudy who is 3.1 feet tall.</p><p>The likelihood of 3.1 feet tall kid is the point on the curve in the below figure and that value is 0.14.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QawZ1mP7aFN7no41ZLRlIg.png" /></figure><p>Statistically, we say this with the following notation:</p><p>Likelihood( mean = 2.9 and standard deviation = 0.5 | height of 3-year old kid is 3.1 feet) =0.14</p><p>The Likelihood of a distribution with mean of 2.9 and standard deviation of 0.5 given that the height of a 3 year old kid is 3.1 feet equals 0.14.</p><p>If we shift the distribution over so that the mean is 2.7 and standard deviation is 0.7 then new likelihood would be 0.19.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*25l-VBOAnVOJypA19yGVqQ.png" /></figure><p>Therefore, the probabilities are the areas under a fixed distribution…</p><p>Statistically, Probability(data|distribution)</p><p>Likelihood are the y-axis values for the fixed data points with distribution that can be moved…</p><p>Statistically, Likelihood(distribution|data)</p><p>Thanks for reading ❤</p><p>For any suggestions or queries, leave your comments below and follow for updates.</p><p>If you liked the article, please hit the 👏 icon to support it. This will help other Medium users find it. Share it, so that others can read it!</p><p>Happy Learning! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a1caafcf921" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HR Analytics —  Job Change of Data Scientists]]></title>
            <link>https://priyanka-dandale.medium.com/hr-analytics-job-change-of-data-scientists-9d6073c24538?source=rss-57d95c3ad691------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d6073c24538</guid>
            <category><![CDATA[kaggle]]></category>
            <category><![CDATA[analysis]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[hr]]></category>
            <dc:creator><![CDATA[Priyanka Dandale]]></dc:creator>
            <pubDate>Thu, 12 Aug 2021 12:55:29 GMT</pubDate>
            <atom:updated>2021-08-21T02:24:25.827Z</atom:updated>
            <content:encoded><![CDATA[<h3>HR Analytics — Job Change of Data Scientists</h3><p>Machine Learning Approach to predict who will move to a new job using Python!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*0V-xtrNNok_YAp_k" /></figure><p>A company that is active in Big Data and Data Science wants to hire data scientists among people who successfully pass some courses which conduct by the company. Many people signup for their training. The company wants to know which of these candidates really wants to work for the company after training or looking for new employment because it helps reduce the cost and time and the quality of training or planning the courses and categorization of candidates. Information related to demographics, education, experience is in hands from candidates signup and enrollment.</p><h4>Inspiration</h4><ul><li>Predict the probability of a candidate will work for the company, is a <strong><em>binary classification problem</em></strong></li><li>Interpret model(s) such a way that illustrates which features affect candidate decision</li></ul><h4>User Guide</h4><p>The <a href="https://github.com/Priyanka-Dandale/HR-Analytics-Job-Change-of-Data-Scientists"><strong><em>Colab Notebooks</em></strong></a> are available for this real-world use case at my GitHub repository or <a href="https://medium.com/nerd-for-tech/easy-downloading-kaggle-data-to-google-drive-1be0a8835baa"><strong><em>Check her</em></strong></a><strong><em>e</em></strong> to know how you can directly download data from Kaggle to your Google Drive and readily use it in Google Colab!</p><h4>Understanding Data</h4><p>This <a href="https://www.kaggle.com/arashnic/hr-analytics-job-change-of-data-scientists"><strong><em>Kaggle competition</em></strong></a><strong><em> </em></strong><em>is </em>designed to understand the factors that lead a person to leave their current job for HR researches too. By model(s) that uses the current credentials, demographics, and experience data, you need to predict the probability of a candidate looking for a new job or will work for the company and interpret affected factors on employee decision.</p><h4>Data Overview</h4><p>There are a total <strong><em>19,158</em></strong> number of observations or rows. It contains the following 14 <strong>columns</strong>:</p><ul><li><strong>enrollee_id:</strong> Unique ID for the candidate</li><li><strong>city:</strong> City code</li><li><strong>city_ development _index:</strong> Development index of the city (scaled)</li><li><strong>gender:</strong> Gender of the candidate</li><li><strong>relevent_experience:</strong> Relevant experience of the candidate</li><li><strong>enrolled_university:</strong> Type of University course enrolled if any</li><li><strong>education_level:</strong> Education level of candidate</li><li><strong>major_discipline:</strong> Education major discipline of the candidate</li><li><strong>experience:</strong> Candidate total experience in years</li><li><strong>company_size:</strong> No of employees in current employer’s company</li><li><strong>company_type: </strong>Type of current employer</li><li><strong>last_new_job:</strong> Difference in years between previous job and current job</li><li><strong>training_hours:</strong> Training hours completed</li><li><strong>target:</strong> 0 — Not looking for a job change, 1 — Looking for a job change</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1c9S0X06ADhl1ZM9-jHFTg.png" /><figcaption>First 5 Observations</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j7V-l-p1A_jZ3iCZagecMQ.png" /><figcaption>First 5 Observations</figcaption></figure><h4>Data Correction</h4><blockquote>Note: In the train data, there is one human error in column company_size i.e. Oct-49, and in pandas, it was printed as 10/49, so we need to convert it into np.nan (NaN) i.e., numpy null or missing entry.</blockquote><h4>Basic Exploratory Data Analysis</h4><p><strong><em>What is the total number of observations?</em></strong><em> </em>— — 19,158.</p><p><strong><em>Are there any missing values in the data?</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*X16IYyie4gWGLPNYriO4ww.png" /></figure><blockquote>Note: 8 features have the missing values.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lGykxSzR9tNRiZPlS8AY4Q.png" /></figure><ul><li>The above bar chart gives you an idea about how many values are available there in each column. In our case, company_size and company_type contain the most missing values followed by gender and major_discipline.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W3oLlPVp6SrMTP7jCGW4Bw.png" /></figure><ul><li>Using the above matrix, you can very quickly find the pattern of missingness in the dataset. In our case, the columns company_size and company_type have a more or less similar pattern of missing values.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y2A_a4kaLye2-LtXwqWU0w.png" /></figure><ul><li>Heatmap shows the correlation of missingness between every 2 columns. In our case, the correlation between company_size and company_type is 0.7 which means if one of them is present then the other one must be present highly probably.</li></ul><p><strong><em>What is the distribution of the target?</em></strong></p><p>The number of data scientists who desire to change jobs is 4777 and those who don&#39;t want to change jobs is 14381, data follow an imbalanced situation! 😥</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PJzagdoN50FDZd1hBKo2iQ.png" /></figure><p><strong><em>Which are the top 10 cities?</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Elvq4_cM5GjwWM93uOVCow.png" /></figure><p><strong><em>What is the maximum index of city development?</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*0K3O326G61yF1vjj_Xx05Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_oytg_Vu4AtvsQRfpZtiYw.png" /></figure><ul><li>The city development index is a significant feature in distinguishing the target.</li></ul><p><strong><em>The gender-wise desire for a job change:</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zkm0GhmVnx6bovHzVGRbog.png" /></figure><p><strong><em>Does relevant experience affect?</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oYtRFjBT8s_8e21CxzMrEA.png" /></figure><p><strong><em>Does the type of university of education matter?</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jCmuB3NwPX9KI3f1nbsDcw.png" /></figure><ul><li>There are around 73% of people with no university enrollment.</li></ul><p><strong><em>Does education level affect?</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FzTomuXptZjLsX8xtyNXnQ.png" /></figure><p><strong><em>What is the effect of a major discipline?</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9cJMM8xWMfbF7VBOR3TlKg.png" /></figure><p><strong><em>Do years of experience has any effect on the desire for a job change?</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hJxVyf9BT8XYPqbiiRNM6g.png" /></figure><ul><li>If an employee has more than 20 years of experience, he/she will probably not be looking for a job change.</li></ul><p><strong><em>What is the effect of company size on the desire for a job change?</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C2Sd1jLtg-1W4ybwFGw_XA.png" /></figure><p><strong><em>Does company type matter?</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*rbkNbsWg5lth87BnSZkD9A.png" /></figure><p><strong><em>Does the gap of years between previous job and current job affect?</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0-EVEFuRh-T86rMAnPq7CQ.png" /></figure><p><strong><em>Does more pieces of training will reduce attrition? — </em></strong>Not at all, I guess!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*esN3rwlSjuuoZcvXWJhPKQ.png" /></figure><h4>Data Pre-processing</h4><p>Let us first start with removing unnecessary columns i.e., ‘enrollee_id’ as those are unique values and ‘city’ as it is not much significant in this case.</p><h4>Missing Value Imputation — MICE</h4><p>MICE (Multiple Imputation by Chained Equations) Imputation is a multiple imputation method, it is generally better than a single imputation method like mean imputation. As seen above, there are 8 features with missing values. MICE is used to fill in the missing values in those features.</p><h4>Train-Test Split</h4><p>Once missing values are imputed, data can be split into train-validation(test) parts and the model can be built on the training dataset. Before this note that, the data is highly imbalanced hence first we need to balance it. For this, <a href="https://machinelearningmastery.com/smote-oversampling-for-imbalanced-classification/"><strong>Synthetic Minority Oversampling Technique (SMOTE)</strong></a> is used.</p><p>After applying SMOTE on the entire data, the dataset is split into train and validation. StandardScaler is fitted and transformed on the training dataset and the same transformation is used on the validation dataset. StandardScaler <strong>removes the mean and scales each feature/variable to unit variance</strong>. This operation is performed feature-wise in an independent way. StandardScaler can be influenced by outliers (if they exist in the dataset) since it involves the estimation of the empirical mean and standard deviation of each feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SimxqSWuaWWtcolHLotQGQ.png" /></figure><p>After splitting the data into train and validation, we will get the following distribution of class labels which shows data does not follow the imbalance criterion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lTewlJkdPLIibSpJylG71w.png" /></figure><h3>Model Building and Validation</h3><p>The training dataset with 20133 observations is used for model building and the built model is validated on the validation dataset having 8629 observations.</p><p>Following models are built and evaluated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MS8OHGGcj_UAoQehekLQgA.png" /></figure><p>XGBoost and Light GBM have good accuracy scores of more than 90. As XGBoost is a <strong>scalable and accurate implementation of gradient boosting machines</strong> and it has proven to push the limits of computing power for boosted trees algorithms as it was built and developed for the sole purpose of model performance and computational speed.</p><h4>XGBoost Classifier</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WkiV9VWW394y68TIStTE3w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FdZ2T6ffp_7KFzNA-G1xKQ.png" /></figure><h4>Light Gradient Boosting Model</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C_JvKryR0KnM3b8x_SXbTg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*veLwJZ0hH9eDQMevc3_ddg.png" /></figure><p>There has been only a slight increase in accuracy and AUC score by applying Light GBM over XGBOOST but there is a significant difference in the execution time for the training procedure. <strong>Light GBM is almost 7 times faster than XGBOOST</strong> and is a much better approach when dealing with large datasets.</p><p>For more on performance metrics check — <a href="https://medium.com/nerd-for-tech/machine-learning-model-performance-metrics-84f94d39a92"><em>https://medium.com/nerd-for-tech/machine-learning-model-performance-metrics-84f94d39a92</em></a></p><p>Thanks for reading ❤</p><h3>Resources</h3><ul><li><strong>Kaggle Competition — </strong><a href="https://www.kaggle.com/arashnic/hr-analytics-job-change-of-data-scientists"><strong>https://www.kaggle.com/arashnic/hr-analytics-job-change-of-data-scientists</strong></a><a href="https://www.kaggle.com/arashnic/hr-analytics-job-change-of-data-scientists"><strong>.</strong></a></li></ul><p>_______________________________________________________________</p><p>For any suggestions or queries, leave your comments below and follow for updates.</p><p>If you liked the article, please hit the 👏 icon to support it. This will help other Medium users find it. Share it, so that others can read it!</p><p>Happy Learning! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d6073c24538" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Machine Learning Model Performance Metrics]]></title>
            <link>https://priyanka-dandale.medium.com/machine-learning-model-performance-metrics-84f94d39a92?source=rss-57d95c3ad691------2</link>
            <guid isPermaLink="false">https://medium.com/p/84f94d39a92</guid>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[datascience-training]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Priyanka Dandale]]></dc:creator>
            <pubDate>Fri, 21 May 2021 00:54:23 GMT</pubDate>
            <atom:updated>2021-05-21T00:54:23.261Z</atom:updated>
            <content:encoded><![CDATA[<p>Important Model Evaluation Metrics for Classification Problems!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*AlS6_i_saViESi8n.jpg" /></figure><p>The idea of building machine learning models works on a constructive feedback principle. You build a model, get feedback from metrics, make improvements and continue until you achieve a desirable accuracy. Performance metrics as the name suggests explaining the performance of a model. An important aspect of performance metrics is their capability to discriminate among model results.</p><p>I have seen plenty of analysts and aspiring data scientists not even bothering to check how robust their model is. Once they are finished building a model, they hurriedly map predicted values on unseen data. This is an incorrect approach!</p><p>A model is considered to be robust if its output dependent variable (label) is consistently accurate even if one or more of the input independent variables (features) or assumptions are drastically changed due to unforeseen circumstances. Simply building a predictive model is not your motive. It’s about creating and selecting a model which gives high accuracy on out-of-sample data. Hence, it is crucial to check the accuracy of your model prior to computing predicted values.</p><p>There are different kinds of metrics to evaluate our models. After you are finished building your model, these 6 metrics will help you in evaluating your model’s accuracy.</p><h3>Contents</h3><ol><li>Quick Warm-up: Types of Predictive model</li><li>Illustration with example</li><li>Confusion Matrix</li><li>Classification Accuracy</li><li>Precision</li><li>Recall</li><li>F1-Score</li><li>AUC-ROC</li></ol><h3>Quick Warm-up: Types of Predictive models</h3><p>When we talk about predictive models, we are talking either about a regression model (continuous output) or a classification model (nominal or binary output). The evaluation metrics used in each of these models are different. In classification problems, we use two types of algorithms (dependent on the kind of output it creates):</p><ul><li><strong>Class output:</strong> Algorithms like SVM and KNN create a class output. For instance, in a binary classification problem, the outputs will be either 0 or 1. However, today we have algorithms that can convert these class outputs to probability. But these algorithms are not well accepted by the statistics community.</li><li><strong>Probability output:</strong> Algorithms like Logistic Regression, Random Forest, Gradient Boosting, Adaboost, etc. give probability outputs. Converting probability outputs to class output is just a matter of creating a threshold probability.</li></ul><p>In regression problems, we do not have such inconsistencies in output. The output is always continuous in nature and requires no further treatment.</p><p>For a classification model evaluation metric discussion, I have used my predictions for one of the binary classification problems on Kaggle. The solution to the problem is out of the scope of our discussion here. However, the final predictions on the training set have been used for this article for illustration. The predictions made for this problem were probability outputs which have been converted to class outputs assuming a threshold of 0.5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BFUz_PJYz8-yghfx.gif" /></figure><p>See in the above, there are 5 input samples in the data out of which 3 belongs to Negative (class 1) and 2 belongs to Positive (class 0). Considering the threshold of 0.5, the 5th observation with a probability of 0.76 is misclassified to class 1.</p><h3>Confusion Matrix</h3><p>A confusion matrix is an N X N matrix, where N is the number of classes being predicted. In the above example, we have N=2, and hence we get a 2 X 2 matrix.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/0*hUZNvUUjpAktpjSr.png" /></figure><p>There are 6 important terms :</p><ul><li><strong>True Positives:</strong> The cases in which we predicted Positive and the actual output was also Positive. Here, true positives are 2.</li><li><strong>True Negatives:</strong> The cases in which we predicted Negative and the actual output was Negative. Here, true negatives are 2.</li><li><strong>False Negatives: </strong>The cases in which we predicted Negative and the actual output was Positive. I remember it as falsely predicting Negative. Here, false negatives are 1.</li><li><strong>False Positives:</strong> The cases in which we predicted Positive and the actual output was Negative. I remember it as falsely predicting Positive. Here, No false positives i.e., 0.</li><li><strong>Type I Error: </strong>In statistical hypothesis testing, is the error caused by rejecting a null hypothesis when it is true. It is caused when the hypothesis that should have been accepted is rejected. It is denoted by α (alpha) known as an error, also called the level of significance of the test.</li><li><strong>Type II Error: </strong>It is the error that occurs when the null hypothesis is accepted when it is not true. In simple words, it means accepting the hypothesis when it should not have been accepted. It is denoted by β (beta) and is also termed as the beta error.</li></ul><h3>Classification Accuracy</h3><p>Classification Accuracy is what we usually mean when we use the term accuracy.</p><p>Accuracy is the ratio of the number of correct predictions to the total number of input samples or observations. Informally, accuracy is the fraction of predictions our model got right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*36kFZbzW_rXyI4bt.png" /></figure><p>Here, Accuracy = (2+2)/(2+0+1+2) = 4/5 ie., 80%</p><p>For example, consider that there are 98% samples of class 0 and 2% samples of class 1 in our training set. Then our model can easily get 98% training accuracy by simply predicting every training sample belonging to class 0.</p><p>When the same model is tested on a test set with 60% samples of class 0 and 40% samples of class 1, then the test accuracy would drop down to 60%. Classification Accuracy is great but gives us the false sense of achieving high accuracy.</p><p>The real problem arises when the cost of misclassification of the minor class samples is very high. If we deal with a rare but fatal disease, the cost of failing to diagnose the disease of a sick person is much higher than the cost of sending a healthy person to more tests.</p><h3>Precision</h3><p>Precision is the number of correct positive results divided by the number of positive results predicted by the classifier. The result is a value between 0.0 for no precision and 1.0 for full or perfect precision. Precision looks to see how much junk positives got thrown in the mix. If there are no bad positives (those FPs), then the model had 100% precision.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/0*naJPxwgNAFPOo4YI.png" /></figure><p>Here, Precision = 2/(2+0) = 1 ie., 100%</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*KQT79JOwl_MRxHFg.gif" /></figure><h3>Recall</h3><p>Recall is the number of correct positive results divided by the number of all relevant samples (all samples that should have been identified as positive). The result is a value between 0.0 for no recall and 1.0 for full or perfect recall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/0*sWBRtOeUVbRFiRqP.png" /></figure><p>Here, Recall = 2/(2+1) = 2/3 i.e., 67%</p><p>Unlike precision that only comments on the correct positive predictions out of all positive predictions, recall provides an indication of missed positive predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*qZ5uY6CZ0r-gkRaS.gif" /></figure><h3>F1-Score</h3><p>The harmonic mean of Precision and Recall. It is a single score that represents both Precision and Recall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/0*7Ofp5iISolcrdguy" /></figure><p>Here, F1-score = (2*1*0.67)/(1+0.67) = 0.80%</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*dFxGyvZINOyJAbv0.gif" /></figure><p><strong>So why Harmonic Mean, why not Arithmetic Mean?</strong> Because it punishes extreme values more.</p><p>Consider a trivial method (e.g. always returning class 0). There are infinite data elements of class 1 and a single element of class 0:</p><p>Precision = 0.0 and Recall = 1.0</p><p>When taking the arithmetic mean, it would have 50% correct. Despite being the worst possible outcome! But, with the harmonic mean, the F1-score is 0.</p><p>Arithmetic mean = 0.5 and Harmonic mean = 0.0</p><p><strong>In other words, to have a high F1-Score, you need to have both high precision and recall.</strong></p><h3>AUC-ROC (Area Under Curve — Receivers’s Operating Curve)</h3><p>Area Under Curve(AUC) is one of the most widely used metrics for evaluation. It is used for binary classification problems. AUC of a classifier is equal to the probability that the classifier will rank a randomly chosen positive example higher than a randomly chosen negative example. A ROC curve is a graph showing the performance of a classification model at all classification thresholds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*6De4lLVpk3zN0XlV.png" /></figure><p>Axes for ROC are TPR (True Positive Rate) and FPR (False Positive Rate).</p><ul><li><strong>True Positive Rate TPR (Sensitivity)</strong>: True Positive Rate is defined as TP/ (FN+TP). True Positive Rate corresponds to the proportion of positive data points that are correctly considered as positive, with respect to all positive data points.</li><li><strong>True Negative Rate TNR (Specificity)</strong>: True Negative Rate is defined as TN / (FP+TN). False Positive Rate corresponds to the proportion of negative data points that are correctly considered as negative, with respect to all negative data points.</li><li><strong>False Positive Rate FPR</strong>: False Positive Rate is defined as FP / (FP+TN). False Positive Rate corresponds to the proportion of negative data points that are mistakenly considered as positive, with respect to all negative data points.</li></ul><p>False Positive Rate and True Positive Rate both have values in the range [0, 1]. FPR and TPR both are computed at varying threshold values such as (0.00, 0.02, 0.04, …., 1.00) and a graph is drawn.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*pSZ3YdbfpAIuHjZR.gif" /></figure><p>AUC is the area under the curve of plot False Positive Rate vs True Positive Rate at different points in [0, 1]. As evident, <strong>AUC has a range of [0, 1]. The greater the value, the better is the performance of our model.</strong> The curve tells us how well the model can distinguish between the two classes. Better models can accurately distinguish between the two. Whereas, a poor model will have difficulties distinguishing between the two.</p><p>That’s it!</p><p>_____________________________________________________________</p><p>Thanks for reading ❤. For any suggestions or queries, leave your comments below and follow for updates.</p><p>If you liked the article, please hit the 👏 icon to support it. This will help other Medium users find it. Share it, so that others can read it!</p><p>Happy Learning! 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84f94d39a92" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>