<?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 Ayorinde Saheed on Medium]]></title>
        <description><![CDATA[Stories by Ayorinde Saheed on Medium]]></description>
        <link>https://medium.com/@ayorindeolamilekan2003?source=rss-4d1d0d324fa7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZeucU9-62QS2vn2Z5TifCA@2x.jpeg</url>
            <title>Stories by Ayorinde Saheed on Medium</title>
            <link>https://medium.com/@ayorindeolamilekan2003?source=rss-4d1d0d324fa7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 21:49:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ayorindeolamilekan2003/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Build a No-Code Chatbot With IBM watsonx Assistant (Step by Step)]]></title>
            <link>https://medium.com/@ayorindeolamilekan2003/build-a-no-code-chatbot-with-ibm-watsonx-assistant-step-by-step-2d5b5ac8ef8b?source=rss-4d1d0d324fa7------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d5b5ac8ef8b</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ibm-watson]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Ayorinde Saheed]]></dc:creator>
            <pubDate>Mon, 23 Nov 2026 05:06:55 GMT</pubDate>
            <atom:updated>2026-11-23T05:09:38.461Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Including the bugs that broke mine and how I fixed each one.</em></p><p>I built a customer service chatbot without writing a line of code. The first test conversation went fine. Then I typed “Do you deliver to Lagos?” and it answered with a store address in Toronto.</p><p>That’s what nobody tells you about no-code chatbots: building is the easy part. Breaking it is where you learn.</p><p>Below is how I built <em>What’s on Flowers</em>, a chatbot for a fictional flower shop, with IBM watsonx Assistant. At every step, you’ll see what to build, what broke for me, and how I fixed it, so you can skip the bugs I ran into.</p><p><em>A note: IBM’s course gives you a starter flower-shop scenario. This guide covers how to build on it, plus everything I added and fixed myself.</em></p><p><strong>What you’ll need:</strong> a free IBM Cloud account (I used the free Lite plan), watsonx Assistant, and a website for Step 7 (the course lab has one). No coding.</p><h3>Step 1: Write down the questions first</h3><p>Before you open the tool, list what a customer would actually ask. Mine ended up as:</p><ul><li>Where are your stores?</li><li>What are the opening hours?</li><li>I want to gift some flowers.</li><li>Do you deliver?</li><li>Can I speak to a human?</li></ul><p>Each question becomes an <strong>action</strong> in watsonx Assistant. Give each action several example phrases, written the way people really type: “wat time do u open”, not “What are your opening hours?”</p><p><strong>Tip:</strong> ask one person outside the project, “What would you ask a flower shop?” Their questions will differ from yours.</p><p><strong>Where it broke for me:</strong> the starter scenario had no delivery question. When someone asked “Do you deliver to Lagos?”, the bot answered with a store address. I’ll show the fix in Step 4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a64N2MNFUqpt2Qs1nTxB6g.png" /><figcaption><strong>The actions in my assistant. Each customer question became one action.</strong></figcaption></figure><h3>Step 2: Build your first action</h3><p>An <strong>action</strong> is one thing your chatbot can do. Start with the simplest one: “Where are your stores?”</p><ol><li>In the left menu, choose <strong>Actions</strong>, then <strong>New action</strong>.</li></ol><p>2. Add five or six ways people might ask it: “Where are your stores?”, “where r u located”, “I want to know about the available store.”</p><p>3. Write the reply. In the box called <strong>Assistant says</strong>, type: “We have stores in Montreal, Toronto, Calgary, Kelowna, and Vancouver.”</p><p>4. Then, choose <strong>End the action</strong>.</p><p>5. Open <strong>Preview</strong>, type “Where are your stores?”, and check the reply.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NNaL0zbH978KKvdBgnGvrw.png" /><figcaption><strong>One action, one reply, shown in my Delivery action. Assistant says holds the reply. And then ends the action.</strong></figcaption></figure><p>That’s a working chatbot action. Everything else in this guide builds on it.</p><p><strong>Tip:</strong> test in Preview after every change, not at the end. A small mistake is easy to find when you’ve only changed one thing.</p><p><strong>Where it broke for me:</strong> some of my replies appeared in a grey box with strange symbols around the text. The text carried hidden code markers. To fix it, open the step’s code view (the &lt;/&gt; icon in the editor) and delete the markers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*arUUXPIw4jlt04ItaNRPJA.png" /><figcaption><strong>Before: the reply shows in a grey box with strange symbols.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x1y8-NiP18CltTuzU6PReg.png" /><figcaption><strong>The step’s code view, where the hidden markers sit around the text.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EIzsZ0NhPBMxIk5sA2GuaA.png" /><figcaption><strong>Before: the reply shows in a grey box with strange symbols.</strong></figcaption></figure><h3>Step 3: Make it remember something</h3><p>Right now, your chatbot forgets everything after each reply. A <strong>variable</strong> fixes that. It’s a small note the chatbot keeps for the whole conversation.</p><p>In the starter scenario, the store’s action already asks “Which city?” with the cities as buttons. Here’s how to make the chatbot remember the answer:</p><ol><li>Add a step after the buttons and click <strong>Set variable values</strong>.</li><li>Set a variable named <strong>City</strong> to the answer from the “Which city?” step.</li><li>In your hours action, make the “Which city?” question run only when <strong>City is not defined</strong>. That means the chatbot doesn’t know the city yet.</li><li>Open <strong>Preview</strong>, ask “Where are your stores?”, pick Toronto, then type “What are its hours?” It should answer without asking again.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EaQOQMHOdN3CIZfDMoUxRQ.png" /><figcaption><strong>The Hours action only asks “Which city?” when City isn’t set yet.</strong></figcaption></figure><p><strong>Tip:</strong> use the same variable name everywhere. “City” and “city” are two different notes.</p><p><strong>Where it broke for me:</strong> my goodbye said: “We hope to see you at our [City] store soon.” If someone said bye before choosing a city, that blank would show. I spotted it before anyone hit it. The fix was two steps. The first runs only when City is defined. The second is a backup for everyone else: “We hope to see you at one of our stores soon!”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5HyZ447DzmgYN2GtKZfuLQ.png" /><figcaption><strong>Before: the goodbye uses the City variable, with no plan for when it’s empty.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8pYdS-ZWuJmD02QSh_6dqw.png" /><figcaption>After: one step for when City is set, and a backup step for everyone else.</figcaption></figure><h3>Step 4: Plan for what you didn’t plan</h3><p>People will ask things you never built for. Give your chatbot three safety nets.</p><p><strong>Net 1: an action for a question you can predict.</strong> Create an action called <strong>Delivery</strong>, with example phrases like “Do you deliver?” and “Do you ship flowers?” Reply honestly: “Right now we offer in-store pickup at our five Canadian shops. Delivery isn’t available yet. Would you like store locations or opening hours?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SZHw99oxneWLwtRSBKSbQA.png" /><figcaption><strong>Before: “Do you deliver to Lagos?” got a Toronto store address.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tPShBD06BA_fzHs_P5Ad6g.png" /><figcaption>After: a Delivery action answers honestly.</figcaption></figure><p><strong>Net 2: A helpful “I didn’t understand” reply.</strong> In the Actions list, open <strong>No matches</strong> (it’s under <strong>Set by assistant</strong>). Replace “I’m afraid I don’t understand” with what your chatbot <em>can</em> do: “Sorry, I didn’t quite catch that. I can help with store locations, opening hours, delivery questions, and flower recommendations. Which would you like?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qWvdRzr0pXcrdCcLdTmuGA.png" /><figcaption><strong>Before: random letters got the generic “I’m afraid I don’t understand.”</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sb_EYl4JmMvhW-vm7D4XeA.png" /><figcaption><strong>After: the reply lists what the chatbot can help with.</strong></figcaption></figure><p><strong>Net 3: a fallback that doesn’t make promises (only if you have no live agent).</strong> Open <strong>Fallback</strong> from the same list. By default, it offers to connect people to an agent. Change each message to point somewhere real, such as the shop’s phone number, then set End <strong>the action</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p5MAMzYMmK-WAz8Dnqrmgg.png" /><figcaption><strong>Before: every Fallback step ends in “Connect to agent”, but there’s no agent.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*am61emQoW1I70-6XwIzNow.png" /><figcaption><strong>After: each step gives the shop’s phone number and ends the action.</strong></figcaption></figure><p><strong>Tip:</strong> type the strangest question you can think of into Preview. If the answer is silly, you’ve found your next fix.</p><p><strong>Where it broke for me:</strong> two bugs. Asking “Do you deliver to Lagos?” got the Toronto store address, because nothing covered delivery. And the default fallback offered “Connect to agent,” but I had no agent. A chatbot that promises something it can’t do is worse than one that admits it doesn’t know.</p><h3>Step 5: Test it as a stranger would</h3><p>Your own tests pass because you know what to type. Strangers don’t.</p><ol><li><strong>Run the normal path first.</strong> Say hello, ask for stores, pick a city, ask for hours, start the gift flow, say thanks, say bye. Write down anything odd.</li><li><strong>Then type badly on purpose:</strong> “wat time do u open”, a city typed instead of clicked, random letters like “asdfgh”, a question your chatbot wasn’t built for, and “Can I speak to a human?”</li><li><strong>Then hand it to people who haven’t seen it.</strong> Send the link to a few friends and say only “ask it anything.” People outside my project ran 30 conversations, and what they typed was never what I’d have typed.</li><li><strong>Keep a simple record</strong> of what you typed, what you expected, what happened, and whether you fixed it. One line per test is enough:</li></ol><ul><li>Typed “asdfgh”. Expected a polite reply. Got a generic “I don’t understand”. Fixed: it now lists what the chatbot can help with.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*05FwAh52zQZH3gf3ZSeWTg.png" /><figcaption><strong>A typo test found the old question, with the missing space after “Calgary,”.</strong></figcaption></figure><p><strong>Tip:</strong> test again after every fix. A fix can break something that worked.</p><p><strong>Where it broke for me:</strong> when I typed “wat time do u open”, the chatbot asked for a city, but with an old, slightly wrong version of the question, with a missing space after “Calgary,”. The hours action had its own copy of the “Which city?” text, and I’d only fixed the one in the stores action. If the same sentence lives in two places, you’ll update only one of them.</p><h3>Step 6: Publish it</h3><p>Everything so far lives in a draft. Preview shows the draft, but visitors only see what you <strong>publish</strong>.</p><ol><li>In the left menu, open <strong>Publish</strong>.</li><li>Review the list of changes, then click <strong>Publish</strong> and add a short note, such as “Added delivery and fallback fixes”.</li><li>Wait until the new version shows <strong>Live</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1k3V1T48X1DH4zZMM2kWXg.png" /><figcaption><strong>The Lite plan’s version limit blocked my publish until I deleted the older version.</strong></figcaption></figure><p><strong>Tip:</strong> write a note every time. After five publishes, you won’t remember which version fixed what.</p><p><strong>Where it broke for me:</strong> With two versions saved on the free Lite plan, I got “You have reached your version limit. Delete a version before you can publish new content.” The live version can’t be deleted. The fix was to delete the older one on the same page, using the bin icon, and publish again.</p><h3>Step 7: Put it on a website</h3><p>Your chatbot is published, but nobody can reach it yet. You add it to a website by pasting one small piece of code called an <strong>embed script</strong>. You don’t need to understand the code.</p><p><strong>If you have your own website:</strong></p><ol><li>In watsonx, open <strong>Integrations</strong> in the left menu, find the <strong>Web chat</strong> tile, and click <strong>Open</strong>.</li><li>In the <strong>Environment</strong> box, choose <strong>Live</strong>, then click <strong>Confirm</strong>. Live is what your visitors see. Draft shows work you haven’t published.</li><li>Click the <strong>Embed</strong> tab and use the copy icon to copy the script. Don’t change anything inside it.</li><li>Open the code of the page where you want the chat. For a simple site, that’s a file called index.html. If you use a site builder, look for an option called “custom code” or “HTML”.</li><li>Paste the script near the bottom, just above the closing &lt;/body&gt; tag, and save.</li><li>Reload the page. A chat button appears in a corner. Click it and talk to your chatbot.</li></ol><p>Here’s where the script goes:</p><pre>&lt;body&gt;<br>  ...your page...<br>  &lt;!-- paste the script here --&gt;<br>&lt;/body&gt;</pre><p>The numbers inside the script aren’t secret, so it’s safe on a public page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QI3t9hyyfm5D2L2NfWpIyA.png" /><figcaption><strong>Use the Embed tab in the Live environment. Copy the script from here.</strong></figcaption></figure><p><strong>Tip:</strong> test on a plain page first. Make a file ending in .html with a title and a sentence, paste the script, and open it in your browser. If it works there, it&#39;ll work on your site. Paste the script only once per page.</p><p><strong>If you’re in the course lab,</strong> the WordPress site already has the plugin. Open <strong>watsonx Assistant</strong>, then <strong>Customize Plugin</strong>, set a title and window size, click <strong>Save Changes</strong>, and reload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_bsBC-1GcoHIKIVRjaGWuw.png" /><figcaption><strong>In the course lab, the plugin’s Window Size setting controls the chat window.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x-u6w6yrihD3cmq_nchW9g.png" /><figcaption><strong>The chatbot on the site, on a phone. Bouquet images are from the IBM course materials.</strong></figcaption></figure><p><strong>Where it broke for me:</strong> I raised the window size to Large, and the chat covered my whole page. Switching back to Medium fixed it after I saved and hard-refreshed. That setting lives in the plugin, not in watsonx.</p><h3>Step 8: Share your work</h3><p>A chatbot nobody can see doesn’t help your portfolio. Put your build, test record, and screenshots on <strong>GitHub</strong>, a free site where developers keep and share their work. Each project lives in a <strong>repository</strong>, which is just a folder on GitHub.</p><ol><li>In watsonx, open <strong>Publish</strong> and click the download icon on your live version. You get a .json file with all your actions. It&#39;s also a backup: you can upload it into a new assistant later.</li><li>Check it before you share it. Open the file in a text editor, press Ctrl+F, and search for key, password, token and secret. Mine had none. It only held internal IDs and image links. If yours has any, delete those lines.</li><li>Create a new public repository and upload: the .json file, your screenshots, and your test record. Crop out anything personal from the screenshots, such as browser tabs, addresses and usernames.</li><li>Add a <strong>README</strong>. That’s a text file called README.md that GitHub shows as the front page of your repository. Say what the chatbot does, how it&#39;s built, what its limits are, and what came from the course.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2dySj7TCcxAevB4WnO-Jog.png" /><figcaption><strong>The repository: exported actions, screenshots, test record, and README.</strong></figcaption></figure><h3>Your checklist</h3><p>Copy this for your own build:</p><ul><li>Write down the questions customers will ask.</li><li>Build one action and test it in Preview.</li><li>Use a variable to remember something.</li><li>Add three safety nets: an action for a question you can predict, a helpful “I didn’t understand” reply, and a fallback that makes no false promises.</li><li>Test it like a stranger, then with other people</li><li>Publish it and wait for <strong>Live.</strong></li><li>Put it on a website with the embed script.</li><li>Share the build, test record, and screenshots on GitHub</li></ul><p><em>I built this after IBM’s Coursera course “Building AI Powered Chatbots Without Programming”. The shop, its addresses, and its phone numbers are fictional, and the bouquet images come from the IBM course materials. The full build and test record is on GitHub: </em><a href="https://github.com/Ayomide513/whats-on-flowers-chatbot"><em>https://github.com/Ayomide513/whats-on-flowers-chatbot</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d5b5ac8ef8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an Early-Warning System for Student Dropout Not Just a Predictor]]></title>
            <link>https://medium.com/@ayorindeolamilekan2003/building-an-early-warning-system-for-student-dropout-not-just-a-predictor-eb4cd01b8f99?source=rss-4d1d0d324fa7------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb4cd01b8f99</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Ayorinde Saheed]]></dc:creator>
            <pubDate>Mon, 31 Aug 2026 20:38:10 GMT</pubDate>
            <atom:updated>2026-08-31T20:43:04.342Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why “predicting dropout” is a deceptively easy problem to get wrong</h3><p>When I set out to build a student dropout risk predictor, my first instinct like most people’s was to throw every available feature at a model and see what stuck. Grades, attendance, family background, all of it. Get the highest accuracy possible.</p><p>That instinct is exactly how you build a <em>useless</em> early-warning system.</p><p>Here’s the problem: if you let a model see a student’s final grades to predict whether that student is at risk, you’re not predicting anything. You’re describing something that already happened. A real early-warning system has to work with what’s known <em>early n</em>ot with the benefit of hindsight.</p><p>This is the story of the design decisions behind a dropout risk predictor built for a capstone project, and why I think the decisions mattered more than the model architecture.</p><h3>The dataset</h3><p>I used the <a href="https://archive.ics.uci.edu/dataset/320/student+performance">UCI Student Performance dataset</a> (Cortez, 2008) 649 students across two Portuguese secondary schools, 33 attributes, no missing values. Specifically, I used only student-por.csv, not the companion student-mat.csv file. The two files share some of the same students across different subjects, and merging them risks duplicate records that would quietly bias both training and evaluation.</p><p>One honest limitation worth naming upfront: I originally wanted to work with Nigerian secondary-school dropout data, since that’s the context I care most about. That dataset doesn’t publicly exist. The UCI dataset was the closest available substitute it captures the same structural ingredients (attendance, grades, family background, study habits) even though the schooling system it comes from is different. I mapped the dataset’s G1/G2/G3 grading periods onto Nigeria’s First/Second/Third Term structure as a framing device, but any real deployment would need retraining on local data first.</p><h3>Defining “at-risk” and what I deliberately left out</h3><p>A student was labeled <strong>at-risk</strong> if either:</p><ul><li>Final grade (G3) &lt; 10 out of 20, <strong>or</strong></li><li>Number of past class failures ≥ 2</li></ul><p>This produced a class split of 82.6% not-at-risk to 17.4% at-risk a real but manageable imbalance.</p><p>The more interesting decision was what I <em>didn’t</em> include: <strong>absences</strong>. It would have been easy to fold attendance into the risk label directly poor attendance clearly correlates with poor outcomes. But doing that would have made the model’s later “here’s why this student is at risk” explanation partially circular: of course absences would look important if it partly <em>defined</em> risk in the first place.</p><p>Instead, I left absences out of the label entirely and let the model discover its relevance on its own, purely from the correlation between absences and the G3/failures-based label. If it showed up as meaningful, that would be a genuine, independently-earned signal not something I’d engineered in by assumption.</p><p>It did show up landing at in feature importance, discussed below.</p><h3>The early-warning constraint: G1 only</h3><p>This was the single most important modeling decision in the whole project.</p><p>The dataset includes three grading periods: G1, G2, and G3. G3 is the final grade already used to build the label, so it’s off-limits as a feature (that would be a direct data leak). But G2, the second-term grade, is available too, and including it would meaningfully boost accuracy.</p><p>I excluded it anyway.</p><p>The reasoning: if the model needs second-term grades to make a good prediction, it’s not actually an <em>early</em>-warning system it’s just a slightly-early report card. Restricting the model to G1 alone forces it to answer the question that actually matters: <strong>can we flag a student as at-risk using only what’s known a few weeks into the year?</strong></p><h3>Feature encoding: a smaller decision that still mattered</h3><p>For categorical features school, guardian, mother’s/father’s job, and others I used one-hot encoding rather than label encoding. Label encoding assigns arbitrary integers to categories (e.g., mother’s job: at_home=0, teacher=4), which implicitly tells the model that “teacher” is somehow “greater than” or “farther from” “at_home” a relationship that doesn’t exist for unordered categories. Since explainability was a core requirement of this project, I wanted feature importance rankings to reflect real relationships, not artifacts of arbitrary encoding.</p><h3>The model</h3><p>A Random Forest classifier, trained with:</p><ul><li>n_estimators=200</li><li>max_depth=8capped to reduce overfitting risk, given the dataset&#39;s modest size (519 training rows)</li><li>class_weight=&#39;balanced&#39;to prevent the model from just learning to always predict &quot;not at-risk&quot; and still scoring ~83% accuracy by doing nothing useful</li><li>An 80/20 stratified train/test split, preserving the same class ratio in both sets</li></ul><h3>Results and the number I’m not hiding</h3><p>Metric Not At-Risk At-Risk Precision 0.92 0.70 Recall 0.94 0.61 F1-score 0.93 0.65</p><p>Overall: <strong>88.5% accuracy, 0.956 ROC-AUC.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*r_hyD_h-kFrmEfD1cCQ76w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*IrwMo4Zlglrha1qgx_Z4tQ.png" /></figure><p>The ROC-AUC score is the strongest number here it means the model is excellent at <em>ranking</em> students by risk level, regardless of where you draw the line between “at-risk” and “not.” But the recall number at the default threshold 61% is the one worth sitting with. Of 23 truly at-risk students in the test set, the model missed 9.</p><p>I think it would be easy, and dishonest, to lead with the 88.5% accuracy and stop there. But accuracy is a weak metric on an imbalanced dataset a model that predicts “not at-risk” for every single student would already score 82.6% while being completely useless. The recall number is the one that actually reflects the real-world cost of this system: missing a genuinely struggling student.</p><p>In practice, this is a threshold problem, not a model problem. The default classification threshold (0.5) is conservative. Lowering it would catch more at-risk students at the cost of more false positives flagging a few more students than necessary for counselor attention. Given that the cost of <em>missing</em> a student is higher than the cost of an unnecessary check-in, that’s a reasonable trade to make in a real deployment. That’s a human policy decision sitting on top of the model, not something the model resolves on its own.</p><h3>What actually drives a prediction</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*PgAUhiWBhEWHGhjYS6cUtQ.png" /></figure><p>The top predictors, in order:</p><ol><li><strong>G1 (First-term grade)</strong> by a wide margin, validating the entire early-warning framing</li><li><strong>Failures: </strong>prior class failures</li><li><strong>School: </strong>which of the two schools the student attends</li><li><strong>Father’s education level</strong></li><li><strong>Aspiration toward higher education</strong></li><li><strong>Free time</strong></li><li><strong>Absences</strong></li></ol><p>That last one is the payoff of the earlier design decision. Absences wasn’t part of the label definition it earned its place in the top 7 purely by being predictive. That’s the difference between a model that’s been told what matters and a model that’s found out for itself.</p><h3>What I’d do differently at scale</h3><ul><li>Retrain on local (Nigerian, or region-specific) data before any real deployment the geographic mismatch is a real limitation, not a footnote</li><li>Explore threshold tuning more rigorously, rather than defaulting to 0.5</li><li>Consider a severity-tiered risk output (low/medium/high) instead of a binary flag, since real intervention decisions aren’t binary either</li></ul><h3>Closing thought</h3><p>The takeaway I’d want another builder to walk away with isn’t “use Random Forest” or “one-hot encode your categoricals” it’s that <strong>the constraints you choose to put on a model are often more important than the model itself.</strong> Deciding what the model is <em>not</em> allowed to see later-term grades, a circularly-defined label is what turned this from a grade predictor into an actual early-warning system.</p><p><em>Full code, evaluation notebook, and demo video available on Github.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb4cd01b8f99" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Used Information Theory to Find the Real Reason Employees Leave And Then Built a Model to…]]></title>
            <link>https://medium.com/@ayorindeolamilekan2003/how-i-used-information-theory-to-find-the-real-reason-employees-leave-and-then-built-a-model-to-356f81428a49?source=rss-4d1d0d324fa7------2</link>
            <guid isPermaLink="false">https://medium.com/p/356f81428a49</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Ayorinde Saheed]]></dc:creator>
            <pubDate>Sun, 14 Jun 2026 12:22:09 GMT</pubDate>
            <atom:updated>2026-06-14T12:50:41.322Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I Used Information Theory to Find the Real Reason Employees Leave And Then Built a Model to Predict It</h3><p>There is a difference between knowing what Mutual Information is and actually using it to solve a real problem.</p><p>I learned that difference the hard way.</p><p>As the Core Machine Learning Modeler for our group capstone project at the 3MTT NextGen 2026 AI/ML Cohort, I was handed two responsibilities that sat at the heart of the entire pipeline Feature Selection and Model Training. Everything the team had done before me cleaning the data, encoding the columns, splitting the sets fed directly into my hands. The pressure was real.</p><p>Here is exactly what I did, what broke, how I fixed it, and whatI found on the other side.</p><p><strong>The Problem I Was Solving</strong></p><p>Our dataset was the IBM HR Analytics Employee Attrition dataset. 1,470 employees. 45 features after preprocessing. One target: Attrition did this employee leave or not?</p><p>Before I could train a single model, I needed to answer a more fundamental question. Out of 44 features, which ones actually matter?</p><p>This is not a small question. Feeding irrelevant features into a machine learning model does not just slow it down. It actively confuses it. The model starts finding patterns in noise and calling them signal. The result is a model that performs well on training data and collapses on anything new.</p><p>I needed a method that could rank every feature by how much information it carries about whether an employee will leave. Something grounded in mathematics, not guesswork. That method was Mutual Information.</p><p><strong>What Mutual Information Actually Is</strong></p><p>Mutual Information comes from Information Theory. The formula is:</p><p>MI(X,Y) = H(Y) — H(Y|X)</p><p>Let me break that down without the jargon.</p><p>H(Y) is the entropy of our target variable Attrition. Entropy measures uncertainty. If you had no data at all and had to guess whether an employee would leave, how uncertain would you be? That uncertainty is H(Y).</p><p>H(Y|X) is the conditional entropy how uncertain you are about Attrition after you already know the value of feature X.</p><p>The difference between the two is Mutual Information. It measures how much knowing a feature reduces your uncertainty about the target.A high MI score means the feature is carrying real signal about whether someone will leave. A low score means it is mostly noise.</p><p>I implemented this using mutual_info_classif from scikit-learn’s feature_selection module, computed it against all 44 features, and stored the results in a DataFrame called mi_data sorted in <br>descending order.</p><p>Simple enough. Except I made a mistake that took me a while <br>to catch.</p><p><strong>The Bug That Taught Me More Than the Lecture Did</strong></p><p>I ran mutual_info_classif on the scaled dataset after StandardScaler had already been applied to normalize the features. The scores came back wrong.</p><p>OverTime, which had shown the strongest visual relationship with attrition in our EDA charts, was not ranking where I expected it to. The numbers felt off. Something was not adding up.</p><p>I stopped. I went back to the documentation. I compared the scores from the scaled and unscaled versions of the data side by side. That is when it clicked.</p><p>Mutual Information measures statistical dependency. It is asking how much two variables share information with each other. StandardScaler changes the scale of the values but it does not change the relationships between them in theory. But in practice, applying scaling before MI computation was introducing subtle distortions into the scores because MI is sensitive to the distribution of values, not just their relative order.</p><p>The fix was straightforward. I reordered the pipeline to compute Mutual Information on the original feature matrix X before StandardScaler was applied.</p><p>The scores immediately aligned with what we had seen visually. OverTime ranked first. MonthlyIncome second. TotalWorkingYears third.</p><p>The lesson was not just technical. It was about understanding what each tool actually does under the hood not just how to call the function.</p><p><strong>What the Scores Revealed</strong></p><p>Here are the top 5 drivers of employee attrition our Mutual Information analysis identified:</p><p><strong>OverTime: 0.0404</strong><br>The strongest predictor by a significant margin. Approximately 1 in 3 employees who worked overtime left the company compared to 1 in 9 who did not. This was not surprising after our EDA but seeing it formally quantified was striking. OverTime is not just a feature. It is a management problem hiding inside a column of data.</p><p><strong>MonthlyIncome: 0.0343</strong><br>Lower paid employees leave significantly more. The relationship between compensation and retention is direct and measurable.</p><p><strong>TotalWorkingYears: 0.0279</strong><br>Less experienced employees show higher attrition rates. The earlier someone is in their career the more likely they are to explore other options.</p><p><strong>MaritalStatus_Married: 0.0212</strong><br>Marital status influences how employees weigh stability against pportunity. Married employees showed lower attrition rates.</p><p><strong>Age: 0.0208</strong><br>Younger employees are more likely to leave. Their median age in the attrition group was around 32 compared to 37 for those who stayed.</p><p>Every one of these findings aligned with what the EDA had shown us visually. That alignment gave me confidence that the analysis was correct and that the pipeline was working as intended.</p><p><strong>Building the Models</strong></p><p>With feature selection done, I moved to Model Training.</p><p>I defined three classification algorithms Logistic Regression, Decision Tree, and Random Forest and wrapped all three strictly inside a Stratified K-Fold Cross Validation structure with 5 folds using cross_val_score from scikit-learn.</p><p>Stratified K-Fold was not optional here. Our dataset had a serious class imbalance 83.9% of employees stayed and only 16.1% left. Without stratification, some folds could end up with very few or even zero minority class examples. The model would train on a distorted version of reality and the evaluation scores would be meaninglessly inflated.</p><p>Stratified K-Fold ensures that every fold maintains the exact same 83.9%/16.1% split as the original dataset. Every training run sees a fair and representative sample of both classes.</p><p><strong>Here is what each model achieved across all 5 folds:</strong></p><p>Logistic Regression: 88.8% mean accuracy<br>Random Forest : 86.2% mean accuracy<br>Decision Tree: 78.3% mean accuracy</p><p>Logistic Regression came out on top and it was not close. The model is well suited to this type of binary classification problem especially after proper feature scaling and encoding had been applied upstream.</p><p>I passed all three model definitions to my teammate Adeyemi who built the Voting Ensemble and ran GridSearchCV tuning on top of them. The best parameters found for Logistic Regression were C=0.1, solver=liblinear, and penalty=l2 pushing accuracy from 88.8% to 89.5%.</p><p>Final test accuracy on the held-out set: 86.4%.Recall for employees who left: 34%.</p><p>That recall number is the one that matters most. Out of every 10 employees who actually resigned, our model caught only 3 of them and missed 7. In an HR context those 7 are people who walked out the door while the model stayed silent.</p><p>This is the core challenge of imbalanced classification. A model can be highly accurate overall while completely failing the minority class the exact group you built it to catch. Recall is the metric that exposes that failure and it is the metric that should drive every future improvement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t_AU4B2Mt3rrJg_SXM46ig.png" /></figure><p><strong>What I Would Do Differently</strong></p><p>If I were to rebuild this pipeline today I would apply SMOTE Synthetic Minority Oversampling Technique before training to synthetically generate more minority class examples and give the model a better chance of learning to detect at-risk employees.</p><p>I would also explore ensemble methods beyond Hard Voting specifically Stacking, where a meta-model learns how to combine the predictions of the base models more intelligently than a simple majority vote.</p><p>And I would push deeper into the emotionally adaptive question my tutor raised during our presentation how do we build models that do not just predict behavior but understand the human context behind it? That question pointed me toward NLP and emotionally intelligent systems and it is the direction I am heading next.</p><p><strong>Final Thoughts</strong></p><p>Feature Selection and Model Training sit at the core of any machine learning pipeline. Getting them right is not just about calling the right functions. It is about understanding what each tool is doing mathematically and why the order of operations matters.</p><p>The bug I encountered with Mutual Information taught me more than any lecture on the topic ever could. The model results taught me that performance metrics only tell part of the story. And the tutor’s question reminded me that the most interesting problems in machine learning are still the ones we have not fully solved.</p><p><strong>More building ahead.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=356f81428a49" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Transformers Actually Work: A Deep Dive into the Attention Mechanism]]></title>
            <link>https://medium.com/@ayorindeolamilekan2003/how-transformers-actually-work-a-deep-dive-into-the-attention-mechanism-725e7cba1913?source=rss-4d1d0d324fa7------2</link>
            <guid isPermaLink="false">https://medium.com/p/725e7cba1913</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <dc:creator><![CDATA[Ayorinde Saheed]]></dc:creator>
            <pubDate>Mon, 18 May 2026 10:51:09 GMT</pubDate>
            <atom:updated>2026-05-18T10:52:56.942Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*flPK__uPFaYzcwosA9WBrQ.png" /></figure><h3>The problem that started it all</h3><p>Before Transformers, sequence modeling was dominated by Recurrent Neural Networks (RNNs) and their variants LSTMs and GRUs. These architectures processed sequences token by token, maintaining a hidden state that was updated at each step. The idea was that this hidden state would carry context forward through the sequence.</p><p>It worked but it had a fundamental weakness.</p><p>By the time an RNN processed a long sentence, the information from the early tokens had been compressed, diluted, and partially lost through successive hidden state updates. This is the vanishing gradient problem in practice: the further a token is from the current position, the weaker its influence on the model’s output. For tasks requiring long-range dependencies, RNNs consistently struggled.</p><p>There was also a structural problem: sequential processing meant no parallelization. Each token had to wait for the previous one to be processed.</p><p><strong>The 2017 paper <em>Attention Is All You Need </em>by Vaswani et al.</strong> proposed a radical solution, abandon recurrence entirely. Replace it with a mechanism that could directly model relationships between any two tokens in a sequence, regardless of their distance. That mechanism is self-attention.</p><h3>What self-attention actually does</h3><p>At its core, self-attention allows every token in a sequence to attend to every other token simultaneously. Rather than relying on a sequential hidden state to carry context, self-attention computes a weighted representation of the entire sequence for each token in parallel.</p><p>The intuition is this: when processing a token, the model asks, <em>“</em><strong><em>which other tokens in this sequence are most relevant to understanding me?”</em></strong> The answer is computed dynamically, based on the content of the tokens themselves not their position.</p><h3>Query, Key, and Value: the core abstraction</h3><p>The self-attention mechanism is built around three learned linear projections of the input: the Query (Q), the Key (K), and the Value (V) matrices.</p><p>Query: The token seeking information. <em>“What am I looking for?”</em></p><p>Key: Tokens being evaluated. <em>“What do I represent?”</em></p><p>Value: Information to retrieve. <em>“What do I carry?”</em></p><p>The separation of Key and Value is deliberate. A token’s Key determines whether it gets attended to. Its Value determines what gets retrieved if it does. These are two distinct things, and keeping them separate gives the model more expressiveness.</p><h3>Scaled Dot-Product Attention: the mechanics</h3><p>The attention computation proceeds in four steps.</p><p><strong>Step 1: </strong>Compute attention scores: The dot product of Q and K measures relevance between each query and key: scores = QKᵀ</p><p><strong>Step 2: </strong>Scale: Divide by √d_k to prevent vanishing gradients from large dot products: scaled = QKᵀ / √d_k</p><p><strong>Step 3:</strong> SoftMax: Convert scores to a probability distribution row-wise: weights = SoftMax(QKᵀ / √d_k)</p><p><strong>Step 4: </strong>Weighted sum over Values: The full formula: Attention(Q, K, V) = SoftMax(QKᵀ / √d_k) · V</p><h3>The optional mask</h3><p>In decoder architectures, a causal mask is applied between the Scale and SoftMax steps. It prevents each token from attending to future tokens setting their scores to negative infinity before SoftMax, zeroing out their attention weights.</p><p>Encoder-only models like BERT skip this every token attends to every other token bidirectionally. Decoder-only models like GPT apply causal masking throughout.</p><h3>Multi-Head Attention</h3><p>The full Transformer runs several self-attention operations in parallel each with its own learned Q, K, V projections. Each <strong>“head”</strong> operates in a lower-dimensional subspace and can learn to attend to different relationship types simultaneously: syntactic dependencies, semantic similarity, coreference, and more.</p><p>Outputs from all heads are concatenated and projected back to the original dimensionality. Multi-head attention is what gives the Transformer its representational richness multiple perspectives on token relationships computed at once.</p><h3>Why this matters for modern LLMs</h3><p>Every major language model today GPT-4, Claude, Gemini, LLaMA is built on Transformer architecture. Self-attention is the mechanism that makes them work. Its properties map directly to the capabilities we observe:</p><p><strong>Long-range dependencies: </strong>Any two tokens attend directly no information bottleneck.</p><p><strong>Parallelization: </strong>The entire computation is a matrix multiplication runs across all tokens at once.</p><p><strong>Contextual representations: </strong>“Bank” in “river bank” vs “bank account” produces different representations.</p><p><strong>Scalability: </strong>The architecture scales cleanly the empirical foundation behind LLM scaling laws.</p><p>Self-attention is not just a technical detail inside Transformer architecture. It is the central idea the mechanism that replaced recurrence and enabled the current generation of language models.</p><p>Understanding it at this levelthe matrix operations, the scaling, the masking, the multi-head extension gives you a precise mental model of what these models are actually computing when they process text. The deeper you understand the architecture, the more intentional your work with it becomes.</p><p><em>Reference: Vaswani, A., et al. (2017). Attention Is All You Need.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=725e7cba1913" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Sentiment Analysis Model with LSTMs: What the Textbooks Don’t Tell You]]></title>
            <link>https://medium.com/@ayorindeolamilekan2003/building-a-sentiment-analysis-model-with-lstms-what-the-textbooks-dont-tell-you-95e46a4239f0?source=rss-4d1d0d324fa7------2</link>
            <guid isPermaLink="false">https://medium.com/p/95e46a4239f0</guid>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[sentiment-analysis]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[naturallanguageprocessing]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Ayorinde Saheed]]></dc:creator>
            <pubDate>Thu, 16 Apr 2026 10:47:41 GMT</pubDate>
            <atom:updated>2026-04-16T10:47:41.462Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Sentiment analysis is one of the most practical applications of Natural Language Processing. The ability to automatically determine whether a piece of text carries positive, negative, or neutral emotion has real world applicationsfrom brand monitoring to product feedback analysis to mental health detection.</p><p>In this article I’ll walk through how I built a sentiment classifier using an LSTM neural network trained on 100,000 tweets from the Sentiment140 dataset. I’ll cover the theory, the implementation, the bugs I hit along the way, and what the results actually mean. This isn’t just a tutorial it’s an honest account of the process, including the parts that didn’t work.</p><h3>Why LSTMs and Not Standard RNNs?</h3><p>Before writing a single line of code, it’s worth understanding why LSTMs are the right tool for this job.</p><p>Standard RNNs process sequences by maintaining a hidden state that gets updated at each timestep. The problem is that during training, gradients have to travel backwards through every timestep via Backpropagation Through Time (BPTT). Each step involves multiplying gradients by weight matrices, and when those weights are small, the gradients shrink exponentially. By the time they reach the earlier timesteps they’ve essentially vanished and the model stops learning from early parts of the sequence. This is the vanishing gradient problem.</p><p>For sentiment analysis this matters a lot. Consider this sentence:</p><p><em>“The movie started off really slow and the acting in the first half was terrible but by the end it was actually quite good.”</em></p><p>The overall sentiment is positive, but that conclusion depends on connecting information from the beginning and the end of the sentence. A standard RNN would struggle to make that connection. An LSTM handles it naturally.</p><p>LSTMs solve the vanishing gradient problem by introducing a <strong>cell state </strong>a dedicated memory track that runs through the entire sequence alongside the hidden state. Unlike the hidden state, the cell state is updated through addition rather than repeated multiplication, which means gradients can flow back through it without shrinking. Three gates control what gets written to, read from, and erased from this memory:</p><ul><li>The <strong>forget gate</strong> decides what to discard from long-term memory</li><li>The <strong>input gate</strong> decides what new information to store</li><li>The <strong>output gate</strong> decides what to pass forward as the hidden state</li></ul><p>This gated architecture is what makes LSTMs capable of learning dependencies across hundreds of timesteps something standard RNNs simply cannot do reliably.</p><h3>The Dataset</h3><p>I used the <strong>Sentiment140 dataset </strong>1.6 million tweets labeled as either positive or negative. The dataset is perfectly balanced with 800,000 tweets per class, which is ideal for binary classification. To keep training fast without sacrificing too much signal, I sampled 100,000 tweets 50,000 negative and 50,000 positive.</p><h3>Preprocessing</h3><p>Raw tweets are messy. They contain URLs, mentions, punctuation, numbers, and a lot of words that carry no sentiment signal. Preprocessing involved three steps:</p><p><strong>Text Cleaning</strong> I converted all text to lowercase, removed URLs, removed mentions, and stripped out everything that wasn’t a letter or a space using regex.</p><p><strong>Stopword Removal</strong> Common words like “the”, “is”, “a”, and “in” appear everywhere but contribute nothing to sentiment. I removed them using NLTK’s English stopwords list. One important caveat aggressive stopword removal can sometimes destroy meaning, especially with negations like “not happy.” For this project the impact was minimal, but it’s worth keeping in mind for more nuanced tasks.</p><p><strong>Tokenization and Padding</strong> Neural networks can’t read words they need numbers. I used Keras’ Tokenizer to build a vocabulary of 10,000 words and convert each tweet into a sequence of word indices. After tokenization, sequences needed to be the same length to be fed into the model in batches, so I applied padding.</p><p>This is where I hit my first major problem.</p><h3>The Bug That Kept the Model at 50% Accuracy</h3><p>For a long time the model refused to learn. Every epoch returned exactly 50% accuracy the model was literally just guessing. After ruling out class imbalance and tokenization issues, I ran a simple diagnostic on the sequence lengths:</p><pre>lengths = [len(seq) for seq in sequences]<br>print(&quot;Average length:&quot;, np.mean(lengths))<br>print(&quot;Max length:&quot;, np.max(lengths))</pre><p><strong>The output was revealing:</strong></p><pre>Average length: 7.16<br>Max length: 30</pre><p>After stopword removal, the average tweet was only 7 words long. But I had set <strong>MAX_LEN</strong> to 50 meaning 85% of every input sequence was just zeros. The model had almost no real signal to learn from. It was essentially training on empty inputs.</p><p>Reducing <strong>MAX_LEN</strong> from 50 to 30 fixed everything immediately. The lesson here is simple but important always inspect your actual sequence lengths before deciding on a padding length. Don’t just pick an arbitrary number.</p><h3>The Model Architecture</h3><p>The final model was built using the Keras Sequential API with four layers:</p><p><strong>Embedding Layer</strong> Converts word indices into dense vectors of size 64. Rather than treating words as isolated numbers, the embedding layer learns a meaningful geometric representation for each word during training words with similar meanings end up close together in the embedding space.</p><p><strong>LSTM Layer</strong> 64 units. This is where the sequence learning happens. The LSTM processes the tweet word by word, maintaining its cell state and hidden state across each timestep, capturing the sentiment patterns that build up across the sequence.</p><p><strong>Dropout Layer</strong> A dropout rate of 0.5 randomly switches off 50% of neurons during each training step. This prevents the model from memorizing the training data and forces it to learn more generalized patterns crucial for improving performance on unseen data.</p><p><strong>Dense Output Layer</strong> A single neuron with a sigmoid activation function. Sigmoid squashes the output to a value between 0 and 1 anything above 0.5 is classified as positive, anything below as negative.</p><h3>Training</h3><p>The model was compiled with the Adam optimizer and binary crossentropy loss the standard setup for binary classification. Training ran for 5 epochs with a batch size of 128, using 10% of the training data as a validation set.</p><p>The results across epochs told a clear story:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TaThrzUe9RO8pxqvynVqHw.png" /></figure><p>Training accuracy climbed steadily while validation accuracy stabilized around 75–76%. The widening gap between the two from epoch 3 onwards indicates mild overfitting the model started fitting the training data a little too closely. However the validation accuracy remaining stable rather than dropping sharply tells us the model is still generalizing well.</p><h3>Evaluation Results</h3><p>The model was evaluated on 20,000 unseen tweets using four metrics:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ifN2ojc7Rw2YeakBuYkhYw.png" /></figure><p><strong>Accuracy</strong> tells us the model got 75% of predictions right overall.</p><p><strong>Precision</strong> of 74.9% means that when the model predicted a tweet was positive, it was correct almost 75% of the time. This matters in applications where false positives are costly.</p><p><strong>Recall</strong> of 75.9% means the model successfully identified 75.9% of all genuinely positive tweets. High recall is important when missing a positive case has consequences.</p><p><strong>F1 Score</strong> of 75.4% is the harmonic mean of precision and recall. Because both metrics are close to each other, the F1 score confirms the model is not biased towards either over-predicting or under-predicting positive sentiment.</p><p>The classification report showed near-identical performance on both the Negative and Positive classes a direct result of having a balanced dataset. This is important because on imbalanced datasets, a model can achieve high accuracy simply by always predicting the majority class while completely ignoring the minority. Our balanced setup ensured that didn’t happen here.</p><h3>What I Would Do Differently</h3><p><strong>Pre-trained embeddings </strong>Instead of training the embedding layer from scratch, using GloVe or Word2Vec embeddings pre-trained on billions of words would give the model a much richer starting representation. This alone could push accuracy past 80%.</p><p><strong>More data</strong> We used 100,000 out of 1.6 million available tweets. Training on the full dataset would expose the model to a much wider range of language patterns.</p><p><strong>Bidirectional LSTM </strong>A standard LSTM only reads sequences forward. A Bidirectional LSTM reads both forward and backward, giving it fuller context at each timestep.</p><h3>Conclusion</h3><p>Building this model from scratch reinforced something important understanding your data is just as critical as understanding your architecture. The biggest breakthrough in this project didn’t come from changing the model, it came from a two-line diagnostic that revealed the real problem.</p><p>75% accuracy on raw tweet data is a solid baseline. Tweets are short, noisy, sarcastic, and full of informal language that makes sentiment detection genuinely hard. The LSTM handled it well, and the balanced performance across both classes confirms the model learned real patterns rather than shortcuts.</p><p>The next step is experimenting with pre-trained embeddings and a Bidirectional LSTM to see how far the accuracy can go.</p><p><strong>If you found this useful or have questions about the implementation, feel free to connect with me on LinkedIn or drop a comment below.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95e46a4239f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Number That Embarrassed Me]]></title>
            <link>https://medium.com/@ayorindeolamilekan2003/the-number-that-embarrassed-me-68940320ac47?source=rss-4d1d0d324fa7------2</link>
            <guid isPermaLink="false">https://medium.com/p/68940320ac47</guid>
            <category><![CDATA[mental-health]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[business]]></category>
            <dc:creator><![CDATA[Ayorinde Saheed]]></dc:creator>
            <pubDate>Sat, 21 Mar 2026 05:08:29 GMT</pubDate>
            <atom:updated>2026-03-21T05:08:29.246Z</atom:updated>
            <content:encoded><![CDATA[<p>And why I published it anyway</p><p>I remember the exact moment I almost deleted everything.</p><p>It was late. My screen was the only light in the room. I had been staring at the same metric for twenty minutes F1 score: 0.65 and something in me wanted to close the laptop, walk away, and pretend the last few months hadn’t happened.</p><p>I didn’t delete it. But I came close.</p><p>This is the story of what I built, why it almost stayed hidden, and what changed when I finally let it go.</p><p>It Started With a Question I Couldn’t Shake</p><p>I work in AI and machine learning. I’ve built models, trained pipelines, tuned hyperparameters more times than I can count. But for a long time, the things I built felt distant from the things that actually mattered.</p><p>Then one day I started thinking about students.</p><p>Not students in a dataset. Real students the ones sitting in classrooms, scrolling through their phones at midnight, sleeping four hours and calling it fine. The ones who are quietly struggling but don’t have the words for it, or the courage to say them out loud.</p><p>Mental health support in most institutions is either overwhelmed or nonexistent. A student has to be visibly falling apart before anyone notices. And by then, it’s often too late for a gentle intervention.</p><p>I kept asking myself one question: what if a machine could notice first?</p><p>Not as a replacement for human care. Not as a diagnosis. Just as a signal a quiet tap on the shoulder that says, hey, pay attention to yourself.</p><p>That question wouldn’t leave me alone. So I stopped waiting and started building.</p><p>Three Inputs. One Output. A Lot of Complexity in Between.</p><p>The model I built is, at its core, a classification system. A student answers three questions about their daily behavior how much they sleep, how often they exercise, how many hours they spend on social media. The model takes those inputs, processes them, and returns a depression risk score, a risk level, and a personalized set of recommendations.</p><p>Simple on the surface. Painful underneath.</p><p>I trained it on data from over 100,000 students. I deployed it on Streamlit so any student with a phone and internet could use it. I watched it output results like Depression Risk: 29.6%. Risk Level: Low. Status: Healthy and genuinely felt something.</p><p>But between the first line of code and that deployed app was a stretch of months where nothing worked the way I expected.</p><p>The Part Nobody Tells You About Building for Real People</p><p>Here is what they teach you in machine learning: maximize your metrics. Here is what they don’t teach you: what to do when the problem you’re solving refuses to be measured cleanly.</p><p>Depression is not a clean dataset.</p><p>A student sleeping five hours a night might be grinding on a project they love or quietly falling apart. A student on social media for ten hours a day might be building community or drowning in comparison. The same numbers can mean completely different things depending on the human behind them.</p><p>Every time I improved precision, recall dropped. Every time I adjusted the threshold, I introduced false negatives and in a domain where missing a real case has real consequences, every false negative felt personal.</p><p>I tried different models. I reengineered features. I read psychology research I had no business reading at 1am. I got on forums. I went back to my data. I questioned whether I was even the right person to build this. And after all of that, the model settled at 0.65.</p><p>0.65 is not a bad F1 score for a problem this complex. I know that now. But at the time, all I could see was the gap between where I was and where I thought I needed to be. I had seen papers with 0.91. I had seen Kaggle notebooks boasting 0.88. My 0.65 felt like an admission of inadequacy.</p><p>So I kept it off my portfolio. I didn’t talk about it. I told myself I’d publish once it was better.</p><p>Weeks passed. The model sat on my computer, finished and unshared, helping nobody. Then a thought hit me that I haven’t been able to shake since</p><p>A perfect model that never ships helps no one. A deployed imperfect model can change a student’s day.</p><p>I opened my laptop. I pushed it live. I shared the link.</p><p>What Happened After I Shipped It</p><p>Nothing dramatic. No viral moment. No flood of messages.</p><p>But the app was out there. Real students could use it. And something in me settled a quiet kind of peace that comes not from achieving something perfect, but from doing something real.</p><p>I started seeing the 0.65 differently. It wasn’t a ceiling. It was a starting point with receipts. It was proof that I had built something, deployed something, and was honest enough to show the actual numbers. That honesty, I’ve come to believe, is worth more than a polished score that nobody can verify.</p><p>What I’m Still Building</p><p>The work isn’t done. It never is.</p><p>I’m currently expanding the feature set to include academic pressure, social connectedness, and access to mental health resources factors that matter enormously in the Nigerian student context, where the pressures are distinct and the support systems are thin.</p><p>I’m also thinking about how mental health data from Western research doesn’t always transfer cleanly to African student realities. A model trained on American college students might miss things that are obvious to anyone who grew up in Lagos or Kano. That gap matters, and I intend to close it.</p><p>The F1 score will improve. But even at 0.65, somewhere right now, a student is reading their result and deciding to sleep an extra hour tonight.</p><p>That is not nothing. That is everything.</p><p>What I Want You to Take From This</p><p>If you are building something that matters something imperfect, something incomplete, something that embarrasses you a little when you look at the metrics I want you to hear this</p><p>The world does not need another model that lives in a notebook.</p><p>It needs the thing you are afraid to publish. Ship it. Improve it openly. Let people use it while it’s still becoming what it needs to be. The most important version of your work is the one that’s actually running.</p><p>The app is live. Try it here → https://mental-health-chatbot–xxxxx.streamlit.app/</p><p>For educational and screening purposes only.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*HNWdJwuGMow8Fk5q_TYrBw@2x.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*ogVHhwJeMtnPL-uYkYWHpA@2x.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68940320ac47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kicking Off My First AI Project with BERT and FastAPI]]></title>
            <link>https://medium.com/@ayorindeolamilekan2003/kicking-off-my-first-ai-project-with-bert-and-fastapi-5cc208bc13d3?source=rss-4d1d0d324fa7------2</link>
            <guid isPermaLink="false">https://medium.com/p/5cc208bc13d3</guid>
            <dc:creator><![CDATA[Ayorinde Saheed]]></dc:creator>
            <pubDate>Fri, 03 Oct 2025 08:38:12 GMT</pubDate>
            <atom:updated>2025-10-03T08:38:12.155Z</atom:updated>
            <content:encoded><![CDATA[<p>As we all know, the rise of <strong>Generative AI</strong> has transformed how content is created. From essays and research papers to articles and marketing, AI models are now producing text that often looks indistinguishable from human writing.</p><p>This has created new opportunities but also a challenge for <strong>schools, researchers, and organizations</strong>: <em>how can we tell if a text was written by a human or an AI?</em></p><h3>My Journey into Data Science</h3><p>A year ago, after graduating, I made the decision to pivot into <strong>data science</strong>, with a special focus on <strong>Large Language Models (LLMs) and Generative AI</strong>.</p><p>Seven months ago, I started my classes at <strong>App Click Technology</strong>, and last month I successfully completed them. The training gave me a strong foundation in Python, SQL, machine learning, and NLP and now it’s time to put that knowledge into action.</p><h3>The Dataset: AI vs Human Text</h3><p>For my first personal project, I chose the <strong>AI vs Human Text Dataset</strong> on Kaggle. This dataset includes a massive collection of text samples written by both humans and AI, labeled clearly for classification.</p><p>It’s the perfect resource for building and testing models that can distinguish between the two.</p><h3>My Approach</h3><p>I’ll be using:</p><p><strong>BERT</strong>: A transformer-based model designed for natural language processing. I plan to fine-tune it on the dataset to classify text as either “AI” or “Human.”</p><p><strong>FastAPI</strong>: Once trained, I’ll deploy my model with FastAPI so that anyone can interact with it through a simple web interface. This will make my project practical and accessible.</p><h3>Why This Matters</h3><p>This project is more than a learning exercise it has real-world value. Tools like this could help:</p><p><strong>Schools and universities</strong> ensure academic integrity</p><p><strong>Researchers</strong> study how generative AI compares with human writing</p><p><strong>Organizations</strong> verify authenticity in reports or online content</p><h3>What’s Next</h3><p>In the coming weeks, I’ll:</p><ul><li>Explore and preprocess the dataset</li><li>Train and fine-tune BERT</li><li>Evaluate results and share insights</li><li>Deploy the model as a FastAPI application</li></ul><p>I’ll also be sharing updates as I go, including lessons learned, challenges faced, and outcomes achieved.</p><h3>Final Thoughts</h3><p>This project marks the beginning of my journey into real-world AI applications. It combines my background in analysis with modern AI tools and I’m excited to see where it leads.</p><p>Stay tuned for updates, and feel free to connect if you’d like to follow along or collaborate.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5cc208bc13d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Predicting Smartphone Price Categories with Machine Learning]]></title>
            <link>https://medium.com/@ayorindeolamilekan2003/predicting-smartphone-price-categories-with-machine-learning-184f0e048d32?source=rss-4d1d0d324fa7------2</link>
            <guid isPermaLink="false">https://medium.com/p/184f0e048d32</guid>
            <dc:creator><![CDATA[Ayorinde Saheed]]></dc:creator>
            <pubDate>Wed, 20 Aug 2025 11:18:29 GMT</pubDate>
            <atom:updated>2025-08-20T11:19:12.179Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><p>As part of my work with <strong>App click</strong>, a new and ambitious smartphone company, I set out to answer a critical question:<br> <em>Can we predict the price category of a smartphone based on its technical specifications?</em></p><p>Price is one of the most important factors in the smartphone market. A wrong pricing decision could mean lost customers, weak competitiveness, or missed profit margins. To support smarter decision-making, I built a <strong>supervised machine learning model</strong> that classifies smartphones into four price categories:</p><ul><li><strong>0 → Low Cost</strong></li><li><strong>1 → Medium Cost</strong></li><li><strong>2 → High Cost</strong></li><li><strong>3 → Very High Cost</strong></li></ul><p>The dataset, obtained from Kaggle, included 2000 smartphones with 20 numerical and binary features like RAM, battery power, screen resolution, and connectivity options.</p><p>My goal was to develop a model that is not only <strong>accurate</strong> but also <strong>interpretable</strong>, so the business team can use the insights in product design and marketing.</p><p><strong>Exploratory Data Analysis (EDA)</strong></p><p>Before modeling, I explored the dataset to understand its structure and patterns:</p><ul><li>The dataset had <strong>no missing values</strong>, making preprocessing straightforward.</li><li>The <strong>target variable (</strong><strong>price_range)</strong> was perfectly balanced across all four categories (500 samples each). This ensured that class imbalance would not bias model evaluation.</li></ul><h3>Key Findings:</h3><ul><li><strong>RAM</strong> showed the strongest positive correlation with price range. Higher RAM almost always means a higher price.</li><li><strong>Battery power</strong> and <strong>screen resolution (px_height, px_width)</strong> also influenced pricing, but with some overlaps across categories.</li><li><strong>Binary features</strong> like Bluetooth or dual SIM were weak predictors — they are expected features, not differentiators.</li><li>Outliers existed (e.g., very high-resolution phones), but they represented real premium devices rather than errors.</li></ul><p><strong>Insight for App click</strong>: Customers perceive <strong>RAM, display quality, and battery life</strong> as the core indicators of phone value. These should be emphasized when positioning devices in different price ranges.</p><h3>Preprocessing</h3><ul><li>I split the dataset into <strong>80% training and 20% testing</strong>, ensuring stratification to preserve class balance.</li><li>I applied <strong>Standard Scaler</strong> to normalize the features, which was particularly important for algorithms like Logistic Regression and SVM.</li><li>Tree-based models (like Random Forest) are scale-invariant, but for consistency I used the scaled data across all models.</li></ul><h3>Model Development</h3><p>I trained three baseline models for comparison:</p><ol><li><strong>Logistic Regression</strong> → simple, interpretable baseline.</li><li><strong>Random Forest</strong> → ensemble of decision trees, robust and powerful.</li><li><strong>Support Vector Machine (RBF kernel)</strong> → captures complex, non-linear boundaries.</li></ol><h3>Model Evaluation</h3><p>I evaluated models using <strong>macro F1-score</strong>, classification reports, and confusion matrices.</p><p><strong>Results Summary:</strong></p><ul><li><strong>Logistic Regression</strong>: Decent baseline, but weaker performance. Struggled with higher categories.</li><li><strong>Random Forest</strong>: Strong performance, achieved the <strong>highest F1-score</strong> with balanced predictions.</li><li><strong>SVM (RBF)</strong>: Competitive with Random Forest, much stronger than Logistic Regression.</li></ul><p>Misclassifications were most common between <strong>neighboring categories</strong> (e.g., medium vs high cost), which makes sense since specs often overlap.</p><h3>Model Interpretation</h3><p>To make the model explainable, I extracted <strong>feature importance</strong> from the Random Forest:</p><ul><li><strong>RAM</strong> → #1 predictor by a wide margin.</li><li><strong>Battery power</strong> and <strong>screen resolution</strong> → key secondary factors.</li><li><strong>Internal memory</strong> → moderate influence.</li><li><strong>4G support, touch screen</strong> → contribute but less decisive.</li><li><strong>Bluetooth, dual SIM, etc.</strong> → weak predictors.</li></ul><p><strong>Top Business Insights for App click</strong>:</p><ol><li><strong>RAM drives perceived value</strong> upgrading RAM is the most direct way to shift a phone into a higher price segment.</li><li><strong>Battery &amp; display quality differentiate tiers</strong> critical for marketing mid- and high-end phones.</li><li><strong>Standard features (4G, Bluetooth, dual SIM)</strong> are expected, but don’t justify higher pricing.</li></ol><h3>Final Recommendation</h3><p>Among the models tested, <strong>Random Forest</strong> is my recommended choice for App click’s prototype pricing engine.</p><ul><li>It delivered the best F1-score.</li><li>It handles feature interactions well.</li><li>It provides feature importance, making results interpretable for the business team.</li></ul><h3>Business Impact</h3><p>This model can help App click:</p><ul><li><strong>Design competitively priced devices</strong> by identifying which specs matter most.</li><li><strong>Support marketing</strong> with clear messages around RAM, battery, and display.</li><li><strong>Avoid under- or over-pricing</strong> new smartphones, ensuring strong competitiveness in the market.</li></ul><h3><strong>Conclusion</strong></h3><p>This project demonstrated the power of <strong>supervised learning</strong> in solving real-world business problems. By linking technical specifications to pricing categories, App click can make more informed decisions in both product design and market positioning.</p><p>The journey highlighted a key lesson: while many features exist in modern phones, <strong>a few critical specifications truly drive value perception</strong> and focusing on those is essential for success in the competitive smartphone market.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=184f0e048d32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clustering High School Students: Uncovering Hidden Personas Through Social Media Interests]]></title>
            <link>https://medium.com/@ayorindeolamilekan2003/clustering-high-school-students-uncovering-hidden-personas-through-social-media-interests-3baea7815283?source=rss-4d1d0d324fa7------2</link>
            <guid isPermaLink="false">https://medium.com/p/3baea7815283</guid>
            <dc:creator><![CDATA[Ayorinde Saheed]]></dc:creator>
            <pubDate>Tue, 19 Aug 2025 15:06:02 GMT</pubDate>
            <atom:updated>2025-08-19T15:17:25.943Z</atom:updated>
            <content:encoded><![CDATA[<h4>An unsupervised learning approach to student segmentation for Edulytics</h4><h3>Introduction</h3><p>When I started this project, I wanted to answer a simple but powerful question:<br> <em>Can we discover hidden groups of high school students by analyzing their online interests?</em></p><p>Using a dataset of 15,000 student social media profiles (2006–2009), I applied <strong>unsupervised learning</strong> to cluster students into meaningful personas. These clusters combine <strong>demographics</strong> (age, gender, number of friends) with <strong>self-reported interests</strong> (music, sports, religion, fashion, etc.).</p><p>For Edulytics, an ed-tech startup that helps schools understand their students, this analysis shows how clustering can reveal patterns that support targeted programs, counseling, and engagement strategies.</p><h3>Data Preparation</h3><p>The dataset contained:</p><ul><li><strong>Demographics:</strong> grade year, gender, age, and number of friends.</li><li><strong>Interests:</strong> 37 columns representing frequency of keywords (e.g., <em>music, shopping, football, god, band</em>).</li></ul><h3>Cleaning Missing Values</h3><ul><li>Age: filled missing values with the median per graduation year.</li><li>Gender: filled missing values with the mode gender per graduation year. Then encoded (Female = 0, Male = 1).</li></ul><p>This preserved realistic age/gender distributions while avoiding data loss.</p><h3>Scaling</h3><p>Since variables like Number of Friends were heavily skewed, I applied a <strong>log transformation</strong> and scaled all features with a Standard Scaler before clustering.</p><h3>Exploratory Data Analysis</h3><p>Before clustering, I explored the dataset:</p><ul><li><strong>Graduation Year:</strong> evenly distributed across 2006–2009 cohorts.</li><li><strong>Age:</strong> mostly 16–19 years old.</li><li><strong>Gender:</strong> majority female, with an imbalance to keep in mind.</li><li><strong>Top Interests:</strong> the most common terms were <em>music, dance, god, shopping, band, basketball, mall, and football.</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*EzA39ksnG_lPpnNsX0BLsA.png" /></figure><h3>Clustering</h3><p>I experimented with three clustering algorithms:</p><ul><li><strong>K Means:</strong> Tested multiple values of k, using the elbow method and silhouette score. The best separation was found at <strong>7 clusters</strong>.</li><li><strong>DBSCAN:</strong> Struggled due to density differences; some clusters merged or vanished.</li><li><strong>Agglomerative Clustering:</strong> Worked, but created less balanced splits.</li></ul><p>👉 I selected <strong>K Means (k=7)</strong> as the final model because it produced stable, interpretable groups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/1*X44Jt5Dxlxf81mqb_uNdXA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*NtExGiihPd9wExvQfBl8AA.png" /></figure><h3>Visualization</h3><p>To visualize clusters, I reduced features to a <strong>3D PCA space</strong>. Each point represents a student, colored by cluster assignment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*K7kFPHcoczkhgHLR61bijg.png" /></figure><p>The plot shows clusters forming distinct groups, though some overlap occurs expected in human behavior data.</p><h3>Cluster Profiles</h3><p>After clustering, I combined <strong>demographics</strong> with <strong>top interests</strong> to create student personas.</p><h3>Cluster 0 — Romantic Group</h3><ul><li>Mostly female (84%), age ~17.2, moderate social activity.</li><li>Interest: <em>relationships (“kissed”)</em>.</li><li>Persona: Teens focused on relationships, moderately social.</li></ul><h3>Cluster 1 — Sports-Oriented Students</h3><ul><li>Age ~17, 26% male (most gender-balanced), socially active.</li><li>Interests: <em>basketball, football, softball, music.</em></li><li>Persona: Active, sports-driven students balancing athletics with mainstream music.</li></ul><h3>Cluster 2 — Older, Quieter Music/Religion Group</h3><ul><li>Age ~18.3, 79% female, less connected.</li><li>Interests: <em>music, god, band, dance.</em></li><li>Persona: Older, quieter teens with religious and artistic leanings.</li></ul><h3>Cluster 3 — Highly Social Lifestyle-Oriented Girl</h3><ul><li>Age ~17.1, 96% female, very social.</li><li>Interests: <em>dance, music, shopping, appearance (cute).</em></li><li>Persona: Social, lifestyle-driven, expressive teenage girls.</li></ul><h3>Cluster 4 — Younger Religious/Appearance Group</h3><ul><li>Age ~16.3 (youngest), 83% female, fewer connections.</li><li>Interests: <em>music, god, dance, hair, band.</em></li><li>Persona: Younger students balancing faith, music, and early lifestyle interests.</li></ul><h3>Cluster 5 — Religious and Musical Group</h3><ul><li>Age ~17, mostly female.</li><li>Interests: <em>church, god, music, dance, band.</em></li><li>Persona: Faith-oriented students active in church and music.</li></ul><h3>Cluster 6 — Outlier/Edgy Subgroup</h3><ul><li>Age ~18.1, all female, very connected.</li><li>Interests: <em>blonde, sex, hair, god, death.</em></li><li>Persona: Edgy/explicit subgroup likely niche or data noise.</li></ul><h3>Cluster 7 — Fashion- and Brand-Driven Group</h3><ul><li>Age ~17, 92% female, socially active.</li><li>Interests: <em>Hollister, Abercrombie, hair, music, and shopping.</em></li><li>Persona: Trendsetters, brand-conscious, socially engaged teens.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*K7kFPHcoczkhgHLR61bijg.png" /></figure><h3>Insights for Educators</h3><p>The clusters reveal <strong>actionable insights</strong>:</p><ul><li><strong>Sports cluster (1):</strong> Strengthen athletics programs and mentoring.</li><li><strong>Religious/music clusters (2, 4, 5):</strong> Support faith-based clubs, choirs, and band activities.</li><li><strong>Lifestyle/fashion clusters (3, 7):</strong> Provide creative outlets like talent shows, fashion clubs, and leadership roles.</li><li><strong>Romantic cluster (0):</strong> Counseling programs addressing relationships and social development.</li><li><strong>Outlier cluster (6):</strong> Monitor for at-risk behaviors, provide digital literacy and wellness support.</li></ul><h3>Conclusion</h3><p>Through unsupervised learning, I uncovered <strong>7 distinct student personas</strong> from high school social media data. These groups reflect real cultural, lifestyle, and social differences, and they offer schools a way to better understand and support their students.</p><p>Clustering proved to be not just a technical exercise but a bridge to meaningful insights that can guide <strong>education policy, counseling, and engagement strategies</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3baea7815283" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Predicting Heart Disease with Logistic Regression: Step by Step (with Code & Explanation)]]></title>
            <link>https://medium.com/@ayorindeolamilekan2003/predicting-heart-disease-with-logistic-regression-step-by-step-with-code-explanation-4418b144df67?source=rss-4d1d0d324fa7------2</link>
            <guid isPermaLink="false">https://medium.com/p/4418b144df67</guid>
            <category><![CDATA[machine-learning-python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Ayorinde Saheed]]></dc:creator>
            <pubDate>Tue, 05 Aug 2025 15:57:03 GMT</pubDate>
            <atom:updated>2026-04-14T06:19:07.323Z</atom:updated>
            <content:encoded><![CDATA[<h3>Predicting Heart Disease with Logistic Regression: Step by Step (with Code &amp; Explanation)</h3><h3>By [AYORINDE SAHEED]</h3><p><em>A practical machine learning project focused on safety, not just accuracy</em></p><h3>Why Heart Disease?</h3><p>Heart disease is one of the leading causes of death worldwide. Early detection can save lives. With machine learning, we can build models that assist healthcare professionals by <strong>flagging high-risk patients early</strong>.</p><p>In this project, I used <strong>Logistic Regression</strong> to predict whether a patient is likely to develop heart disease, focusing on <strong>recall</strong> to reduce the number of missed cases.</p><h4>Step 1: Understanding the Problem</h4><p>We’re working with a <strong>binary classification</strong> problem:</p><ul><li>0 → No heart disease</li><li>1 → Has heart disease</li></ul><p>But here’s the catch:<br> <strong>Accuracy isn’t enough.</strong><br> If a model predicts 90% accuracy but misses half the sick patients, it’s dangerous. That’s why we focus on <strong>recall</strong> (especially for class 1).</p><h3>Step 2: Dataset</h3><p>I used a cleaned version of the <strong>UCI Heart Disease dataset</strong>, which includes features like:</p><ul><li>Age</li><li>Sex</li><li>Chest pain type</li><li>Blood pressure</li><li>Cholesterol</li><li>Fasting blood sugar</li><li>Maximum heart rate</li></ul><h3>Step 3: Preprocessing</h3><p>We:</p><ul><li>Handled missing values (if any)</li><li>Encoded categorical features</li><li>Used Robust Scaler to scale the data (outlier-resistant)</li></ul><pre>from sklearn.preprocessing import RobustScaler</pre><pre>scaler = RobustScaler()<br>scaler.fit(X_train)</pre><pre>X_train = pd.DataFrame(scaler.transform(X_train), columns=X_train.columns)<br>X_test = pd.DataFrame(scaler.transform(X_test), columns=X_test.columns)</pre><h3>Step 4: Model Training</h3><pre>from sklearn.linear_model import LogisticRegression</pre><pre>log_model = LogisticRegression()<br>log_model.fit(X_train, y_train)</pre><p>A simple, interpretable model perfect for healthcare use.</p><h3>Step 5: Evaluation</h3><h3>Classification Report (Test Set):</h3><pre>Precision (YES): 0.80  <br>Recall (YES):    0.90  <br>F1-Score (YES):  0.84  <br>Accuracy:        82%</pre><h3>Confusion Matrices:</h3><p><strong>Training</strong></p><p>Predicted: NO</p><p>Predicted: YES</p><p><strong>Actual: NO</strong> 264 43</p><p><strong>Actual: YES</strong> 46 335</p><p><strong>Test</strong></p><p>Predicted: NO</p><p>Predicted: YES</p><p><strong>Actual: NO</strong> 74 29</p><p><strong>Actual: YES</strong> 13 114</p><p><strong>Takeaway</strong>: The model correctly identified ~90% of the patients with heart disease in the test set. That’s a <strong>recall score of 0.898, </strong>which is the metric that matters most in this case.</p><h3>Step 6: Cross-Validation</h3><p>To ensure robustness, I used <strong>5-fold cross-validation</strong> on the training set.</p><pre>From sklearn.model_selection import cross_val_score</pre><pre>scores = cross_val_score(log_model, X_train, y_train, cv=5, scoring=&#39;recall&#39;)<br>print(&quot;Recall scores:&quot;, scores)<br>print(&quot;Average recall:&quot;, scores.mean())Result:</pre><pre>Recall scores: [0.88, 0.89, 0.80, 0.82, 0.89]<br>Average recall: 86.1%</pre><p>This confirms the model is <strong>not overfitting</strong> and performs consistently across different folds.</p><h3>Final Thoughts</h3><h3>What went well:</h3><ul><li>High recall on test set (~90%)</li><li>Stable performance across folds</li><li>Robust scaling helped with outliers.</li></ul><h3>Let’s Connect.</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4418b144df67" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>