<?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 Alexander Fayad on Medium]]></title>
        <description><![CDATA[Stories by Alexander Fayad on Medium]]></description>
        <link>https://medium.com/@alexfayad?source=rss-c5a8bdf36e05------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*D3Y1Jhl7gNS6h7wCO_eJpA.jpeg</url>
            <title>Stories by Alexander Fayad on Medium</title>
            <link>https://medium.com/@alexfayad?source=rss-c5a8bdf36e05------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 20:07:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alexfayad/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[The Moment I Realized I Was A Steering Wheel]]></title>
            <link>https://medium.com/swlh/the-moment-i-realized-i-was-a-steering-wheel-213090a055ed?source=rss-c5a8bdf36e05------2</link>
            <guid isPermaLink="false">https://medium.com/p/213090a055ed</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Alexander Fayad]]></dc:creator>
            <pubDate>Sun, 31 May 2026 16:51:44 GMT</pubDate>
            <atom:updated>2026-05-31T16:52:07.410Z</atom:updated>
            <content:encoded><![CDATA[<h4>And what I did about it</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*44Iiac2AqJXHT6EP.png" /><figcaption>Me being driven by Claude</figcaption></figure><p>I was working one day on a task I wasn’t especially excited about, and I felt a growing frustration that Claude kept bumping into the same problem and couldn’t solve it. I spent maybe two hours hopelessly pleading with it, trying every variation of a prompt I could think of, getting angrier and angrier as nothing worked. And then it hit me.</p><p>I had handed over my power to the AI. I had become the steering wheel while Claude did the driving, and my whole job had shrunk down to hoping and praying I’d luck into the right solution by yelling at it in different ways.</p><p>In that moment of clarity I took a step back and wrote the problem out on my whiteboard, and the simpler path was sitting right in front of me. Our codebase already supported almost the same functionality, and one small tweak would get me the same result.</p><h4>Tunnel Vision Runs Both Ways</h4><p>The problem with AI is tunnel vision. Once an obstacle has taken up enough of the context window, from all the failed attempts at getting around it, that obstacle becomes the whole world the agent can see. And what I realized standing at the whiteboard is that the same thing had happened to <em>me</em>. I had tunneled in on getting Claude to push through it, the same way Claude had tunneled in on its own broken approach, and neither of us could see the easy way around because we were both too far down the hole. The whiteboard worked because it pulled me back far enough to look at the problem holistically again.</p><h4>The Moat We Still Have</h4><p>This kind of helplessness isn’t specific to software engineering. A lot of people feel like their job is the one that’s about to be replaced by AI, and I don’t want to pretend that isn’t true for some fields. Jobs will change, some will disappear, and plenty of careers will have to adapt to the technology. But the part that won’t change is the critical thinking the work asks of you.</p><p>That critical thinking is the moat. It’s the ability to go wide instead of narrow, to step back and ask whether you’re even solving the right problem in the first place. A model needs an enormous amount of data to learn a pattern, while a person can run into a single strange situation and rethink their whole approach on the spot. We tend to take that for granted, probably because it costs us so little effort, and it also happens to be the part we haven’t figured out how to hand off to AI.</p><h4>Width and Depth</h4><figure><img alt="Thought Space of Humans vs AI | From: The AI Paradox" src="https://cdn-images-1.medium.com/max/1024/1*D0mpDsu9IcAEEk2ccggs-Q.png" /><figcaption>Thought Space of Humans vs AI | From: <a href="https://www.youtube.com/watch?v=dcolM6W5Odc">The AI Paradox</a></figcaption></figure><p>That’s really why I’m writing this. I think it’s worth questioning how you actually use these tools, and one place to start is to split every problem into two parts: the critical thinking and the rote. The goal is to spend as much of your time as possible in the first part and as little as possible in the second.</p><p>The way I think about it now, I own the <em>width</em> and the AI owns the <em>depth</em>. I do the planning and look at the whole space of options, and the AI goes deep on researching or building whatever path we land on. When we hit an obstacle, I come back to the width. I ask what other paths we could take, and I make the AI explain where things actually stand right now, because I can’t build on top of a situation I don’t understand.</p><h4>What It Looks Like in Practice</h4><p>A lawyer shouldn’t be spending hours digging for relevant cases. They should be working out the shape of the case they want and pointing an AI at that shape. A nurse shouldn’t be spending their time typing data into a computer. They should be spending it pulling the right information out of the patient, while the AI records and summarizes the rest.</p><p>In practice it comes down to a couple of small habits. Before I start working on anything complex, I try to write the problem out in my own words first, sometimes on a whiteboard, other times in a Sublime window (which never gets saved or I save as “sabhidijbaskd.txt). And when I catch the model stuck on the same wall twice, I stop and make it explain where things actually stand, because that’s usually the moment I’ve stopped thinking and started hoping.</p><h4>Who’s Actually Driving</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E4xbUVcUnd1IBAvuBzT9NA.png" /><figcaption>Yay!</figcaption></figure><p>Could an AI learn these professions and start replicating the width too? To some extent, sure, that’s how we’ve gotten this far. But a model can only really travel the paths that are well worn in the data it learned from, and a genuinely new problem doesn’t have a path yet. That’s where the obstacle always shows up. And if you’ve let the AI do the driving the whole way, that’s the moment you’ll realize you were never really steering, you were just along for the ride.</p><p><em>Originally published at </em><a href="https://alexanderfayad.substack.com/p/the-moment-i-realized-i-was-a-steering"><em>https://alexanderfayad.substack.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=213090a055ed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/the-moment-i-realized-i-was-a-steering-wheel-213090a055ed">The Moment I Realized I Was A Steering Wheel</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Algorithmic Suggestions Killed Exploration]]></title>
            <link>https://medium.com/the-ink-home/how-algorithmic-suggestions-killed-exploration-b26b7f40eb65?source=rss-c5a8bdf36e05------2</link>
            <guid isPermaLink="false">https://medium.com/p/b26b7f40eb65</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[consumer-behavior]]></category>
            <dc:creator><![CDATA[Alexander Fayad]]></dc:creator>
            <pubDate>Wed, 29 Apr 2026 22:01:01 GMT</pubDate>
            <atom:updated>2026-05-31T18:26:12.546Z</atom:updated>
            <content:encoded><![CDATA[<h4>When everything became recommended, nothing got discovered.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hTNtlN1UjDrLxmhP.jpeg" /></figure><blockquote>Algorithmic suggestions (by my own definition) <br>The idea that consumer software has deeply integrated algorithms wherever possible to encourage maximum user retention.</blockquote><h3>The Algorithm as Personality Test</h3><p>Have you ever had a friend show you a YouTube video on your computer, say it’s about mechanical keyboards, now for the next three weeks half your homepage is keyboard builds, keyboard reviews, keyboard switch sound tests. The algorithm treated the actions as a personality test.</p><p>You can read any thread online about the YouTube algorithm and it’s thousands of variations of the same story:</p><blockquote>“I play Fortnite with my kids casually. I looked up a howto a few weeks ago, and my recommendations are still 25% Fortnite related content, even though I only watched one video one time.” (<a href="https://news.ycombinator.com/item?id=25520845">source</a>)</blockquote><blockquote>“If I watch one ‘The Office’ clip, thats suddenly 60–80% of my feed despite the fact that i don’t particularly like the show.” (<a href="https://news.ycombinator.com/item?id=25516984">source</a>)</blockquote><blockquote>“My wife was having trouble sleeping and I selected a competitive Tetris match video for her as a joke. Now I can’t stop getting recommendation for all tetris-related stuff.” (<a href="https://news.ycombinator.com/item?id=25517503">source</a>)</blockquote><h3>Measurably Bad, Measurably Profitable</h3><p>This issue isn’t isolated to YouTube, even Google search has become useless for organic discovery. The tailoring of content to the user leads 2 people in the same city to see different content when Googling for the same thing. I’ve recently learned that this is especially exacerbated for news articles, highlighting left leaning news in predominantly left leaning cities, and vice versa on the opposite end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*eStR9MLjm9NdoT06.png" /><figcaption>Yes these actually happened… <a href="https://theconversation.com/eat-a-rock-a-day-put-glue-on-your-pizza-how-googles-ai-is-losing-touch-with-reality-230953">Google / The Conversation</a></figcaption></figure><p>Every result page starts with an AI summary that sometimes tells you to put glue on your pizza, followed by four ads, followed by six affiliate blog posts that look like they were algorithmically rewritten from each other, and the only actually useful hit is a Reddit thread from 2019 where someone asked your exact question and five people replied “did you ever figure this out, I’m having the same problem.”</p><p>One commenter from <a href="https://news.ycombinator.com/item?id=39032784">this HN discussion</a> nailed the new SEO economy in one sentence:</p><blockquote>Suppose you search for green goddess salad dressing. Is that recipe website the best representation of that recipe? No, and it’s not close.</blockquote><blockquote><strong>It is a measurably bad, and measurably profitable, search result.</strong></blockquote><p>Measurably bad and measurably profitable is the whole internet now.</p><h3>Infinite Catalog, Finite Output</h3><p>Spotify has 80 million songs and a shuffle button that plays the same forty songs from either your liked songs or the top 40 charts every time. You skip one, it picks another from the same forty. You add a new playlist, it recommends songs from the same forty. The catalog is infinite. The output is not.</p><p>These products were better five years ago. Every one of them decided to think for you, and every one of them is doing a worse job of it than when it was trying less. The fun has somehow been taken out of the process, which makes listening to music almost feel utilitarian; here is your “<em>working hard at the gym</em>” playlist Alex, here is your “<em>chill Sunday</em>” playlist Alex, oh are you on a road trip? here’s your “road trip laid back 70s style jams” playlist Alex. (okay I made that one up but you probably believed me anyways)</p><h3>Offloading the Act of Choosing</h3><p>So how do we unplug? How do we get back to something that feels like genuine curiosity, rather than the hollowed-out version algorithms hand back to us.</p><p>It starts, I think, with noticing how much we’ve offloaded the act of choosing. There’s a modern anxiety that barely existed ten years ago: the real, unironic frustration people feel when someone else uses their account. Not because they’re worried about privacy… they’re worried the other person will <em>mess with their algorithm</em>. That’s how far we’ve gone. We’ve internalized the recommendation engine as an extension of ourselves, and a wrong signal feels like it’s contaminating our identity.</p><h3>The Friend Test</h3><p>The clearest test of what we’ve lost is with the people closest to you. Think about how much your music taste actually overlaps with your friends’ right now. Are you even caught up on the same artists? Have you tried exploring what they’ve been listening to lately?</p><p>Now compare that to ten years ago, when everyone was showing up to the same movies, arguing about the same albums, quoting the same YouTube videos. We might still be listening to the same amount of music. We might be watching the same amount of video (or more). But we’re doing it in isolated worlds. The shared cultural air we used to share has been diluted to sensationalized topics and the one-off trend which somehow manages to break through the noise, but rarely feels as communal as it once did.</p><p>That’s what burns people out. Not the amount of content. The loneliness of it.</p><h3>How I Stopped, Mostly by Accident</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RBuYWEOqBFwr8VlM.jpeg" /><figcaption>Photography by <a href="https://www.theverge.com/2018/9/17/17870126/ios-12-screen-time-app-limits-downtime-features-how-to-use">Amelia Holowaty Krales / The Verge</a></figcaption></figure><p>The way out, for me, started by accident.</p><p>Around nine months ago I stopped opening TikTok. I didn’t quit it, I just stopped. And then a switch flipped that I can’t fully describe except to say the <em>idea</em> of opening short-form video now feels like a kind of mental nausea. Not virtue. Exhaustion. My brain put it down and refused to pick it back up.</p><p>After that the rest got easier. Instagram off the phone. Then X, which was the loudest one and took the most willpower to leave. X was a feed of AI hype and political alarm that never seemed to land at the weight it was being preached at. I’d put my phone down genuinely angry or anxious about something that, two weeks later, had just… not happened. The signal-to-stress ratio finally got bad enough that the math stopped working.</p><p>What replaced it was less than I expected and more than I needed. I started getting news from the <em>source</em> instead of from<em> </em>the <em>discourse</em> <em>around the source</em>, that’s how I ended up on Substack/Medium, finding a few writers I actually trust and going there directly instead of waiting for the algorithm to surface them. I make a conscious effort to ask my friends about what they’re reading and listening to, partly because I <em>have to</em> now but I’ve also found it much more engaging than simply being recommended content continuously.</p><p>I don’t have a clean prescription. I’m not even telling anyone to delete their apps. I’m just saying that for me, the version of curiosity that comes back when the algorithm goes quiet is a version I didn’t realize I’d been missing.</p><p>Thanks for reading! Feel free to follow me on here or on <a href="https://substack.com/@alexanderfayad">Substack</a>.</p><blockquote>This story is Published in <a href="https://medium.com/the-ink-home"><strong>The Ink Home</strong></a>.</blockquote><blockquote>A sanctuary for reflections on (<strong>Life</strong>), (<strong>Tech</strong>), (<strong>Writing</strong>), (<strong>Productivity</strong>), and (<strong>Mental Health</strong>).<br>✍️ <strong>We are welcoming new voices</strong>. Whether you are a beginner or a pro, <a href="https://medium.com/the-ink-home/newsletter"><strong>Join our Community</strong></a> to share your story.<br><strong>Let’s build a better internet, one story at a time.<br></strong>=&gt; <a href="https://farhankabir133.github.io/The-Ink-Home/">Website</a> | <a href="https://www.linkedin.com/company/the-ink-home/">Linkedin</a> | <a href="https://web.facebook.com/61582621220914">Facebook</a> | <a href="http://instagram.com/the_ink_home">Insta</a> |</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b26b7f40eb65" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-ink-home/how-algorithmic-suggestions-killed-exploration-b26b7f40eb65">How Algorithmic Suggestions Killed Exploration</a> was originally published in <a href="https://medium.com/the-ink-home">The Ink Home</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building My First Machine Learning Model | NBA Prediction Algorithm]]></title>
            <link>https://medium.com/data-science/building-my-first-machine-learning-model-nba-prediction-algorithm-dee5c5bc4cc1?source=rss-c5a8bdf36e05------2</link>
            <guid isPermaLink="false">https://medium.com/p/dee5c5bc4cc1</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[nba]]></category>
            <category><![CDATA[sports-betting]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Alexander Fayad]]></dc:creator>
            <pubDate>Thu, 09 Jul 2020 17:18:19 GMT</pubDate>
            <atom:updated>2021-11-08T16:32:32.224Z</atom:updated>
            <content:encoded><![CDATA[<h4>Merging the Worlds of Sports Analytics and Machine Learning</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WqKSUeAlBQhXitSq" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>EDIT:</strong> Since writing this article, we have launched a subscription service at <a href="https://infinitysports.ai/">https://infinitysports.ai</a> which gives access to the API and outputs of our new NBA prediction model. We are now able to predict the winner, spreads, and point totals. I have thoroughly loved working on this project, please feel free to reach out with any questions!</p><p>When I started programming a few years back, I never had a purpose for what I would use my newfound skills for. I toyed around with building video games, making basic websites, iOS applications, but in a way, I was spreading myself thin by not specializing in a certain craft. Around this time, the Toronto Raptors were on a historic playoff run, and I had just started playing around with bet365 and happened to make a good profit betting exclusively on them during the entire playoffs.</p><p>Given my background in both Commerce and Computer Science, I wanted to learn more about the role of a Quantitative Analyst and Data Scientist. I began to explore the world of data science and started by learning the basics of the Scikit-learn package given my background in python. The rest of this article is going to outline how I went from knowing next to nothing about Data Science and Machine Learning to building my first NBA prediction model with a ~72% accuracy (more on this later but the results aren’t as great as they seem).</p><h3>Table of Contents</h3><ol><li><strong>The Game Plan</strong></li><li><strong>Data Acquisition</strong></li><li><strong>Data Exploration &amp; Processing</strong></li><li><strong>Choosing the Right Model</strong></li><li><strong>Testing and Results</strong></li></ol><h3>The Game Plan</h3><p>The NBA, as well as many other sports, has seen the use of statistics exponentially grow over the last 10–20 years. I began my search on the most relevant NBA stats by reading <a href="https://watchstadium.com/which-nba-statistics-actually-translate-to-wins-07-13-2019/"><em>Which NBA Statistics Actually Translate to Wins</em></a><em> </em>by <em>Chinmay Vayda</em>. His research discovered that the best predictors of wins in the NBA were a team’s Offensive Rating, Defensive Rating, Rebound Differential, 3-Point %, among other stats, which you can read more about by following the link above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*06_joh5nIH_0beGr" /><figcaption>Photo by <a href="https://unsplash.com/@neonbrand?utm_source=medium&amp;utm_medium=referral">NeONBRAND</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I planned to use more recent data, by leveraging the NBA’s <strong>monthly</strong> statistics and using those as the predictors for the matches that were played during that <strong>month</strong>. Since this was my first attempt at building a model, I wanted to keep the data simple and keep the mathematical complexity at a minimum.</p><p>The next step was figuring out how to acquire this data. I needed a data source for match results of the last ~10 years, as well as a source for a team’s statistics in any given month.</p><h3>Data Acquisition</h3><p>For the data acquisition portion of this project, I used <a href="https://selenium-python.readthedocs.io/">Selenium</a>, a python package that facilitates web scraping, to get the data I needed off various websites. I also decided to limit my search to data beginning from the 2008–2009 season to the present.</p><h4>Past Results</h4><p>My data source for the past results was <a href="https://www.basketball-reference.com/">Basketball-Reference.com</a>, which had match results going back to 1946.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KE4c-kLua_3tufpm29T-jQ.png" /><figcaption>Screenshot of the data source on <a href="https://basketball-reference.com/">Basketball-Reference.com</a></figcaption></figure><p>Using Selenium, I scraped these tables one-by-one and converted them to CSV files for later use.</p><h4>Past Monthly Statistics</h4><p>I also needed to know what every team’s stats were for any given month, and my data source for this was the <a href="https://stats.nba.com/">official NBA Stats</a> page. After tweaking with a few filters, I ended up with the following table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tHypGRpv09uOvzkinEN4lg.png" /><figcaption>Screenshot of the data source on <a href="https://stats.nba.com/">NBA Advanced Stats</a></figcaption></figure><p>Once again, I used Selenium and scraped these monthly stats tables, and saved them as CSV files. My next step was to merge these files into one dataset.</p><h3>Data Processing &amp; Exploration</h3><h4>Data Processing</h4><p>We now had to process our 2 sets of CSV files in a format where they can be compared and analyzed. I have embedded below examples of the first 5 lines of each CSV file, exactly as they were scrapped.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/65dcab372d6b5e85ee430141bef6d209/href">https://medium.com/media/65dcab372d6b5e85ee430141bef6d209/href</a></iframe><p>The first thing we notice is that neither table has a header, which will need to be added manually by referencing the original table. Second of all, we have multiple empty columns littered in our datasets, which need to be dropped. Lastly, in our results dataset, we need to drop the <em>time column</em>, the <em>box score text</em>, and the <em>attendance numbers, </em>since they won’t be useful to us.</p><p>Following these steps, our datasets now look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/352932ade7bfd0edc68262337c582659/href">https://medium.com/media/352932ade7bfd0edc68262337c582659/href</a></iframe><p>The code below outlines how I went about merging the two CSV files, as well as adding a new column for whether Team 1 won or lost, which would become our<strong> predictor variable</strong>. I posted the code since the specifics of the merging aren’t easy to explain, but if you are interested you can take a look below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2fa8c0c0a3caba57fd94e81525038388/href">https://medium.com/media/2fa8c0c0a3caba57fd94e81525038388/href</a></iframe><p>After executing the code outlined above, our dataset now looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9a1ae50c191d43e504e6907377c83de/href">https://medium.com/media/e9a1ae50c191d43e504e6907377c83de/href</a></iframe><p>We now have our dataset, which compares each team’s stats and states which team won the encounter. At the end of this process, our dataset contains over <strong>13,000 unique matchups</strong>! This dataset is now very close to being ready for machine learning analysis.</p><p>Since I only needed the team names and scores to merge the datasets and figure out which team won, I will also get rid of those columns, and be left with a dataset that is now able to be explored and modeled for machine learning.</p><h4>Data Exploration</h4><p>Our current dataset looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9bca40876748fd4a71f2704f692576f/href">https://medium.com/media/e9bca40876748fd4a71f2704f692576f/href</a></iframe><p>I was now interested in knowing how the various statistics in our dataset correlate with one another. A friend of mine introduced me to a great python package called <a href="https://speedml.com/">Speedml</a> which simplifies the process of exploratory analysis and produces great looking plots to share your data.</p><p>When you have numerical features, it is always interesting to see how each feature in our dataset correlates to the other. The plot below illustrates our <strong>feature correlations</strong>, and it has some interesting insights that we can derive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jrLksgj5NwAkhhzbsuoodA.png" /><figcaption><strong>Speedml</strong> generated feature correlation plot</figcaption></figure><p>Firstly, we can tell that since both the top left and bottom right quadrants have the most correlated features, a team’s stats correlate strongly to itself. If a team has a high PACE, it will probably also have a high OFFRTG.</p><p>We also see that the ‘Team1Win’ feature, is not heavily correlated to any specific feature, although a few may stand out as stronger correlations than others. This leads me to create a <strong>feature importance</strong> plot, another easy to use implementation included in Speedml.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*F-EsTlELGyyb2dSSO3FNpQ.png" /><figcaption>Team stats feature importance</figcaption></figure><p>Although we do see some features with greater importance, we don’t have a clear reason to eliminate any features at this point, but it allows for some interesting observations to be made.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*XGQYkdGcVZ2bohThNJAweQ.png" /><figcaption>Strip plot for Team2NETRTG vs Team1Win</figcaption></figure><p>The reason for the high importance for Team2NETRTG can be seen in the strip plot above; when Team 2 has a <em>higher</em> Net Rating, Team 1 tends to win <em>less</em>, and on the flip side, when Team 2 has a lower Net Rating, Team 1 tends to have a higher chance of winning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*2pDO09ys2EC7TQ3qQJs9JQ.png" /><figcaption>Away team winning percentage</figcaption></figure><p>Finally, the last plot I found interesting was the distribution of <em>Team 1’s wins</em>. The way our data was acquired, Team 1 is always the away team. This distribution shows that the away team loses about ~59% of the time, which illustrates what we know as the <em>home-court advantage</em>.</p><h3>Choosing the Right Model</h3><p>I chose to use Scikit-learn, given the ease of implementation for a variety of algorithms and my experience with python. Using <a href="https://scikit-learn.org/stable/tutorial/machine_learning_map/index.html">this flowchart provided by Scikit-learn</a>, I identified a few models I would want to try out, and see which one performed the most accurately on my dataset. My attempts began as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e26c7890c47f8b158ebb26c5655f445e/href">https://medium.com/media/e26c7890c47f8b158ebb26c5655f445e/href</a></iframe><p>Out of all the models attempted, the one with the highest accuracy was the <strong>support vector machine SVC classifier</strong>, with an accuracy of 72.52% on historical data! It was now time to test this model in the real world, where I attempted predicting the outcome of 67 games, before the NBA shutting down as a result of COVID-19.</p><h3>Testing and Results</h3><p>For my first 28 game predictions, I was simply going off who was going to win, not taking into account the spread I was offered. For the remainder of my prediction, I implemented a scoring method that gave me a spread that my algorithm created, based on which team was more likely to win. My results for the algorithm accuracy were as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8c25d6a1432e45f6c46d5a410bf54f9/href">https://medium.com/media/d8c25d6a1432e45f6c46d5a410bf54f9/href</a></iframe><p>A major weakness of my algorithm is the ability to predict upsets. On the first day of running my model, in 5 out of 7 games the underdog won the match. My algorithm was typically in line with what online sports betting websites published which was a good sign. Reading online, we can see that the NBA typically has <a href="https://www.oddsshark.com/sports-betting/which-sport-do-betting-underdogs-win-most-often">an upset rate of 32.1%</a>, while my sample size had an upset rate of 40.2%.</p><p>I also wanted to attempt a <strong>financial strategy</strong> and began by simply betting on the predicted winner. But after updating my model, I implemented a money-line which I compared with the lines offered by bet365. I compared my odds to bet365’s and chose the more favorable of the two. Below we can see the results of the blind and selective strategies.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ad62bc1a8b9ec1c4308f378f16e9b15/href">https://medium.com/media/5ad62bc1a8b9ec1c4308f378f16e9b15/href</a></iframe><p>Immediately we can tell that selectiveness is a better strategy, which involves choosing the more favorable odds.</p><p>I have been waiting till the end of the article to address this, but one major flaw in this model, which took me a few months to realize, is that the data it uses is <em>biased</em>. Put simply, a team’s monthly stats are influenced directly by their performance in that month’s games, so given that I was using a given month’s stats to predict the team’s performance, the stats <strong>already included</strong> their performance in those games. This realization led me to start building my new NBA prediction model.</p><h3>Future Steps</h3><p>The reason I chose to write and release this article now is that I built this model back in January/February of 2020, and I have been working on an updated, more comprehensive model that will use an Artificial Neural Network for predicting not wins or losses, but the actual scores of each encounter. This new model will be based on the players within a team as opposed to the team as a whole. I will be writing about this journey in the coming weeks and hope to share some good news!</p><p>If you enjoyed this article or would like to discuss any of the information mentioned, you can reach out to me on <a href="https://www.linkedin.com/in/alexanderfayad/">Linkedin</a>, <a href="https://twitter.com/alexanderfayad">Twitter</a>, or by <a href="/service/mailto:alexander.fayad@queensu.ca">Email</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dee5c5bc4cc1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/building-my-first-machine-learning-model-nba-prediction-algorithm-dee5c5bc4cc1">Building My First Machine Learning Model | NBA Prediction Algorithm</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>