<?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 David Effiong on Medium]]></title>
        <description><![CDATA[Stories by David Effiong on Medium]]></description>
        <link>https://medium.com/@uforodavid?source=rss-7c4e14c1e69------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*y0jtkn8p8aClk4Rx58yAeQ.jpeg</url>
            <title>Stories by David Effiong on Medium</title>
            <link>https://medium.com/@uforodavid?source=rss-7c4e14c1e69------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 02:03:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@uforodavid/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[Data Quality Basics: A Primer for Smarter Decisions]]></title>
            <link>https://uforodavid.medium.com/data-quality-basics-a-primer-for-smarter-decisions-c6a085edfa06?source=rss-7c4e14c1e69------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6a085edfa06</guid>
            <category><![CDATA[data-strategy]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-quality]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[David Effiong]]></dc:creator>
            <pubDate>Tue, 08 Apr 2025 16:37:40 GMT</pubDate>
            <atom:updated>2025-04-08T16:41:08.166Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qSFtQhmOpvw-l4t5j6kpGg.png" /></figure><h3>Introduction</h3><p>Can you imagine asking ChatGPT, “What is the independence date of the United States of America?” and getting “1st October 1960” as the response? I’m sure you probably wouldn’t use it again. In fact, one of the reasons people continue to use tools like ChatGPT is because the responses are usually accurate. This level of accuracy is not only attributed to the quality of the model used, but also to the quality of the data used to train the models.</p><p>As you can see, quality output is directly tied to the quality of the input. The risks of getting data quality wrong are high, including decisions based on incorrect information, and a loss of trust and adoption. For any data-driven organization, data quality is not just a nice-to-have or a fancy concept in the data ecosystem, it is a must-have. By the end of this post, we will have covered what data quality is all about, the dimensions of data quality, strategies for monitoring it, and techniques for improving it.</p><h3>Why Data Quality?</h3><p>Data quality describes how well data serves its intended purpose. Depending on your data quality monitoring framework, you can assign your organization a data quality score. Below are some reasons why data quality is important:</p><ul><li><strong>Impact on decision-making</strong>: Making the right decisions is the bedrock of any successful business, but bad data can lead to poor decisions.</li><li><strong>Costs associated with bad data</strong>: Bad data can potentially drain resources and inflate organizational costs.</li><li><strong>Importance of trust in data</strong>: Trustworthy data fosters confidence, alignment, and effective decision-making across all levels of the organization. It also builds trust in data teams. Have you ever been in a situation where you’re constantly having to explain the reports you provide, or where users are hesitant to rely on them? It’s possible that there isn’t enough trust in your reports, and bad data may be the reason that trust has eroded.</li></ul><h3>The Dimensions of Data Quality</h3><ul><li><strong>Freshness</strong>: How up-to-date is the information?</li><li><strong>Accuracy</strong>: To what extent does the data correctly reflect the real-world object or event?</li><li><strong>Completeness</strong>: Are all required data points present?</li><li><strong>Uniqueness</strong>: Are there duplicates in the data?</li><li><strong>Consistency</strong>: Is the data uniform across different systems or datasets?</li></ul><p>Let’s break these down further:</p><p><strong>Freshness</strong>:</p><p>Timeliness refers to how up-to-date your data is, ensuring that decisions are based on the latest information. For example, if a weekly report relies on data that should be updated daily, any delays in the data pipeline can cause the report to display outdated information. By tracking the time lag between when data is created and when it becomes available, you can quickly identify and resolve delays.</p><p><strong>Accuracy</strong>:</p><p>Accuracy ensures that your data reliably mirrors real-world conditions. For example, if shipping addresses are recorded incorrectly, it can lead to missed deliveries and customer dissatisfaction. Regularly comparing your data against trusted sources or established business rules helps you spot and correct errors, maintaining high accuracy across your systems.</p><p><strong>Completeness</strong>:</p><p>Completeness ensures that all necessary data is captured, with no essential details missing. For instance, if customer contact fields lack key information like phone numbers or emails, it can hinder communication and data-driven insights. By routinely monitoring for null or blank fields and setting thresholds to trigger alerts, you can maintain a comprehensive and reliable dataset.</p><p><strong>Uniqueness</strong>:</p><p>Uniqueness ensures that every record in your dataset is represented only once, avoiding unintentional duplicates. For instance, duplicate customer records can inflate metrics and lead to skewed analysis. To maintain data integrity, it’s important to implement deduplication checks and enforce unique ID constraints.</p><p><strong>Consistency</strong>:</p><p>Consistency ensures that data remains uniform and coherent across different systems or datasets. For example, if a customer’s name is spelled differently in various tables, it can lead to confusion and inaccurate reporting. By using data matching rules or standardization processes, you can maintain reliable and consistent information across all your sources.‍</p><h3>Strategies for Monitoring Data Quality</h3><p>A data quality strategy outlines the tools, processes, and techniques used to ensure that your data remains consistent, unique, complete, accurate, and fresh.</p><ul><li><strong>Establish Data Quality Metrics</strong>: Define clear metrics to assess data accuracy, completeness, consistency, timeliness, validity, and uniqueness. Regularly measuring these dimensions helps identify and address data quality issues promptly.</li><li><strong>Develop a Data Quality Monitoring Framework</strong>: Create a structured framework that outlines processes, responsibilities, and standards for monitoring data quality. This includes setting up data governance policies, defining data quality rules, and establishing regular audit procedures to ensure continuous oversight.</li><li><strong>Conduct Regular Data Quality Assessments</strong>: Perform routine evaluations to understand the current state of data quality. These assessments help identify existing issues, assess their impact, and guide the development of effective improvement strategies.‍</li></ul><h3>Techniques for Monitoring Data Quality</h3><p>There are different data quality monitoring techniques you can implement to improve your overall data health and I will share some on this post.</p><ul><li><strong>Data Auditing &amp; Profiling</strong>: Data auditing involves systematically reviewing and assessing an organization’s data to ensure its accuracy, consistency, and reliability. This process identifies and rectifies errors, inconsistencies, and inaccuracies within datasets, thereby enhancing data quality. Regular data audits are essential for maintaining data integrity, supporting informed decision-making, and ensuring compliance with relevant regulations. Data profiling can be done on table, column, dependency and redundancy levels.</li><li><strong>Data Cleansing: </strong>This technique focuses on detecting and correcting inaccuracies, inconsistencies, and redundancies in datasets. By standardizing formats and removing duplicate records, data cleansing enhances the overall quality and reliability of data.</li><li><strong>Tracking Data Quality Metrics</strong>: It is said that whatever is not measured does not improve, so you can create a simple dashboard that helps you track your data health based on the metrics measured against predefined rules.‍</li></ul><h3>Summing It Up</h3><p>Data quality is foundational to any data initiative. It deserves the same attention you’d give to projects involving AI or advanced analytics. After all, those systems rely on clean, reliable data to function well.</p><p>Start by defining baseline quality rules, profiling your data to understand the current state, cleansing the data, and setting up systems to monitor and measure the quality going forward. High-quality data isn’t just good practice, it’s your competitive edge.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6a085edfa06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Five Things I Learned from My Career Transition]]></title>
            <link>https://uforodavid.medium.com/five-things-i-learned-from-my-career-transition-c0dfb7d0e583?source=rss-7c4e14c1e69------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0dfb7d0e583</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[coursera]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[data-analyst]]></category>
            <dc:creator><![CDATA[David Effiong]]></dc:creator>
            <pubDate>Sat, 18 Sep 2021 17:54:21 GMT</pubDate>
            <atom:updated>2021-09-26T15:52:58.983Z</atom:updated>
            <content:encoded><![CDATA[<h3>Five Things I Learned from my Transition to Data Science.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xCMBh6NitCKKVX-AExpR_Q.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@jannerboy62?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Nick Fewings</a> on <a href="https://unsplash.com/s/photos/change?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>A few years ago, I began my professional career as a Teller in one of Nigeria’s top Banks. This was an opportunity I grabbed with both hands because I am very passionate about not starving to death😁. Although my undergraduate degree in Industrial Chemistry had nothing to do with banking, I enjoyed my job role and worked hard at being excellent. As much as I worked diligently on my job, I did not find career satisfaction for some reasons. I was not certain about what career I wanted to pursue, but I certainly knew I did not want to be in that role for a long time.</p><p>A few years later, I landed in my career of choice after two banking jobs, and here are five things I learned along the way that may be of help to those looking to switch careers.</p><p><strong>Know what you don’t want</strong>: I heard this first from an inspirational speaker back in my university days and it stuck with me because I seldom knew what I wanted out of life. But I was certain about what I did not want. This is a scenario that is common among ‘millennials’ and ‘Gen Z’ just starting after university education.</p><p>My first job as a Bank Teller gave me corporate experience, a strong work ethic needed to survive in the bank amidst daily pressures, and a steady paycheck. But I did not want that role for some personal reasons. So I actively searched for opportunities to leave that role for a ‘better’ role in a ‘better place offering ‘better’ returns. Please bear in mind that the meaning of ‘better’ is subjective. As I kept on applying for new roles within and outside my organization and getting many regret mails, one thing became apparent to me as I was gradually leaving entry-level classification: I did not have any marketable skill. It was at that point I decided that I would get a valuable skill no matter what it would take me.</p><p>This leads me to my next lesson.</p><p><strong>Explore your options:</strong> If you are like me and, you don’t know what you want, you have some time to work with and earning some money, then exploration calls for you. My exploration began in the digital marketing space as I began taking up courses along those lines. I knew with the rise of the internet and more businesses looking to leverage the internet for business success that digital marketing would be very much needed. After several learnings and connecting with other digital marketers in the space, I soon found out it was not my thing.</p><p>How did I find out? I soon realized I did not enjoy spending much time on it whether for work or pleasure. Then I entered into software development and started getting my hands-on learning programming but again it did not work out. Whether I did not put enough work into my learning or it was not just my thing, I don&#39;t know… It just did not work.</p><p>In winter 2019, I attended an MBA and master&#39;s fair from schools abroad in Eko Hotel, Lagos, Nigeria. It was there I knew of such a course called Business Analytics. I have always been a curious fellow and analytical thinker so the analytics part resonated with me. I began researching on the course and discovered the field of data science and all its branches. As usual, I began taking free courses on data science on Edx and Coursera. By free I mean, I audited the courses for the knowledge because I could not afford to pay for the courses. But I could afford Udemy’s courses, so I got from there as well. And there was/is plenty of free stuff out there.</p><p>The more I learned, the more I felt my exploration was paying off. Finally, I had discovered what I wanted to do. 🕺🏻🕺🏻🕺🏻🕺🏻 Now you are ready for my next lesson.</p><p><strong>Focus On It With Everything</strong>: From that moment, I consumed any and every content that had anything to do with data science and analytics. I signed up for anything that had “learn data science for free”. During this time, I moved to another bank, for a higher role than my previous but I still was not satisfied. So I kept learning and studying with every free moment I got. The bank is highly demanding as it requires your everything including weekends. So I did not have disposable time but I had to work extra like sleeping late many nights because that was when I had time to work on myself. For me taking the stress to improve my skills with a focus was cheaper compared to not improving myself and staying in my then-current role.</p><p>I only had one choice and it was to build myself with relevant skills and do it well. I kept at my tutorials journey and many times suffered imposter syndrome as I would learn the same things many times. This was because my learning was self-arranged, without structure and the plethora of information online did not help my matter.</p><p>During the covid lockdown period, I began to plateau as I thought I was not learning anything and was close to quitting. Then I discovered a secret that made all the difference. 👇🏼👇🏼👇🏼</p><p><strong>Get a Mentor</strong>: I have learned that mentorship is necessary for winning in any sphere of life. Mentoring is about learning from someone who has traveled the path you want to travel successfully. It saves you from many of the pitfalls they suffered and makes your journey smoother. It was at the point of throwing in the towel that I connected with a mentor who coincidentally was a childhood friend. <a href="https://www.linkedin.com/in/adaugookafor">Adaugo Okafor</a> (<em>you can connect with her on Linkedin</em>) revived my fire for my journey and made me realize that I was making progress.</p><p>My mentor made my learning structured and I could now measure my progress. She gave access to her course materials, gave me tasks to complete, and persuaded me to begin doing data science projects<strong>. </strong>This was a defining point in my learning journey. The more projects I did, the more my learning became concrete and I was excited that I was gradually building a portfolio to show to a potential employer. The need to begin doing projects as it relates to your field of interest cannot be overemphasized. They not only cement the knowledge you think you have acquired but they make you ‘show’ ready. You know the saying that “Learning comes by doing”.</p><p>Yes now I was ready to conquer the world, or so I thought…🙃😌</p><p><strong>Be Patient</strong>: I had gotten my skills right, I had my projects right, I had my Resume right but I was not getting the job offers as a data analyst after several applications. I would tweak and design my resume to help me stand out in the process, but yet it was not working. I hoped for internal movement within my organization but it also was not coming through. Then I was forced to be patient. Oftentimes in life, you will put in the work and sweat, make the sacrifices and still not get your expected end.</p><p>At this point, life is calling you to be patient because success cannot be hurried. This is the point you have to trust in God to open doors for you. It is also important to state that you must still be excellent at your current role and seek to offer more value than you are receiving. Jesus teaches that faithfulness is a key to getting more. While waiting, keep learning and making necessary adjustments that will help you land your first role in your career switch. Usually, the first one is the hardest, but once you break through that ceiling the sky will be your starting point.</p><p>If you have read up till this point, thank you very much and I hope you picked up a thing or two from this. No matter the stage of your career, a switch is still possible. It certainly not going to be easy, but it is worth the try as long as it is what you want to do.</p><p>Please share your thoughts in the comment section and don&#39;t forget to share as someone in your network may need this information.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0dfb7d0e583" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[#ENDSARS Protest Tweets Analysis]]></title>
            <link>https://uforodavid.medium.com/endsars-protest-tweets-analysis-57f87bf7e0d7?source=rss-7c4e14c1e69------2</link>
            <guid isPermaLink="false">https://medium.com/p/57f87bf7e0d7</guid>
            <category><![CDATA[exploratory-data-analysis]]></category>
            <category><![CDATA[endsars]]></category>
            <category><![CDATA[sentiment-analysis]]></category>
            <category><![CDATA[twitter]]></category>
            <dc:creator><![CDATA[David Effiong]]></dc:creator>
            <pubDate>Tue, 03 Aug 2021 16:20:28 GMT</pubDate>
            <atom:updated>2021-09-19T05:00:40.684Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U5sZM-EMVukiEY2NUHN8Hw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@magicconceptstudio?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Tobi Oshinnaike</a> on <a href="https://unsplash.com/s/photos/nigeria-flang?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>On the 8th of October 2020, a nationwide protest began in Nigeria against the Special Anti-Robbery Squad popularly known as SARS . This started after weeks of outrage and anger with videos and pictures showing police brutality in different parts of the nation. The #ENDSARS movement started as a social media movement dominated by Twitter users and then grew into a full blow street protest which was then hijacked by hoodlums and then grounded by military action.</p><p>Personally, I was interested in analyzing the tweets from an exploratory standpoint and also conducting a sentiment analysis of the tweets hence this project. This analysis is purely academic and not political in any way.</p><p>Data for this project was scraped from Twitter using SNSCRAPE python library. Thanks to Martin Beck for the guide. You can check it out <a href="https://betterprogramming.pub/how-to-scrape-tweets-with-snscrape-90124ed006af">here</a>.</p><p>The data scraped was from 20th October 2020 till 30th October 2020. A total 553744 unique tweets were used for the analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ID6rBbZiXo-Q41qZ5n2Gg.png" /><figcaption>image of dataframe and number of rows</figcaption></figure><p>For my analysis, I pulled out relevant columns from the data frame which are date and tweet columns. Then a function was written to clean the data from irrelevant characters. See below the image of the function and cleaned data with the tweets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BJ984FWNVC13hKCyXKVjqA.png" /></figure><h4><strong>Wordcloud of Tweets</strong></h4><p>A word cloud was created with the tweets. The more a specific word appears in the text, the bigger and bolder the word will be in the word cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*-njxnrgxJ-outUQ2iFan0Q.png" /><figcaption>WordCloud</figcaption></figure><p>From the image above, we can see that people some words and sentences kept reoccurring and this gives us a picture of what people really wanted when they tweeted #ENDSARS. A quick view at the word cloud shows phrases like <em>EndSars, EndPoliceBrutalityInNigeria, EndBadGovernanceInNigeria, Peaceful Protesters </em>was frequently used and this shows what the whole movement was about. A view a the top 20 most used words in all the tweets also buttresses this fact.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G00JiFXUs2cHYI4uwYuSLw.png" /></figure><h4>Sentiment Analysis</h4><p>Vader Sentiment intensity analyzer was used to get the sentiment of the tweets and labels “negative”, “positive”, “neutral” was added to each of the tweets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rs5a7JAwgchHO6tuYtgYIQ.png" /></figure><p>As expected more of the tweets were negative than positive as shown in the graph below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KNVjNdMzJc1uRpJOIFqzJw.png" /></figure><p>This analysis was done out of curiosity to really know if what society thinks about the endsars protest matches what was actually tweeted since the protest started on Twitter. I hope you found this as insightful as I did. For full details, please check my git hub repository <a href="https://github.com/uforodavid/EndSars_Analysis">here</a>.</p><p>Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57f87bf7e0d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Customer Segmentation (Udacity DSND Capstone Pro]]></title>
            <link>https://uforodavid.medium.com/customer-segmentation-udacity-dsnd-capstone-pro-b0cd66c01ab9?source=rss-7c4e14c1e69------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0cd66c01ab9</guid>
            <dc:creator><![CDATA[David Effiong]]></dc:creator>
            <pubDate>Thu, 27 May 2021 23:48:49 GMT</pubDate>
            <atom:updated>2021-05-29T23:00:09.850Z</atom:updated>
            <content:encoded><![CDATA[<h3>Customer Segmentation (Udacity DSND Capstone Project)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t_zQzqEEMHhZXHYfxOCuHA.jpeg" /></figure><h4>Project Overview</h4><p>This post is about my Udacity Data Scientist Nanodegree Capstone Project. For the capstone project, I decided to complete the project on <strong>Customer Segmentation Report for Arvato Financial Services. </strong>The problem domain of this project is in the financial services industry and it involves three steps. <br>1. Customer Segmentation Report : I used unsupervised learning methods to analyze attributes of established customers and the general population in order to create customer segments.<br>2. Supervised Learning Model: Using a third dataset with attributes from targets of a mail order campaign, I built a machine learning model that predicts whether or not each individual will respond to the campaign.<br>3. Kaggle Competition: After choosing a model, I used it to make predictions on the campaign data as part of a Kaggle Competition.<br>The full code of this project can be found in my <a href="https://github.com/uforodavid/Arvato_Fin_Project">github repository.</a></p><p>This project is sponsored by Arvato Finanacial Services and the dataset used for this project was also provided by Arvato Analytics and cannot be shared due to privacy and data protection. Below are the 4 data sets needed.</p><ul><li>Udacity_AZDIAS_052018.csv: Demographics data for the general population of Germany; 891 211 persons (rows) x 366 features (columns).</li><li>Udacity_CUSTOMERS_052018.csv: Demographics data for customers of a mail-order company; 191 652 persons (rows) x 369 features (columns).</li><li>Udacity_MAILOUT_052018_TRAIN.csv: Demographics data for individuals who were targets of a marketing campaign; 42 982 persons (rows) x 367 (columns).</li><li>Udacity_MAILOUT_052018_TEST.csv: Demographics data for individuals who were targets of a marketing campaign; 42 833 persons (rows) x 366 (columns).</li></ul><p>There are also two Excel spreadsheets, providing more information about the columns depicted in the data files.</p><ul><li>DIAS Information Levels — Attributes 2017.xlsx is a top-level list of attributes and descriptions, organized by the informational category.</li><li>DIAS Attributes — Values 2017.xlsx is a detailed mapping of data values for each feature in alphabetical order.</li></ul><h3>Problem Statement</h3><p>Arvator Analytics needs to analyze demographics data for customers if a mail-order sales company in Germany, comparing it against demographics information for the general population. Using a third dataset with demographics information for targets of a marketing campaign for the company, build a model to predict which individuals are most likely to convert into becoming customers for the company. Afterwards, you will use your model for a Kaggle competition and see how you compare with other submissions.</p><p>In solving these problems, the data will be explored and cleaned, dimensionality reduction will be employed to reduce the dimensions and K-Means clustering will be used to build clusters and segments for the customer and general population datasets. ML classification techniques will be used in the third dataset to predict which individuals are more likely to convert to customers. This strategy will be used to approach the problem.</p><p>The expected solution will cluster the customer and general population into segments, compare the clusters and also predict using a third dataset which individuals are most likely to convert.</p><h3><strong>Metrics</strong></h3><p><em>Metrics used to measure performance of a model or result are clearly defined. Metrics are justified based on the characteristics of the problem.</em></p><p>During my clustering analysis, I used Elbow plot to determine the optimum number of clusters for my K-Means algorithm. I also used kelbow_visualizer from yellowbrick library and iterated on it go get the optimum number of clusters.<br>There is a large output class imbalance, where most individuals did not respond to the mailout. Thus, predicting individual classes and using accuracy does not seem to be an appropriate performance evaluation method. Instead, I will be used AUC to evaluate performance of the prediction model.</p><h3><strong>Data Exploration</strong></h3><p>In this part, I explored the data regarding missing values, data imputation, data type transformation and scaling.<br>The customer dataset has 3 more columns {‘CUSTOMER_GROUP’, ‘ONLINE_PURCHASE’, ‘PRODUCT_GROUP’} as against the general population demographics dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5LQwFEvc55RUWNJIxhllig.png" /><figcaption>Azdias and customer dataset.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hYKFYMGx3Y4SWZ_v7FdaMQ.png" /></figure><p>Each row of the demographics files represents a single person, including information about their household, building, and neighborhood. The first two data files (“customers”) and (“azdias”) will be used for customer segmentation using k-means clustering techniques and then make predictions on the other files (“mailout”) predicting which recipients are most likely to become a customer for the mail order company.</p><p>Some of the fields in the data include ‘LNR’, ‘AGER_TYP’, ‘AKT_DAT_KL’, ‘ALTER_HH’, ‘ALTER_KIND1’, ‘ALTER_KIND2’, ‘ALTER_KIND3’, ‘ALTER_KIND4’, ‘ALTERSKATEGORIE_FEIN’, ‘ANZ_HAUSHALTE_AKTIV’, which represents attributes described in the two excel spreadsheets provided.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HjV4aiO9JC1ooao4IvCqmg.png" /></figure><p><strong>Descriptive statistics</strong>: The image below shows basic descriptive statistics of the input dataset. This method gives the count, mean, standard deviation, minimum, 25th, 50th, 75th percentile and also maximum values of each field in the dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pavzPUUcqd42Zw8QP62nOQ.png" /></figure><p><strong>Dealing missing data: </strong>The dataset contains missing values with some columns having as high as 99.86, 99.76, 99.31 and 99.08 percentage of missing values as seen in the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wErTTyaFRstz5IxWbCrfkg.png" /></figure><p>Some attributes values are unknown or not available, they were converted to NaNs before processing missing data. A dataframe were one column is the attribute and another column is the value that indicate unknown or no values was created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*UyGFuatP5n3EHKB-V7Ufrg.png" /><figcaption>Attributes and Values that mean unknown.</figcaption></figure><p>The image below shows the percentage of null values in the AZDIAS dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*be_9KktfIO0Kqo7mRlRc_Q.png" /></figure><p>According to the figure below, the proportions of missing values in most of the columns are less than 0.3 and so I dropped columns with missing values greater than 0.3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cxB-_v-KAhApNd_DYqCYJw.png" /></figure><p>The following figure illustrates the distribution of missing values per row. According to this figure, the proportions of missing values in most of the rows are less than 0.1. I dropped the rows with the proportion of missing values greater than 0.1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ou3Za3EmB_HFPlJiZZxCw.png" /></figure><p><strong>Processing Data Types : </strong>In the AZDIAS demographics dataset, 6 columns are ‘objects’, 93 are integers and 267 are floats. The 6 objects columns will be converted</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GSciyWWuDm8XgWVjqJy1-Q.png" /></figure><p>The approach is to reencode ‘X’ in CAMEO_DEUG_2015 and ‘XX’ in CAMEO_INTL_2015 with NaNs, and then convert CAMEO_DEUG_2015 and CAMEO_INTL_2015 to float; reencode ‘W’ and ‘O’ in OST_WEST_KZ with 1 and 0; drop column CAMEO_DEU_2015, D19_LETZTER_KAUF_BRANCHE, EINGEFUEGT_AM.</p><p>After this process, azdias dataset has 737241 rows and 322 columns.<br><strong>Cleaning Customer dataset:<br></strong>Functions regarding the previous cleaning steps was created and used to clean the Customer dataset. The extra columns in the Customer dataset (i.e., ‘CUSTOMER_GROUP’, ‘ONLINE_PURCHASE’, ‘PRODUCT_GROUP’) was dropped and the space of the Customer dataset after cleaning was (134245, 322)<br><strong>Data imputation and feature scaling:<br></strong>The missing values was imputed using the SimpleImputer with mean strategy StandardScalar was used for feature scaling. The following figures shows the azdias dataset after the imputation and feature scaling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*msQZIAcMScPF8AnLb5ZuIQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kVg8-bQQcvLO7tLAZgcLUg.png" /></figure><h3>Implementation:</h3><p>The process for which metrics, algorithms, and techniques were implemented with the given datasets or input data has been thoroughly documented. Complications that occurred during the coding process are discussed.</p><p><strong><em>PCA</em><br></strong>Since there are 322 columns in the datasets, I used Principal Component Analysis (PCA) to reduce dimensions. Instead of specifying the number of principal components I want to preserve, I set n_components to be a float between 0.0 and 1.0, indicating the ratio of variance I wish to preserve which in the figure below is 0.95. I showed 211 dimensions as the optimal number of dimensions. Deciding which approach in selecting n_components for PCA was a bit challenging, but I found the approach I used in <em>Hands-on Machine Learning with Scikit-Learn, Keras, and TensorFlow by Aurélien Géron.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CBmICcBYTz6nyR-CXVWYhw.png" /><figcaption>PCA</figcaption></figure><p><strong><em>Clustering Analysis:</em> </strong><br>I used k-means clustering method after PCA to build the clusters. I plotted the change of k-means score with the number of clusters to get the number of clusters using elbow plot. The plot shows that the score decreases rapidly at the beginning and then becomes slow after 7 clusters. So, I selected 7clusters as the number of clusters for analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DvjYjHv9mMU7Ojl2AKAFwA.png" /><figcaption>cluster selection.</figcaption></figure><p><strong><em>K-means<br></em></strong>I used k-means clustering method to create segments for the datasets. The model fits the cleaned azdias dataset and predicts on the azdias and customers PCA dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*paLOqX-_1lT-fABRolnyRQ.png" /><figcaption>K-Means</figcaption></figure><p>Then I compared the proportion of each cluster in both azdias and customers datasets. Clusters 2 and 0 are the most overrepresented in the customer compared to the general population. Clusters 6 and 4 are the most under-represented in the customer.<br>The type of customers in either the target or non-target customers is shown in the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h724cotKhsLzZlsZxA9_gw.png" /></figure><p>As a summary, the major attributes in the over-represented population are the share of middle and upper-class cars, financial status, and age. The major attributes in the under-represented population are the number of family houses, household income, and density of inhabitants.<br><strong><em>Supervised Learning Model</em><br></strong>I built a supervised learning model to predict whether or not an individual will become a customer. The “MAILOUT” data has been split into two approximately equal parts, each with almost 43 000 data rows. Each of the rows in the “MAILOUT” data files represents an individual that was targeted for a mailout campaign. I will verify the model with the “TRAIN” partition, which includes a column, “RESPONSE”, that states whether or not a person became a customer. Then I will create predictions on the “TEST” partition, where the “RESPONSE” column has been withheld.<br>The training data was cleaned using the previously defined cleaning functions followed by data imputation and data scaling. I tested four methods to find the best classifier. I used AUC metrics as performance metrics since there is a problem of very imbalanced classes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G-wC4h1hY1_ryDeIByQoNw.png" /></figure><p>I checked out the top 10 most important features in the final model. D19_SOZIALES is most important one, but there is no description. Other important features include the number of cars, share of Ford, year of buliding, number of professional title holder, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S5Vnr8nKJr0senFFbUo7Rg.png" /><figcaption>Top 10 most important features</figcaption></figure><h3><strong>Refinement</strong></h3><p>In choosing <em>n_components </em>for PCA, I first set n = 2 which gave me a great visualization of the clusters but was not appropriate for my problem of dataset. I also tried to arbitrarily choose n to any number but I was not comfortable with this approach as it was not scientific and could not be explained. I also chose the number of dimensions that add up to a sufficiently large portion of the variance (e.g., 95%) to select my n_component with code below which gave 197 as n_components.</p><pre>pca = PCA()<br>    pca.fit(azdias_new)<br>    cumsum = np.cumsum(pca.explained_variance_ratio_)<br>    d = np.argmax(cumsum &gt;= 0.95) + 1<br>d = 197</pre><p>Instead of specifying the number of principal components I want to preserve, I decided to set n_components to be a float between 0.0 and 1.0, indicating the ratio of variance you wish to preserve. This final approach gave n_components as 211.</p><pre>pca = PCA(n_components=0.95)<br>azdias_model = pca.fit_transform(azdias_pca)</pre><p>Selecting the number of clusters was also challenging, I iterated the elbow plot using the yellow brick library and discovered 7 to be the optimum number of plots. I also attempted to use silhouette score metric but the run time was very long exceeding 5 hours. <br>During the ML classification techniques, I ran 4 classifiers and selected Gradient Boosting Classifier as the most effective using the ROC_AUC metric with highest score of 0.77.</p><h3><strong>Model Evaluation, Validation and Justification.</strong></h3><p>The clustering model grouped the dataset into 7 segments and the column ‘difference’ is a measure of the distance between each cluster in general population dataset and customer datasets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*udIKnmK6IzotIRUv2YkR9Q.png" /></figure><p>Clusters 2 and 0 are most represented in the customer dataset and clusters 6 &amp; 4 are less represented in the customers.<br>The Classification techniques shows the ROC_AUC scores are 0.68, 0.59, 0.75, and 0.77 for Logistic Regression, Random Forest Classifier, AdaBoostClassifier, and Gradient Boosting Classifier, respectively. The higher score indicates a better model and I selected Gradient Boosting Classifier as the estimator and optimized the parameters using GridSearchCV. I tested different learning rate and number of estimators. The optimized parameters resulted in a score is 0.78. This model by Gradient Boosting Classifier is used as the final estimator.</p><p><em>param_grid = {<br>‘learning_rate’: [0.01, 0.1, 1],<br>‘n_estimators’: [10, 100, 200]<br>}</em></p><p>The optimized parameters are learning_rate = 0.1 and n_estimators=100, and the score is 0.78. This model is used as the final estimator.<br>This final estimator is</p><pre>GradientBoostingClassifier(criterion=&#39;friedman_mse&#39;, init=None,<br>              learning_rate=0.1, loss=&#39;deviance&#39;, max_depth=3,<br>              max_features=None, max_leaf_nodes=None,<br>              min_impurity_decrease=0.0, min_impurity_split=None,<br>              min_samples_leaf=1, min_samples_split=2,<br>              min_weight_fraction_leaf=0.0, n_estimators=100,<br>              n_iter_no_change=None, presort=&#39;auto&#39;, random_state=42,<br>              subsample=1.0, tol=0.0001, validation_fraction=0.1,<br>              verbose=0, warm_start=False)</pre><h3><strong>Reflection and Improvements.</strong></h3><p>The project was really challenging overall but I found the customer segmentation part really fascinating and interesting as I have never done any clustering analysis. I discovered the elbow plot and silhouette score as a metric for clustering analysis and choosing number of clusters.</p><p>I think a different result may be gotten if the strategies for imputation and scaling are changed. In my research on clustering, I also discovered Affinity Propagation as a method of clustering other than K-Means. These approaches can be used to improve the overall result of the models.</p><p><strong>Kaggle Competition<br></strong>Now it is time to test the model on the TEST dataset and submit for Kaggle competition. The entry to the competition is a CSV file with two columns. The first column is “LNR”, which acts as an ID number for each individual in the “TEST” partition. The second column, “RESPONSE”, is the probabilities of each individual became a customer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/175/0*1gLlMOU8hXWrcfZs.png" /></figure><p>I submitted it to Kaggle, and the final score is 0.66.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0cd66c01ab9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[This Analysis Will Make You Better Informed For Your Next Car Purchase.]]></title>
            <link>https://uforodavid.medium.com/this-analysis-will-make-you-better-informed-for-your-next-car-purchase-3bdc147c7eec?source=rss-7c4e14c1e69------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bdc147c7eec</guid>
            <category><![CDATA[exploratory-data-analysis]]></category>
            <category><![CDATA[kaggle-dataset]]></category>
            <category><![CDATA[predictive-modeling]]></category>
            <category><![CDATA[car-prices]]></category>
            <dc:creator><![CDATA[David Effiong]]></dc:creator>
            <pubDate>Wed, 24 Feb 2021 22:49:22 GMT</pubDate>
            <atom:updated>2021-02-28T07:05:08.916Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AMhvrzX1sR0hnJ0GT324BA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@dhivakrishna?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Dhiva Krishna</a> on <a href="https://unsplash.com/s/photos/cars?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Aside from buying a house, a car is probably the second most important purchase most people will ever make in life, and this makes it necessary for you to arm yourself with the adequate information in order to make a good purchase.</p><p>When it comes to cars and choosing which car to buy especially as it relates to cost, we all have our opinions. You have heard people say “such and such a brand is more expensive” or “this vehicle will be more expensive because the kilometer driven is little”. But what does the data suggest? Therefore I used data from Kaggle’s Vehicle Dataset of Used Cars to provide answers to the following questions:</p><ol><li>Which feature of a car has the most impact on the price of the car?</li><li>Does the distance covered by the cars before sale affect the price of cars?</li><li>Which is most expensive, diesel or petrol cars?</li><li>Which car brands are the most expensive?</li><li>Which gear transmission type is most expensive, automatic or manual?</li><li>Does age of cars from first purchase affect the selling price?</li></ol><p>The data for this project was gotten from Kaggle Used Vehicle Dataset from CarDekho. The data on Kaggle can be found <a href="https://www.kaggle.com/nehalbirla/vehicle-dataset-from-cardekho?select=car+data.csv">here</a> and full code for this project can be found on my <a href="https://github.com/uforodavid/Cars_Prices_Prediction_Project">github repository</a>.</p><h4>Which feature has most impact on the price of the car?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*giztxny2F_wmucyRp1qYcQ.png" /><figcaption>Correlation heat map</figcaption></figure><p>Six quantitative features including distance travelled in kilometers, mileage, engine capacity, power, number of seats and age of the car after first purchase were analysed alongside the selling price for the feature that had the highest correlation with the selling price of the car. Engine capacity showed the highest positive correlation with the selling price of the car. This implies that a vehicle with high engine capacity will be a high cost vehicle. Other features that showed great impact on the selling price includes ‘brand’, ‘gear type’, and type of fuel used in the car. On the other end of the spectrum, surprisingly, the age of the vehicle from first purchase had no positive correlation with the price of the vehicles.</p><h4><strong>Does distance traveled by cars after first purchase affect selling price?</strong></h4><p>The data revealed that the distance covered in miles or kilometer had no positive correlation with the selling price of the cars. As a matter of fact, ‘Mileage’ and ‘kilometer driven’ features had the next lowest correlation after ‘age’. This proves that the distance covered should not be in the conversation when making a price deal on a used car. However, cars below 4 years were more in the top 100 most expensive car list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/1*m13YACopeDMmfyiezhO1pQ.png" /><figcaption>Cars of 3 years had more share among the top 100.</figcaption></figure><h4>Which is most expensive, diesel or petrol cars?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*WpoN1OYCyPe_iBw28HbB4Q.png" /><figcaption>Diesel vs Petrol</figcaption></figure><p>My analysis revealed that diesel cars are more expensive than petrol cars as 90 of the top 100 expensive cars are diesel run. This particular discovery surprised me as I personally thought otherwise.</p><h4>Which car brands are the most expensive?</h4><p>My analysis revealed that the German brand BMW has the most number of vehicles in the top 100 expensive list with 24 vehicles, next to Mercedes-Benz and then Audi. It is also interesting to mention that this top 3 expensive brands are all German vehicles. See below for breakdown of top 100 most expensive vehicles:</p><pre>BMW              24<br>Mercedes-Benz    19<br>Audi             16<br>Toyota           14<br>Volvo             7<br>Jaguar            7<br>Ford              4<br>Skoda             3<br>Jeep              2<br>Isuzu             1<br>Land              1<br>Lexus             1<br>Honda             1</pre><h4>Which gear transmission type is most expensive, automatic or manual?</h4><p>Just as you guessed already, Automatic gear type are more expensive than manual as revealed by the data. 94 cars in the top 100 ranking used automatic gears.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*jLd03OVemqy062QD6b-OPg.png" /></figure><h4>Does age of cars from first purchase affect the selling price?</h4><p>The data showed that vehicles of 3 years were among the most expensive and this may imply that newer vehicles sold for the highest price. But the data also shows that some vehicles younger than 3 years sold for lesser amount which does not follow the observed trend. I however believe that newer vehicles that sold for lower prices were affected by perhaps transmission type, fuel type, brand of car or engine capacity.</p><h4>Prediction Model using Random Forest Regression and Linear Regression.</h4><p>In building my regression models using Random Forest and Linear Regressions, I created dummy variables for the categorical variables, transformed some numerical columns to logarithms and dropped rows containing outliers and missing values.</p><p>R-squared values for RFR and LR models were at 0.98 and 0.82 respectively which is a good model without over fitting.</p><p>I hope you got a thing or two from this analysis. Thank you very much and please do well to share.</p><p>To see more about this analysis, see my git hub repository <a href="https://github.com/uforodavid/Cars_Prices_Prediction_Project">here.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bdc147c7eec" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>