<?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 Francisco Goitia on Medium]]></title>
        <description><![CDATA[Stories by Francisco Goitia on Medium]]></description>
        <link>https://medium.com/@frgoitia?source=rss-8b33790e26d2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*i1YHOTBbmkvTYLeOIou6Mw.jpeg</url>
            <title>Stories by Francisco Goitia on Medium</title>
            <link>https://medium.com/@frgoitia?source=rss-8b33790e26d2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 19:33:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@frgoitia/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[An Attempt to Predict the NBA with a Machine Learning System Written in Python Part II]]></title>
            <link>https://medium.com/hackernoon/how-to-predict-the-nba-with-a-machine-learning-system-written-in-python-part-ii-f276b19520b9?source=rss-8b33790e26d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/f276b19520b9</guid>
            <category><![CDATA[predict-the-nba]]></category>
            <category><![CDATA[nba]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[nba-python]]></category>
            <dc:creator><![CDATA[Francisco Goitia]]></dc:creator>
            <pubDate>Tue, 05 Sep 2017 23:15:38 GMT</pubDate>
            <atom:updated>2019-04-29T10:19:09.649Z</atom:updated>
            <content:encoded><![CDATA[<p>I now want to talk about the <a href="https://hackernoon.com/tagged/model">model</a> I discussed in the <a href="https://medium.com/@frgoitia/how-to-create-your-own-machine-learning-predictive-system-in-the-nba-using-python-7189d964a371">first piece</a> in more <a href="https://hackernoon.com/tagged/technical">technical</a> terms. Better a year late than never, I suppose.</p><p>For predicting the outcome of a match I used a logistic regression model. I compared it against models based on naive bayes, neural networks, random forest and support vector machines. Every model was cross-validated and their optimal hyperparameters were found.’</p><p>The reason I sticked with a logistic regression model was that it had a prediction accuracy on par, or superior, than more complex solutions and the transparency of the model means you can use it for qualitative analysis. With logistic regression you understand what are the key features and their weight. Also, logistic regression returns probabilities that are pretty accurate and this is important to have a notion of how confident you are in your prediction.</p><h4>Features</h4><p>The model consists of the following features with their coefficients. Features were standarized before fitting the model:</p><ul><li>home court advantage: 0.10218887</li><li>effective field goal percentage difference: 0.16118265</li><li>turnover percentage difference: -0.05958713</li><li>offensive rebound percentage difference: 0.07061777</li><li>free throws to field goals attempts difference: 0.03267933</li><li>distance traveled in last 7 days difference: -0.01459163</li><li>form in last seven matches difference: 0.0828436</li><li>offensive rating difference: 0.17885523</li><li>defensive rating difference: -0.33924331</li><li>effective field goal percentage difference (court*): 0.10808104</li><li>turnover percentage difference (court*): -0.09548481</li><li>offensive rebound percentage difference (court*): 0.07055131</li><li>free throws to field goals attempts difference (court*): 0.0748545</li><li>form in last seven matches difference (court*): -0.00486437</li><li>offensive rating difference (court*): 0.14822224</li><li>defensive rating difference (court*): -0.21756487</li></ul><p>*Considering court situation means that, for example if Team A is the host and Team B is the visitor the effective field goal percentage would be: A effective field goal percentage when playing at home — B effective field goal percentage on the road)</p><p>The input of a given match would be the difference in each of these metrics between the two teams.</p><h4>Performance</h4><p>Let’s take the last Celtics ring season as an example: 2007-2008. This model would have correctly predicted 70 % of the matches.</p><p>Is this number good ? We would obviously expect a dummy model that chooses winners randomly to be correct around 50 % of the time. However, we have a better benchmark at our disposal: Vegas money lines. A model that simply predicts that Vegas’ favorite would win, would have been correct 69.8 % of the time. Considering this is what bookies do for a living, spending a lot of resources building models for setting the odds, and leveraging the power of markets, I’d argue that having a similar performance than Vegas is a great result.</p><p>Interestingly, 87.6% of the time our model picked the Vegas’ favorite, while 12.4 % it picked the underdog. 51 % of the time, it correctly predict that the underdog would in.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f276b19520b9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/how-to-predict-the-nba-with-a-machine-learning-system-written-in-python-part-ii-f276b19520b9">An Attempt to Predict the NBA with a Machine Learning System Written in Python Part II</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Brilliance of Naby Keita]]></title>
            <link>https://medium.com/@frgoitia/the-brilliance-of-naby-keita-76097146398b?source=rss-8b33790e26d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/76097146398b</guid>
            <category><![CDATA[premier-league]]></category>
            <category><![CDATA[sports]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Francisco Goitia]]></dc:creator>
            <pubDate>Wed, 05 Jul 2017 04:02:32 GMT</pubDate>
            <atom:updated>2017-07-05T21:45:41.687Z</atom:updated>
            <content:encoded><![CDATA[<p>It looks like one of the best midfielders of last season is available for around 60–80M. And it’s clear that Jurgen Klopp is willing to break Liverpool’s transfer record again to get his man. So, who is Naby Keita and why should Liverpool buy him ?</p><p>Who is Naby Keita ? He is 22 years old, guinean and plays for RB Leipzig, one of the smartest clubs in the world. What type of player is he ? Well, this is when things turn complicated. His statistical output is extremely rare, because he does so many things very well.</p><p>Let’s try to analytically arrive at Naby’s profile and find similar players. I’m crunching a database filled with the last 2 seasons from the big five leagues. What we are going to do is compare Naby’s season at Leipzig with the last 2 seasons of players that can operate at DMC, MC or AMC that played more than 1200 minutes. There are 1703 unique seasons from 1007 unique players like this.</p><h4>Performance</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*0dnW5lbi38IGa6eXuccMpA.png" /></figure><p>All stats are per 90 minutes. This is amazing. Naby is hitting around 80–95 percentile for almost every attribute we are considering. For example, his 0.28 goals per game are at the 95 percentile, which means that they were better than 95 % of the seasons in the database.</p><h4>Profile</h4><p>First, let’s try clustering midfielders’ seasons using Hierarchical Clustering based on the offensive and defensive stats showed before:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4tfLe7R6FAPHRx29-09Kxg.png" /></figure><p>As expected, Naby is clustered with different types of midfielders with a prevalence of players that had very complete seasons with good offensive and defensive stats. It’s nice to see Mahmoud Dahoud two seasons showing up: he was Liverpool’s main midfielder target last season and has now moved to Borussia Dortmund.</p><p>Our second attempt at finding similar players to Naby involves using his output as thresholds and seeing which players pass the filter. I suspect it’s going to be very difficult to find someone that was so dominant in so many aspects of the game. So, let’s start:</p><p>First attempt: Naby’s stats as thresholds ….. no player comes up !</p><p>Second attempt: let’s eliminate his ridiculously high dribbles threshold … nope !</p><p>Third attempt: now let’s relax his defensive thresholds by 50 % … nope ! .. Ok. Let’s completely relax his defensive thresholds … FINALLY !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lyzQTNG86Voqs_2fViYTYA.png" /></figure><p>Fourth attempt: Ok, so after eliminating his dribbles and defensive stats thresholds we see that only really attacking minded players had seasons with better offensive numbers than him in all these metrics. Let’s set his defensive thresholds again but relaxing 10 % his interceptions (there are at 95 percentile) and now let’s eliminate his offensive thresholds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LK5YotSxyC1fFVF3YSfUBw.png" /></figure><p>See that only row full of green ? That’s Naby. That’s pretty cool.</p><p>As we can see, Naby is a unique midfielder. There is simply no other player that has this kind of impact on both sides of the game. Liverpool has been playing 4–3–3 and in the last games 4–3–1–2. He could be amazing at DMC, MC or AMC. MC is probably the optimal position, since you are benefiting the most from his outstanding defensive and offensive contribution.</p><ul><li><a href="https://twitter.com/13nashty">Fran (@13nashty) | Twitter</a></li><li><a href="https://github.com/FranGoitia/data-science-blogging">FranGoitia/data-science-blogging</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76097146398b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to predict the NBA with a Machine Learning system written in Python]]></title>
            <link>https://medium.com/hackernoon/how-to-create-your-own-machine-learning-predictive-system-in-the-nba-using-python-7189d964a371?source=rss-8b33790e26d2------2</link>
            <guid isPermaLink="false">https://medium.com/p/7189d964a371</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[nba]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Francisco Goitia]]></dc:creator>
            <pubDate>Thu, 05 May 2016 15:58:59 GMT</pubDate>
            <atom:updated>2019-04-29T10:20:38.170Z</atom:updated>
            <content:encoded><![CDATA[<p>Which sports geek wouldn’t like to create their own system for predicting matches, be it if you want to bet or just out of intellectual curiosity ?<br>Nowadays, advanced statistics are available on websites like basketball-reference and awesome <a href="https://hackernoon.com/tagged/machine-learning">machine learning</a> libraries can be used for every programming language. This is not going to be a comprehensive DIY kind of guide, I’m just going to talk about what I found when playing with this for a few months and share some code that will be very useful for the kickoff.</p><h4>Where do I get started ?</h4><p>Machine Learning works by building models that capture weights and relationships between features from historical data and then use these models for predicting future outcomes. So, you need to understand the sport, think which variables are representative of future performance, build a database that contains this information and run Machine Learning algorithms on historical data to analytically assign weights to these variables.</p><h4>Building your own database</h4><p>I spent quite a long time building an NBA and NCAA scraper which downloads full seasons (match by match) from basketball-reference. All the problems you may stumble upon as regards relational databases are solved in my scraper and you are guaranteed to uniquely associate information.<br><a href="https://github.com/FranGoitia/basketball-reference">My scraper</a> models matches in a sophisticated json format that captures the advanced stuff that takes place in a basketball game.<br>For representing this information in your own database you will need to define a schema and insert the information. I used SQLAlchemy to write models that can be used to create the database and build an analytical system. It’s all available on my <a href="https://github.com/FranGoitia/basketball-analytics">github repo</a>.</p><h4>Predicting Matches</h4><p>Scikit-Learn is the way to go for building Machine Learning systems in <a href="https://hackernoon.com/tagged/python">Python</a>. You will need to figure out which attributes work best for predicting future matches based on historical performance. As said before, understanding the sport allows you to choose more advanced metrics like <a href="https://en.wikipedia.org/wiki/Dean_Oliver_%28statistician%29">Dean Oliver’s four factors</a>. These, combined with other human analysis (like Vegas lines for example) work best.</p><h4>Results</h4><p>If you build your own machine learning models you will find that you can correctly predict winners at a rate of around 70%. Not enough though to win money through betting, but still better than Espn experts and a lot of academic papers. You will also learn a lot about the sport, databases, machine learning and Python.</p><p><a href="https://medium.com/@frgoitia/how-to-predict-the-nba-with-a-machine-learning-system-written-in-python-part-ii-f276b19520b9">Part II</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fdde502%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2Fhackernoon%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7189d964a371" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/how-to-create-your-own-machine-learning-predictive-system-in-the-nba-using-python-7189d964a371">How to predict the NBA with a Machine Learning system written in Python</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>