Inspiration

Football, and sports in general, has always been a passion of ours. Between the two of us, we have always debated our friends and each other on which team would win against another, using our own personal reasoning to explain why. However, it has become increasingly difficult to convince our friends that our predictions were accurate, so we developed Premier Prophet to accurately predict the outcomes of matches in the English Premier League!

What it does

Put simply, our program builds a tensor flow model, using data from the Fantasy Premier League API and CSV files from https://www.football-data.co.uk/. The program runs through 200 iterations where it is fed data, and using the tensor flow module, the algorithm "guesses” which team will win based on a multitude of different factors (like previously played games, which active players are on the roster, etc). If the "guess" is considered incorrect, the algorithm learns from its mistakes and keeps "guessing" again until it makes more accurate and correct "guesses''. It eventually gives an output of a size 3 array inside a size 1 array, with each element being the probability of losing, drawing, and winning. The algorithm is executed through a GUI developed in HTML with the design done through bootstrap. The user essentially navigates through the web page(s), picks two teams using a drop-down menu, and then executes the algorithm which returns the potential outcome in the form of the aforementioned probabilities. This allows the user to make informed predictions based on a robust custom statistical model and make educated bets on specific games between two teams.

How we built it

We built Premier Prophet using a multitude of online resources in conjunction with our foundational knowledge in both HTML, python, Heroku, and Flask. HTML and CSS bootstrap were used to make the front end of the application. Nothing out of the ordinary was used to develop the front end, custom graphics and branding were made for the product but the code remains standard (we used a variety of bootstrap features such as the columns feature, navbar, etc, and HTML staples like dropdown menus and buttons). In terms of the python, we used many different modules, the highlight being tensor flow, a machine learning module by Google. To use tensor flow, we first imported different data sets (CSV and JSON files specifically) and indexed these dictionaries, and stored relevant information that we could use to teach the model what factors affect the outcomes of football games. This information was inputted until tensor flow module functions and the model was then trained until the results became accurate. Using flask, we wrote HTML code incorporating python and connected the tensor flow model to user inputs selected in the front end, all of which was published on Heroku. We made custom graphics for this project using google draw as well.

Challenges we ran into

The challenges we ran into included learning conceptual parts of the tensor flow module and syntax related issues. For example, understanding the concepts of "shapes" in terms of NumPy arrays and how tensor flow accepts NumPy arrays to train the model was something we struggled with initially. Another issue we ran into was how to connect HTML files using flask, specifically identifying the right syntax for writing the source, using the file organization required by Flask (template and style folder organization). Both of these issues were solved by working our way back from the issue and catching our mistakes in conjunction with reading documentation. However, we would be lying if we said understanding tensor flow and machine learning as a base concept wasn't difficult. It took us a while to understand how the training model works as well as the associated syntax, but just like all programming problems, we were reminded that if you stick with it, you’ll find a solution.

Accomplishments that we're proud of

We are proud to be able to develop a full neural network with accurate predictions, based on multiple variables from different data sets, all in less than 24 hours as two first-year computer science students. We learned a brand new advanced technology in ~15 hours and implemented it with success. Not only were we able to create an actual product that works on every device (mobile and web), but we were able to actually self learn machine learning concepts successfully, creating a foundation that we can build upon in the future.

What we learned

Overcoming the previous challenges taught us how to bug fix by ourselves, using documentation and resources on the internet, an important skill as there will not always be a "mentor" to help us. Additionally, we learned how to quickly read and apply content learned in the documentation, another valuable skill to have, especially since both of us are aspiring to work in CS upon graduation. Finally, we were able to truly master popular frameworks like Heroku and flask through additional experience with the technologies at Newhacks, as well as learn new ones like TensorFlow.

What's next for Premier Prophet

In the future, we hope to add predictions based on player stat lines and continue to improve the accuracy of the algorithm by adding more variables for the model to consider. For example, we tried teaching the model the effects of consecutive wins (aka how to react if a team is on a “hot streak”) but were unable to do so successfully given time constraints. Adding more variables like this for the model to consider is definitely on the to-do list for Premier Prophet. Additionally, we hope to use react.js to develop the front end instead of bootstrap and python to create an even more graphically appealing interface.

Share this project:

Updates