<?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 Godsfavour Oluwajoba Oluwabori on Medium]]></title>
        <description><![CDATA[Stories by Godsfavour Oluwajoba Oluwabori on Medium]]></description>
        <link>https://medium.com/@oluwabori.joba?source=rss-860423f3842b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*15SZmQjAuEIX3Ax4JGlRkg.jpeg</url>
            <title>Stories by Godsfavour Oluwajoba Oluwabori on Medium</title>
            <link>https://medium.com/@oluwabori.joba?source=rss-860423f3842b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 12:35:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@oluwabori.joba/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[Building an Automated Attendance System Using Face Recognition and MySQL]]></title>
            <link>https://medium.com/@oluwabori.joba/building-an-automated-attendance-system-using-face-recognition-and-mysql-4e7a0d02502a?source=rss-860423f3842b------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e7a0d02502a</guid>
            <category><![CDATA[face-recognition-system]]></category>
            <category><![CDATA[dlib]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[face-recognition]]></category>
            <dc:creator><![CDATA[Godsfavour Oluwajoba Oluwabori]]></dc:creator>
            <pubDate>Fri, 18 Apr 2025 18:51:10 GMT</pubDate>
            <atom:updated>2025-04-18T19:12:19.572Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*vdf_MGnTWfrYnyR_P3iT7w.jpeg" /><figcaption>Source: <a href="https://www.biometricupdate.com/201908/telpo-targets-biometric-access-control-market-with-facial-recognition-terminal">biometricupdate.com</a></figcaption></figure><p>These past few months in my Master’s program have been an amazing journey into the world of AI. I&#39;ve explored some incredible topics in AI—from hand landmark detection that tracks every finger movement to real-time speech conversion and face detection. And I’m excited to document my progress and share what I’ve learned!</p><p>Recently, I focused on face recognition — the same cool tech that unlocks your phone instantly and helps airports move passengers smoothly through security. In this article, I will guide you through building a practical face recognition system that:</p><ol><li>Identifies faces in photos or live video</li></ol><p>2. Works with just a sample photo of each person</p><p>3. Uses basic Python code</p><p>Whether you’re looking to automate attendance tracking, apply digital makeup filters on your face, enhance a security system, or simply explore how face recognition works, this guide will get you started. Let’s begin!</p><h3><strong>Objective</strong></h3><p>This system can:</p><ol><li>Automatically detect and recognise individuals.</li><li>Log attendance of faces recognised once over any specified duration(e.g 1 hour, 12 hours).</li><li>Store data securely for easy retrieval and reporting.</li></ol><h3><strong>Quick Highlights:</strong></h3><h4>1. Face Encoding: The Magic Behind Recognition</h4><p>Here’s where the magic happens. Face encoding is the process of turning a face into a mathematical representation — a 128-dimensional vector. This vector is gotten from the locations and outlines of your eyes, nose, mouth, and chin. Think of it as a digital fingerprint for your face. And the best part? No matter the angle you use to take a picture, the lighting, or the pose, the system will recognise you with this unique encoding. You should note that your face isn’t stored as an image; it’s just a string of numbers(encodings) that can’t be reverse-engineered.</p><p>For this project, I gathered and encoded recent pictures of the cast of the popular series, Friends. Now with just a single image, I can recognise Jennifer Aniston from the episodes that aired 20 years ago!</p><p>Why encoding?</p><ul><li><strong>Efficiency</strong>: Encodings are lightweight compared to storing full images.</li><li><strong>Accuracy</strong>: Encodings capture unique facial features like jawlines, eye spacing, etc.</li><li><strong>Privacy</strong>: Encodings cannot be reverse-engineered to reconstruct the original face.</li></ul><p>In this project, I used the face_recognition library to generate these encodings and I stored them in a MySQL database as <strong>Base64 strings</strong>. This library is built using <a href="http://dlib.net/">dlib</a>’s state-of-the-art face recognition, built with deep learning.</p><h4><strong>2. Real-Time Detection with OpenCV</strong></h4><p><em>Once the system knows what to look for, it’s time to put it to work. Using OpenCV, the system captures live video from a webcam and detects faces in real-time. Here’s the workflow:</em></p><ol><li><strong>Detect Faces</strong>: The system scans the video frame for faces.</li><li><strong>Compare Encodings</strong>: It matches detected faces against the known encodings stored in the database.</li><li><strong>Display the names of the persons and log attendance</strong>: If a match is found, the system lets you know by displaying a bounding box over the detected face and the name. It also saves the person’s name and timestamp, but only if they haven’t been saved in the last 12 hours <strong>(this duration can be changed to your preferred duration)</strong>. <em>It’s like having a bouncer at the door who knows everyone by name and never lets anyone sneak in twice.</em></li></ol><h4><strong>3. Database Design(Optional)</strong></h4><p><em>You only need this if you want to store the results.</em></p><p>The system uses two MySQL tables:</p><h4>known_faces</h4><ul><li>Stores known face encodings and associated metadata (e.g., name).</li><li>Example: A student’s face encoding is stored here for future recognition.</li></ul><h4>detected_faces</h4><ul><li>Logs every detected face with a timestamp.</li><li>Example: When students are recognised, their name and detection time are logged here.</li></ul><p>This structure ensures efficient data management and easy retrieval of attendance reports.</p><h3>Step-by-Step Code</h3><p><em>Now, let’s get into the nitty-gritty. Here’s how the system comes to life with code.</em></p><ol><li><strong>Import the necessary libraries</strong></li></ol><pre>import mysql.connector<br>import face_recognition  # Library for face recognition<br>import os  # Library to handle file paths and directories<br>import numpy as np  # Library for numerical operations<br>import cv2  # OpenCV library for image processing<br>import base64</pre><p>2. <strong>Set up the Database</strong></p><ul><li>First, we create the tables to store known faces and attendance logs.</li></ul><pre>create table ass3.detected_faces<br>(<br>    id            int auto_increment<br>        primary key,<br>    detected_name varchar(255) null,<br>    timestamp     timestamp    null<br>);<br><br>create table ass3.known_faces<br>(<br>    id        int auto_increment<br>        primary key,<br>    name      varchar(255) null,<br>    encoding  text         null,<br>    timestamp timestamp    null<br>);</pre><pre>#Connecting to MySQL Database<br>db = mysql.connector.connect(<br>    host=&#39;localhost&#39;,<br>    user=&#39;root&#39;,<br>    password=&#39;&#39;,<br>    database=&#39;Ass3&#39;)  <br><br>cursor = db.cursor() #Cursor to execute SQL queries</pre><p>3. <strong>Register Known Faces</strong></p><ul><li>Set up the images of faces you want recognised with their names as the name of their respective image. Place images of known individuals in a folder (e.g., Jennifer Aniston.jpg).</li><li>Run the ProcessandSaveEncodings() function to generate and store encodings in the database.</li></ul><pre># Function to Process and Save Known Face Encodings in the database<br>def ProcessandSaveEncodings():<br>    dir = &#39;&#39;  # Replace with the folder directory of your images<br>    <br>    <br>    faces = [f for f in os.listdir(dir) if f.lower().endswith((&#39;.jpg&#39;, &#39;.png&#39;))]  # Get all image files (JPG, PNG) in the directory<br>    images_known = []  # List to store image file paths<br>    <br>    # Create full paths for each image file<br>    for x in faces:<br>        images_known.append(dir + &quot;/&quot; + x)<br><br>    known_face_encodings = []  # List to store face encodings<br>    known_face_names = []  # List to store corresponding names<br><br>    # Process each image to extract face encodings<br>    for x in images_known:<br>        known_image = face_recognition.load_image_file(x)  # Load image<br>        known_face_encoding = face_recognition.face_encodings(known_image, model=&quot;small&quot;)[0]  # Extract face encoding<br>        known_face_encodings.append(known_face_encoding)  # Store encoding<br>        known_face_names.append(os.path.basename(x))  # Store filename (used as name)<br><br>    print(known_face_encodings) # Debug: Print known face encodings<br>    print(&quot;Original Length:&quot;, len(known_face_encodings[0])) # Debug: Print length of encodings<br><br>    # Save encodings in database<br>    for name, encoding in zip(known_face_names,known_face_encodings):<br>        name = os.path.splitext(name)[0] # Remove file extension<br>        query = &#39;INSERT INTO known_faces (name, encoding, timestamp) VALUES (%s, %s, CURRENT_TIMESTAMP())&#39;<br>        cursor.execute(query, (name, base64.b64encode(encoding.tobytes()).decode(&#39;utf-8&#39;)))   # Convert encoding to Base64<br>        db.commit()<br>    # return known_face_encodings, known_face_names  # Return face encodings and names but not needed</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*g_4hepMKX_azi8YcSfe61A.png" /><figcaption><em>Screenshot of the </em><em>known_faces table in MySQL.</em></figcaption></figure><p><strong>4. Start Real-Time Detection</strong></p><ul><li>Finally, we run the WebcamFaceRecognition() function to start detecting and logging faces via webcam.</li><li>Detected faces are logged in the database, with a 12-hour deduplication rule.</li></ul><pre># Function for Face Recognition Using Webcam<br><br>def WebcamFaceRecognition():<br>    video_capture = cv2.VideoCapture(0)  # Open webcam (0 = default camera)<br>    known_face_encodings, known_face_names = ProcessandSaveEncodings()  # Load known faces<br><br>    while True:<br>        ret, frame = video_capture.read()  # Read a frame from the webcam<br>        face_locations = face_recognition.face_locations(frame, model=&#39;hog&#39;) # Detect faces in the frame<br>        face_encodings = face_recognition.face_encodings(frame, face_locations,model=&#39;small&#39;)  # Extract encodings<br><br>        # Retrieve stored face encodings from the database<br>        encoding_query = &#39;SELECT encoding FROM known_faces&#39;<br>        cursor.execute(encoding_query)   <br>        encoded_face_encodings = cursor.fetchall()<br><br>        # Convert Base64-encoded encodings back to NumPy arrays<br>        known_face_encodings = [np.frombuffer(base64.b64decode(encoding), dtype=np.float64, count= -1) for list in encoded_face_encodings for encoding in list]<br><br>        print(&quot;Decoded Length:&quot;, len(known_face_encodings[0])) # Debug: Check the new encoding size, should be the same with the original<br><br>        # Load Names of Known Faces<br>        name_query = &#39;SELECT name FROM known_faces&#39;<br>        cursor.execute(name_query)   <br>        known_face_names = cursor.fetchall()<br>        known_face_names = [names for list in known_face_names for names in list]<br>    <br>        # Face Matching &amp; Logging<br>        # Iterate through detected faces and compare with known faces<br>        for (top,right,bottom,left), face_encoding in zip(face_locations, face_encodings):<br>            matches = face_recognition.compare_faces(known_face_encodings,face_encoding) # Compare with known faces<br>            print(matches)<br>            name = &quot;Unknown&quot;  # Default name<br><br>            # Compute distances and find best match<br>            face_distances = face_recognition.face_distance(known_face_encodings,face_encoding)<br>            best_match_index = np.argmin(face_distances)   # Find the closest match<br><br><br>            if matches[best_match_index]: # If a match is found, get name<br>                name = known_face_names[best_match_index]<br>                name = os.path.splitext(name)[0] # Remove file extension<br><br>                # Check if the person was detected in the last 12 hours<br>                query_check = &#39;SELECT COUNT(*) FROM detected_faces WHERE detected_name = %s AND TIMESTAMPDIFF(HOUR, NOW(), timestamp) &lt; 12&#39;<br>                cursor.execute(query_check,(name,))<br>                result = cursor.fetchone()<br><br>                if result[0] == 0:  # If not detected in the last 12 hours, insert into database<br>                    query = &#39;INSERT INTO detected_faces (detected_name, timestamp) VALUES (%s, CURRENT_TIMESTAMP())&#39;<br>                    cursor.execute(query, (os.path.splitext(name)[0],))   <br>                    db.commit()<br>                    print(f&quot;Logged {name} into database.&quot;)<br>                else:<br>                    print(f&quot;{name} was already logged within the last 12 hours. Skipping entry.&quot;)<br><br>                # Draw a rectangle around the detected face<br>                # Parameters: (image, top-left corner, bottom-right corner, color (BGR), thickness)<br>                cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2)<br><br>                # Draw a filled rectangle below the face for labeling<br>                # Parameters: (image, top-left of label, bottom-right of label, color (BGR), fill the rectangle)<br>                cv2.rectangle(frame, (left, bottom - 25), (right, bottom), (0, 0, 255), cv2.FILLED)<br><br>                # Write the detected name on the video frame<br>                # Parameters: (image, text, start position, font type, font scale, color (BGR), thickness)<br>                font = cv2.FONT_HERSHEY_DUPLEX<br>                cv2.putText(frame, name, (left + 4, bottom - 4), font, 1, (255, 255, 255), 1)<br><br>        # Display the processed video frame<br>        cv2.imshow(&#39;Video&#39;, frame)<br><br>        # Break the loop if &#39;esc&#39; is pressed<br>        if cv2.waitKey(1) &amp; 0xFF == 27:<br>            break<br><br>    # Release webcam and close OpenCV windows<br>    video_capture.release()<br>    cv2.destroyAllWindows()</pre><p><strong>5. View Attendance Logs</strong></p><ul><li><em>Voila!</em> You have the faces detected in the webcam saved in the detected_faces table and the time the faces were detected.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*zkbd5zxzuPYCrIv1u8NBww.png" /><figcaption><em>Screenshot of the </em><em>detected_faces table in MySQL.</em></figcaption></figure><h3>Why This Project Matters</h3><p>This project isn’t just a technical exercise — it’s background knowledge useful in real-world applications:</p><ul><li><strong>Virtual Classrooms</strong>: Automate attendance for teachers.</li><li><strong>Online meetings</strong>: Track attendance of employees/participants without manual input.</li><li><strong>Events</strong>: Monitor attendee check-ins seamlessly.</li><li><strong>Makeup filters: </strong>Can be used to apply filters and animations on faces in videos and images.</li></ul><p>It also demonstrates how <strong>AI-powered tools</strong> like face recognition can solve everyday problems with minimal setup.</p><h3>Final Thoughts</h3><p>Building this project was an interesting experience for me. It’s proof of how accessible technology has become — with just a few libraries and some creativity, you can build solutions that make a real impact. I look forward to becoming more versatile with recent AI trends.</p><p>If you’re interested in exploring or trying the code, check out the GitHub repository (<a href="https://github.com/OluwajobaOluwabori/AttendanceTrackingUsingFaceRecognition">link</a>). I also demonstrated how the system works in a video (<a href="https://drive.google.com/file/d/1lJCjnr4cjTGYJiiPCsWF9tTSr-9GZOKn/view?usp=drive_link">link</a>).</p><p>Let me know your thoughts in the comments — I’d love to hear how you’d improve this system!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e7a0d02502a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Predicting Churn with Spark: A Practical Guide]]></title>
            <link>https://medium.com/@oluwabori.joba/predicting-churn-with-spark-a-practical-guide-02dedd9e9664?source=rss-860423f3842b------2</link>
            <guid isPermaLink="false">https://medium.com/p/02dedd9e9664</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[churn-prediction]]></category>
            <category><![CDATA[pyspark]]></category>
            <category><![CDATA[predictive-analytics]]></category>
            <category><![CDATA[udacity]]></category>
            <dc:creator><![CDATA[Godsfavour Oluwajoba Oluwabori]]></dc:creator>
            <pubDate>Sat, 27 Jan 2024 23:16:02 GMT</pubDate>
            <atom:updated>2024-01-28T14:00:25.310Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V0hRR1l9G8XiIZWEw1N4dA.jpeg" /><figcaption>Photo from <a href="https://geekflare.com/best-listen-and-earn-sites/">geekflare</a></figcaption></figure><p>In every B2C business, there will always be instances when users stop using your service or app. This is known as churn, and it is very crucial to identify which users are at risk of churn. By accurately identifying these users before they leave and offering them discounts and incentives, companies can potentially save millions in revenue. Predicting churn rates is a critical task for data scientists and analysts who work in such customer-facing businesses. By analyzing data, potential churn risks can be identified and proactive measures can be taken to prevent it.</p><p>One of the most valuable skills that data scientists and analysts need to possess is the ability to efficiently handle large datasets. This is where Apache Spark comes in. Spark is a powerful data processing engine that enables users to manipulate and analyze massive amounts of data quickly and efficiently.</p><p><strong>Problem Statement</strong></p><p>Imagine that you are a part of the data team for Sparkify, a popular digital music service. Numerous users stream their favorite songs through the service every day. They either use the free tier, which places advertisements between the songs, or the premium subscription model, where they stream music for free, but pay a monthly flat rate. Users can upgrade, downgrade or cancel their services at any time. Therefore, it is essential to ensure that the users are satisfied with the service. Every time a user interacts with the service, such as playing songs, logging out, liking a song with a thumbs up, hearing an ad, or downgrading their service, it generates data. All these data contain valuable insights that can help to keep the users happy and assist the business in thriving. Your job as part of the data team is to predict which users are at risk of leaving either by downgrading from premium to free tier or cancelling their service altogether. If these users can be accurately identified before they leave and are offered discounts and incentives, this can potentially save millions in revenue.</p><p><strong>Project Overview</strong></p><p>The goal of this project is to accurately predict users capable of churning. The full dataset is 12GB, due to its size this could not be done locally, so an Elastic MapReduce (EMR) cluster was deployed to perform tasks in the AWS cloud and I will analyze a mini subset in the workspace. To access the full code for this project, see <a href="https://github.com/OluwajobaOluwabori/Customer-Churn-Prediction/blob/main/Capstone_Project_full.ipynb"><strong>HERE</strong></a>.</p><p><strong>Churn is a term used to describe users who cancel their subscription or downgrade from premium to a free tier and are represented by <em>1</em>. Users who continue using the service are represented by <em>0</em>.</strong></p><p>Install dependencies and set up.</p><pre>&#39;&#39;&#39;<br>Installing Apache Spark 3.3.24 with hadoop 3.0, Java 8 and Findspark in order to locate the spark in the system.<br>&#39;&#39;&#39;<br><br>!apt-get install openjdk-8-jdk-headless -qq &gt; /dev/null<br>!wget -q https://dlcdn.apache.org/spark/spark-3.3.4/spark-3.3.4-bin-hadoop3.tgz -O spark-3.3.4-bin-hadoop3.tgz<br>!tar -xvzf /content/spark-3.3.4-bin-hadoop3.tgz<br>!pip install -q findspark<br><br>&#39;&#39;&#39;<br>Setting the environment path that enables PySpark to run in this Colab environment.<br>&#39;&#39;&#39;<br><br>import os<br>os.environ[&quot;JAVA_HOME&quot;] = &quot;/usr/lib/jvm/java-8-openjdk-amd64&quot;<br>os.environ[&quot;SPARK_HOME&quot;] = &quot;/content/spark-3.3.4-bin-hadoop3&quot;<br><br>&#39;&#39;&#39;<br>Running a local spark session to test the installation.<br>&#39;&#39;&#39;<br><br>import findspark<br>findspark.init()<br>import pyspark<br>from pyspark.sql import SparkSession<br>spark = SparkSession.builder.master(&quot;local[*]&quot;).getOrCreate()</pre><h3><strong>Exploratory Data Analysis (EDA)</strong></h3><p>The section includes visualizations generated from the EDA section of the code. The full dataset consists of approximately 26,259,199 rows with 22,278 users, whereas the subset contains 286,500 rows and 226 users.</p><p>Following our definition of ‘churned users’, in the mini dataset, we have 92 churned users out of the 226 users.</p><p>The columns for both datasets are listed below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*4zbsN9IW1wwxXlBnzYtxkA.png" /><figcaption>Dataset schema</figcaption></figure><p><strong>Description of Input Data</strong></p><p><strong>artist: </strong>artist that the user was listening to.<br><strong>auth: </strong>user’s service status( Logged In, Logged Out, Guest, Cancelled). <strong>firstName</strong>: user’s first name.<br><strong>gender</strong>: user’s gender (<em>M</em> and <em>F</em>).<br><strong>lastName</strong>: user’s last name .<br><strong>length: </strong>length of session.<br><strong>level: </strong>subscription level(<em>free</em> and <em>paid</em>).<br><strong>location</strong>: user’s location.<br><strong>page:</strong> page the user was visiting when this eventgot generated. <br><strong>registration: </strong>timestamp of when the user registered on the music service platform.<strong><br>sessionId:<em> </em></strong>a unique ID assigned to a user for a single continuous period of service use.<br><strong>song: </strong>song the user listened to during the particular session.<br><strong>userAgent</strong>: agent used by the user to access the streaming service.<br><strong>registration</strong>: user’s registration timestamp.<br><strong>userId</strong>: user identifier</p><p><strong>Number of Churned Customers</strong></p><p>We have a total of 92 users that churned and 134 users still using the service, this creates a significant imbalance in the data. It’s worth noting that most of the users who have churned had premium subscriptions as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*sHf3QEDBunWGc4YzgdD9tw.png" /></figure><p><strong>Feature Engineering</strong></p><p>With the aim of understanding user behavior, additional numerical features were generated from the data.</p><p>The following features were created:</p><ol><li>songs: <em>Number of songs listened to.</em></li><li>Life_span: <em>Time spent after registration.</em></li><li>Thumbs Down and Thumbs Up: <em>Number of thumbs up and thumbs down given.</em></li><li>Level: <em>Level of User (free/paid).</em></li><li>StateIndex: <em>The location column was pre-processed and indexed.</em></li><li>Help_count: <em>Number of times the user visited the help page.</em></li><li>Downgrades and Upgrades: <em>User’s number of downgrades and upgrades</em></li><li>Playlist_no: <em>Number of songs in users’ playlist.</em></li><li>Friend_no: <em>Number of friends.</em></li></ol><p>This is a snapshot of the final dataset after preprocessing and feature engineering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*hk-28W5RoQZtpKSwm41pyQ.png" /></figure><p><strong>Visualizations</strong></p><ol><li>Distribution of pages visited/ action taken.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9wcdpUjIQEJ6hNYHHw6ZUA.png" /><figcaption>The column ‘page’ shows the activities of users. ‘NextSong’ is the most visited page.</figcaption></figure><p>2. Distribution of users by gender and churn status.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*9nZxC0H1NxNds7Z6vyJ8Sg.png" /></figure><p>3. Distribution of users by level and churn status.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*ECb_nkpibLIG5IZPvwGz8g.png" /><figcaption>We have most paid users that churned</figcaption></figure><p>4. Distribution of users by number of friends and churn status.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*jKmhFBTf620p572bx9Eo0g.png" /><figcaption>Churned users tend to have more friends than users still using our service.</figcaption></figure><p>5. Distribution of users by time spent after registration and churn status.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*mdbQ6CZXGJSZ1ataw3rtdg.png" /><figcaption>New users are susceptible to churn</figcaption></figure><p>6. Distribution of users by number of songs in playlist and churn status</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*VN0y9O2FDRrEiRZ7Q1yT5w.png" /><figcaption>Churned users tend to have more songs in their playlist</figcaption></figure><h3>Observations/Findings</h3><ol><li>Men are more likely to churn.</li><li>Paid users cancel the service and downgrade their account.</li><li>Users that churned tend to have a larger number of friends and songs in their playlist compared to active users.</li><li>New users are more likely to churn.</li></ol><h3><strong>Modeling and Evaluation</strong></h3><p>When working in a distributed environment, using raw DataFrames for training can be a bit complex. To simplify this process, we can use Assemblers to prepare our training data. The VectorAssembler module from the Spark ML library can convert numerical features into a single vector, which can then be used by machine learning models. Below is the code snippets.</p><pre>assembler = VectorAssembler(<br>    inputCols=[&#39;songs&#39;,&#39;Thumbs Down&#39;,&#39;Thumbs Up&#39;,&#39;Help_count&#39;,&#39;Downgrades&#39;,&#39;Upgrades&#39;,&#39;life_span&#39;,&#39;Playlist_no&#39;,&#39;Friend_no&#39;],<br>    outputCol=&quot;features&quot;,handleInvalid = &quot;keep&quot; )<br>output_vector = assembler.transform(features)<br><br>scaler = StandardScaler(inputCol=&#39;features&#39;, outputCol =&#39;num_vector_sc&#39;, withStd=True, withMean=True)<br>output_scaler = scaler.fit(output_vector).transform(output_vector)<br><br>final_assembler = VectorAssembler(inputCols=[&#39;num_vector_sc&#39;] + [&#39;gender&#39;,&#39;level&#39;],outputCol=&#39;new_features&#39;)<br>final_vector = final_assembler.transform(output_scaler)<br>final_vector.show()</pre><p>After using VectorAssembler and StandardScaler to transform our data, below is what we have as our final data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rhLLN8SoulfLao_s3QrxzA.png" /></figure><p><strong>Modeling</strong></p><p>The final data was split into train(80%) and test(20%) sets.</p><pre>#Splitting final data into train and test dataset<br><br>train, test = final_data.randomSplit([0.8, 0.2], 42)</pre><p>Then three classifiers were used for training on our data and predicting, namely, Logistic Regression, Random Forest and Decision Tree.</p><ol><li><strong>Logistic Regression</strong>: This method is used for binary classification and involves modelling the relationship between a dependent binary variable (such as yes/no or 1/0) and one or more independent variables by estimating the probability of the binary outcome. It is a simple and efficient method for binary and linear classification problems and is easy to understand and implement. It also performs very well when the classes are linearly separable.</li><li><strong>Random Forest: </strong>This method involves the combination of multiple decision trees to make better predictions. The model is more accurate and robust because it takes the opinions of many trees (individual models) into consideration. This technique is less prone to overfitting since the classifier won’t overfit the model due to the presence of a robust number of decision trees in a random forest.</li><li><strong>Decision Tree: </strong>A decision tree algorithm is a type of machine learning algorithm that uses a tree-like model of decisions and their possible consequences to make predictions. The algorithm works by dividing the data into subsets based on the most significant feature at each node of the tree. The purpose of a decision tree is to learn from past data and make decisions or predictions based on that learning. It helps to identify the most important features that contribute to the final decision and to understand the relationships between input variables and their outcomes.</li></ol><p>Below are the results of their evaluation metrics;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*-kN2kwvDlEUMy7jQ97-zkQ.png" /></figure><p><strong>Metrics Definition</strong></p><p><strong>F1 score</strong> is a measure of the harmonic mean of precision and recall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*aJXtrtjJi51Kfbr3TBbtVw.png" /><figcaption>Photo from <a href="https://images.app.goo.gl/RqhPnzLc2QRCxZoXA">lawtomated</a></figcaption></figure><p><strong>Accuracy</strong> is a metric that measures how often a machine learning model correctly predicts the outcome.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*DWiv71rDlfHlNO10ri-YBQ.png" /><figcaption>Photo from <a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwiki.cloudfactory.com%2Fdocs%2Fmp-wiki%2Fmetrics%2Faccuracy&amp;psig=AOvVaw2dwuytsqkXow13vAL3rX-Q&amp;ust=1706534895214000&amp;source=images&amp;cd=vfe&amp;opi=89978449&amp;ved=0CBUQjhxqFwoTCMCgnZ2YgIQDFQAAAAAdAAAAABAD">cloudfactory</a></figcaption></figure><h4><strong>Justification</strong></h4><p>For this particular classification problem, we have decided to focus on the <strong>F1 score</strong> as a performance metric instead of the commonly used <strong>Accuracy</strong>. The reason behind this decision is that the dataset we are dealing with has imbalanced classes, and Accuracy could prove to be a misleading metric in such a scenario.</p><p>After evaluating multiple models, we found that Logistic Regression has a better F1 score than other models. However, it trains the slowest among all the models we considered, which is a significant factor to consider when dealing with larger datasets. Taking this into account as we are just worked with a mini dataset, we have to be mindful of the training time as well. Therefore, we have concluded that the <strong>Decision Tree model is the best fit for this use case as it offers a reasonable F1 score and has a faster training time in comparison to Logistic Regression.</strong></p><h3>Conclusion</h3><p>In this project, we used Apache Spark to predict customer churn for a digital music service. Key findings from exploratory data analysis revealed insights into user behaviour, highlighting patterns like higher churn among new and paid users. We also discovered that certain features, such as the number of friends and songs in a user’s playlist, do not determine the duration of a user’s engagement with our service.</p><p>We evaluated three classifiers, namely Logistic Regression, Random Forest, and Decision Tree, giving priority to the F1-score due to class imbalance. Although Logistic Regression demonstrated a superior F1-score, Decision Tree was chosen as the practical option considering the training time. Despite achieving good results, our project has limitations such as a small dataset size and imbalanced classes. As a result, we suggest further research and experimentation to enhance our model and extend it to other domains.</p><p>It is recommended to conduct ongoing research and adaptability to ensure that predictive models remain effective in identifying churn risks and supporting proactive retention strategies as user behaviour and businesses continuously evolve.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02dedd9e9664" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How do I break into tech?]]></title>
            <link>https://medium.com/age-of-awareness/transitioning-into-tech-6273ee73ecfa?source=rss-860423f3842b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6273ee73ecfa</guid>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[tech-newbie]]></category>
            <category><![CDATA[career-change]]></category>
            <category><![CDATA[break-into-tech]]></category>
            <dc:creator><![CDATA[Godsfavour Oluwajoba Oluwabori]]></dc:creator>
            <pubDate>Mon, 21 Nov 2022 12:45:41 GMT</pubDate>
            <atom:updated>2023-01-15T19:04:08.578Z</atom:updated>
            <content:encoded><![CDATA[<h4>A data-driven approach to help reduce your confusion</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*s2PJpJBAC_U5mHa6EI64KA.jpeg" /></figure><p>It is common to have several questions when beginning a new career, such as: What skills do I need to learn? Do I need to further my education? How do I go about taking online courses or obtaining certifications? My transition from school to full-time tech work was a herculean task. The resources on the internet were quite overwhelming and I felt I needed a well-broken-down guide to assist me with my transition, but I couldn’t get any. Hence, the motivation for this article.</p><p>The goal of this article is to highlight the best ways to enter the IT industry and hope this will make life easier for those looking to transition as well as professionals at other levels.</p><p>I gathered data on existing developers to highlight the best ways to break into the IT industry. As <a href="https://medium.com/u/9978c5db4b55">Josh Bernhard</a> once pointed out, ‘<em>the future of what is required to move into developer roles is based on the ideas of those who are currently on the path to be leaders in the space’</em>.</p><p>I will be using data from the 2022 Stack Overflow Developer Survey to achieve this. 73,268 developers from more than 180 nations participated in this survey, sharing details about their experiences as developers, including their favorite technologies, the tools they use, and the tools they want to work with in the future.</p><p>Now, let’s use these developers’ experiences to provide answers to some of the questions that have been ringing in most of our heads for a while.</p><h3><strong>Part 1: Is my formal education enough to transition into tech?</strong></h3><p>I used the responses to ‘<em>Highest level of formal education completed</em>’ to answer this question. I figured it would be more interesting to know the highest level of formal education for current developers in their different job roles. Out of the 28 job roles presented in the StackOverflow survey, I based my analysis on the 8 most popular job roles in the industry today.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*YR3tRnUQ7ChY5EwBkXpSZQ.png" /><figcaption>Fig 1: Formal education of developers</figcaption></figure><blockquote>Here you see that developers <strong>without college degrees</strong> are beginning to dominate the tech industry these days. Clearly ranking third among the most sought-after tech jobs, and even challenging designers with master’s degrees. This is an encouraging figure, so if you do not yet have a bachelor’s degree, don’t be discouraged. This also indicates that there are several other means developers are learning how to code.</blockquote><blockquote>You shouldn’t let your education status restrict your success in tech. However, learning never stops, higher degrees increase your chances and give you a competitive advantage.</blockquote><blockquote>In contrast to other fields, the majority of data scientists and machine learning specialists have master’s degrees — more than 40% of them.</blockquote><h3>Part 2: Learning how to code</h3><p>Let’s now examine how one learns how to code. Making a choice is challenging because there are so many resources available. I explored answers to the following questions and I have provided in my <a href="https://github.com/OluwajobaOluwabori/Stackoverflow-analysis/blob/main/BreakIntoTech.ipynb">GitHub</a> an in-depth analysis, of the responses from developers from diverse fields of tech. The survey questions are:</p><ol><li><em>How did you learn to code?</em></li><li><em>What online resources do you use to learn to code?</em></li><li><em>What online resources do you use to learn to code?</em></li></ol><p>The number of people learning to code online increased from 60% to 70% in the past year. To learn how to code, one can choose to go to school, take online courses, read books, attend coding bootcamps etc.</p><blockquote>The majority of developers, as we can see, learn to code from online resources. It seems to be the trend to educate yourself outside of the university system and it is very important to take this very seriously as a beginner. We see that developers frequently use <a href="https://www.udemy.com/">Udemy</a> and<a href="https://www.coursera.org/"> Coursera</a> for online courses/certifications, technical documentation to properly learn a tool/ framework and <a href="https://stackoverflow.com/">Stack overflow</a> for quick tips and solutions to programming problems (online resources).</blockquote><blockquote>In general, online courses/certifications are a good place to start. As you learn, supplement your learning with StackOverflow and technical documentation.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*ldoFzQ56kd7AWUCrXQQHqw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*Zl8lCTWRTEjGRRarivFj4Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*oHl-ZFUds-Xo5p5siOhvkA.png" /><figcaption>Fig 2: How to learn how to code</figcaption></figure><h3><strong>Part 3: What tools and technologies do I need to learn?</strong></h3><p>In an ever-changing world of technologies, practices, and sometimes job titles, knowing what to learn first (or next) as a developer can seem a little overwhelming. For instance, as a data analyst enthusiast, you might be confused about learning R or Python, or as a front-end enthusiast, you might get confused about choosing between ReactJS or VueJS.</p><p>The questions I explored in this section are:</p><ol><li><em>Which programming, scripting, and markup languages have you done extensive development work in over the past year, and which do you want to work in over the next year?</em></li><li><em>Which database environments have you done extensive development work in over the past year, and which do you want to work in over the next year?</em></li></ol><p>Other technologies such as cloud platforms, web frameworks and web technologies can be found in this <a href="https://github.com/OluwajobaOluwabori/Stackoverflow-analysis/blob/main/BreakIntoTech.ipynb">GitHub</a> link, feel free to check them out.</p><p><strong>Note</strong>: the label ‘wanttoworkwith’, in the below chart represents the results from</p><ul><li>Developers who currently work with a language and would love to continue working with it</li><li>Developers who haven’t worked with a language and would love to pick it up.</li></ul><p><strong>Takeaways from the analysis of these questions are:</strong></p><blockquote><strong>Data Analyst:</strong> Compared to the number of people that worked with Python this year, there is a slight increase in those who want/continue to work with Python next year. Furthermore, the data shows that <strong>Python and SQL are the top 2 languages for a data analyst.</strong></blockquote><blockquote>Most of these analysts worked with MS SQL server and are looking to work/continue working with PostgreSQL. MongoDB is also a database over 30% want to venture into; this makes sense since it supports a large number of languages and application development platforms.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*PSCTzTXDXmTbNgbHEtd5xQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*5X3m7hgQkVFl8zADKZDEyw.png" /></figure><blockquote><strong>Data scientist or ML specialist: </strong>PostgreSQL remains the most wanted database both now and in the future; its popularity can be attributed to the fact that it is so widely used in companies.</blockquote><blockquote>Over 75% of Data scientists/ ML engineers have been working with Python. Rust and Redis are tools these set of engineers wants to explore next year, while none of the engineers want to work/continue working with Microsoft SQL Server; <a href="https://survey.stackoverflow.co/2022/#worked-with-vs-want-to-work-with-database-worked-want">Stackoverflow</a> shows that some MS SQL developers only have interest in working with PostgreSQL.</blockquote><blockquote>So, it would be beneficial to start learning these tools as early as possible.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*G28qxHtgQh3uudCNLfykCA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*BY67bOYN0blbMBsmzgrpAg.png" /></figure><blockquote><strong>DevOps specialist:</strong> Around 70% of DevOps specialists worked with Python in the past year. Go is one popular language these specialists want to work with in the coming year. The top 5 databases DevOps professionals worked with and want to continue using are PostgreSQL, MySQL, Redis, MongoDB and Elasticsearch, with PostgreSQL leading.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*VBUNMhv13yARZ161-973KA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*1Pig5yVEameJLgoE0rpdCA.png" /></figure><blockquote><strong>Back-end developers:</strong> PostgreSQL once again tops the chart for databases that developers currently use and want to start using. Asides from learning the conventional database management tools (e.g PostgreSQL), it is also important to learn about data structure stores like Redis, hence, the increase in interest as can be seen in the chart below.</blockquote><blockquote>JavaScript and Python are beginner-friendly languages to learn for back-end development. Around 25% of Back-end developers want to start working with Go and Rust. This could be because Go is better suited to network intensive applications and applications that need concurrency.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*fst3sJPAHN-jkVEZTaWZBg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*hREuG0NmR3xtn71XfV7dfA.png" /></figure><blockquote><strong>Front-end developers: </strong>More front-end engineers want to work/continue work with Typescript in the next year; this could be because TypeScript is a statically compiled programming language for writing clear and concise JavaScript code. It fulfills the same purpose as JavaScript and can be used for both client-side and server-side applications.</blockquote><blockquote>MySql is a database that most front-end developers worked with in the past year. However, for the most part, front-end developers do not work with databases on a daily basis.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*mpdbGvFH32TKAp8yEIu1gQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*GQETbuseuXfqukBF1Qmq7Q.png" /></figure><blockquote><strong>Full-stack developers: </strong>Just like front-end developers,there is an increase in full-stack developers wanting to work with Typescript this next year. The two most popular databases used by these developers appears to be PostgreSQL and MySQL, however a sizable number also wants to work with Redis and MongoDB.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*u4PIj3Uj64UrV4CWggFgqw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*R3yuiVaZA5GRDxSVl99BnQ.png" /></figure><p><strong>Conclusion</strong></p><p>Choosing what to learn should not be harder than actually learning languages/tools/frameworks (especially early in one’s career). Hence, if you have read thus far, I hope you feel less overwhelmed about what direction to head in. So far, we have been able to highlight some of the best ways to break into the IT industry and how to advance regardless of your level in this article.</p><p>We considered the following:</p><ol><li>The formal education of current developers and this showed that <strong>the highest level of formal education for most developers is Bachelor’s degree</strong>.</li><li>The different methods developers use to learn how to code. We saw t<strong>hat majority learnt how to code outside school and the top online platforms used are Udemy, Coursera and Codeacademy.</strong></li><li>Lastly, we looked at the top tools and technologies developers are working with and what they would love to work with in the future. This will help bring you up to date on current tools in your desired role and help you decide what tool to learn as well.</li></ol><p>The article’s insights are drawn from an analysis of the StackOverflow 2022 survey data. <strong>So, now, how will you get started in Tech and if you’ve started how will you advance in your chosen field?</strong></p><p>The article was enjoyable, I hope you agree. Awaiting your transition stories!</p><p>The source code for this analysis is available on <a href="https://github.com/OluwajobaOluwabori/Stackoverflow-analysis/blob/main/BreakIntoTech.ipynb">Github</a>. Feel free to connect with me on LinkedIn <a href="https://www.linkedin.com/in/godsfavour-oluwabori-59a72315a/">here</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6273ee73ecfa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/age-of-awareness/transitioning-into-tech-6273ee73ecfa">How do I break into tech?</a> was originally published in <a href="https://medium.com/age-of-awareness">Age of Awareness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>