With the NBA season just recently starting back up, my friends and I have been delving into countless debates and conversations over how good each team is this year. Of course, there are many opinions over who may be the one to win it all, but why rely on opinions when you can have cold hard data and facts to back you up? This was the inspiration behind ProbaBall, our NBA Probability Calculator.

What it does

ProbaBall allows users to select two teams from the NBA, one home and one away, and it will predict what probability the home team has of winning the match.

How it was built

The backend of ProbaBall was completely built in Python, with heavy use of the TensorFlow and Keras Machine Learning Libraries, as well as a good amount of data scraping from various JSON files that we found lying around the web. We parsed certain pieces of data that we believed would contribute a fair amount to the general success of a team such as their Offensive and Defensive Ratings (ORTG, DRTG), individual players' Values Over Replacement Player (VORP), number of star players and the team's previous regular season and playoff record. We assembled all our data together in arrays that could be fed to a Machine Learning model which we built using TensorFlow. All this data which we collected for over 10000 past NBA games were used to train our model so that it could recognize which factors would impact winning on its own. Once we had our model trained, we saved and loaded it our methods so that it could receive inputs from an HTML page. This was done using Flask, which facilitated the integration of Python into HTML. With the backend structured, all that was left was to use HTML, CSS, and a bit of JavaScript and Bootstrap to string it all together into a functioning, minimalistic webpage.

Challenges we ran into

At the start of this project, we both had very minimal knowledge of how to use TensorFlow and all of the concepts behind Machine Learning. It took us a lot of research, looking at example code and browsing online forums, to establish a solid understanding of what we were to do in order to get our project off the ground.

Accomplishments that we're proud of

Kevin: Personally, I am pretty proud of how much I was able to use File I/O in this project. It was always one of my favourite aspects of CS in high school and it's so satisfying to be able to use it in a more medium scale project. I'm sure that Yash and I are both also very proud of our ability to learn the TensorFlow library on the fly and be able to pick out the specific methods and modules we needed to get our project working. It was definitely well worth the effort.

Yash: I think I'm most proud of our resilience throughout this project. We faced many challenges and we were able to calmly and logically analyze them, which helped us effectively problem solve whenever we encountered a setback. We also stayed up all night working on this, putting a consistently high level of effort into making our programs perform at the level we wanted them to. We didn't ever think the task was too difficult for us, and I find that pretty cool in hindsight.

What we learned

Given the fact that neither of us had dabbled much in Machine Learning prior to this project, we were caught lacking on multiple occasions by this immense library and its contents. We had spent perhaps hours trying to debug certain errors involving the shapes of our arrays and the recurring problem of our probabilities always outputting as "1". We had to reflect on and connect what we had learned in our research about Machine Learning in order to realize and fix our mistakes. Having overcome these issues, we came to realize some fundamental concepts behind Machine Learning. 1) When using TensorFlow, doesn't matter what kind of data or how many nested arrays you have, always try wrapping it all in another big array. 2) Do not put in data that will be directly tied into the result (for example, the final scores of the game you want it to predict). TensorFlow is very will figure it out...

What's next for ProbaBall

Well, this will ProbaBall-y be on our resumes by the end of this weekend. All jokes aside, we will continue to look for ways to improve our model, whether that includes tweaking the arguments in our Neural Network Layers or finding more data points that can improve the model's accuracy. ProbaBall has only been the beginning of our experiences with Machine Learning, and we will surely take the concepts and techniques that we learned from it to create even more ambitious, precise and useful models in the future.

Built With

Share this project: