Inspiration

Our passion for both the NBA and soccer drove the inspiration for this project. In soccer, the use of expected goals (xG) data, which calculates the probability of each shot leading to a goal, has become a staple in televised replays and analysis. A Twitter account called The xG Philosophy link particularly caught our attention, showcasing how these insights can deepen the understanding of the game.

This inspired us to bring a similar approach to the NBA, aiming to help fans, analysts, and teams better understand the dynamics of basketball games by predicting expected points based on shot probabilities. This project has the potential to enhance game analysis in the NBA, offering a new layer of insight into player and team performances.

What it does

Our project analyzes NBA games by predicting the expected points for every shot taken. Using an AI model, it assesses various factors like the player's identity, shot type, position, streaks, etc. to calculate the probability of success of each shot. These insights are then displayed on a web platform, allowing to compare expected points with actual game outcomes for teams, quarters, and individual players. The goal is to provide a deeper understanding of game dynamics and player performance.

How we built it

We began by calling the NBA API to extract detailed shot data from games. This data formed the foundation of our project, but to improve the predictive power of our model, we performed extensive feature engineering. This process involved creating new characteristics around each shot, such as the player's streak, the type of shot, and the position on the court, which are crucial for accurately predicting the outcome.

To evaluate the effectiveness of our approach, we compared a basic statistical model without AI against two AI-based models: Logistic Regression and XGBoost. Through rigorous testing, we found that XGBoost outperformed the other models, offering superior accuracy despite its higher resource demands. We believe the enhanced performance justifies the additional computational cost.

Finally, we integrated the model's predictions into a private web platform. This platform allows users to visually explore and analyze the data, offering detailed insights into various aspects of the games, such as expected points versus actual outcomes for teams, quarters, and individual players.

Challenges we ran into

One of the primary challenges we faced was personalizing the probability of each shot for individual players. Initially, we considered using a straightforward approach that relied solely on each player’s historical performance across all shots. However, we realized that this method would not capture the nuanced differences between various types of shots or locations on the court.

To address this, we adopted a more sophisticated approach. We used a beta distribution to normalize the average performance of players and then customized the probability based on each player’s specific shot type and position on the court. This allowed us to better account for new players entering the league with limited data by leveraging generalized performance trends while adapting to their unique contexts.

Another significant challenge was incorporating player streaks and performance changes over time. We employed an "exponential decay" technique to dynamically update player streaks, which enabled us to track improvements or declines in their performance. This approach ensures that recent performances are weighted more heavily, providing a more accurate reflection of current abilities.

Accomplishments that we're proud of

This project marks our first real-world application of AI and machine learning, which is a significant milestone for us. Although it is our debut project, we drew on a solid foundation of knowledge gained throughout our university studies in software engineering. Concepts related to AI models, data analysis, and feature engineering were integral to our learning experience and have now been put into practice in this project.

We are particularly thrilled to have implemented this project in a field we are passionate about—the NBA. Being able to apply our skills to analyze and predict basketball games has been incredibly rewarding.

Looking ahead, we plan to use this model for the upcoming NBA season to evaluate its effectiveness and real-world value. We’re excited to see how well it performs in live scenarios and to further refine it based on the results we observe.

What's next for NBAxPoints

We’re excited about the future of NBAxPoints and have ambitious plans for its development. Our goal is to continue enhancing the project by automating the data analysis process and making the results publicly accessible. Inspired by similar initiatives in soccer, particularly those shared on Twitter, we envision creating a dedicated account to share our findings and insights with the broader basketball community.

This would not only provide fans and analysts with valuable information but also allow us to engage with a larger audience and gather feedback for further improvements. We’re enthusiastic about the potential to expand the project and contribute to the growing field of sports analytics.

Warning

This project can't be run only with the github code as it needs the use of databases saved in our PCs. We didn't upload them to github because they are too heavy and is not a good practice to do that.

Built With

Share this project:

Updates