Inspiration

I really like soccer, but sometimes I don't have time to watch every game and I get anxious to know if my team is goint to win, so I decided to build a good pre-match analysis. Most "AI predictions" never tell you how often they are right. I wanted to build something that runs an actual statistical model on real data, proves how accurate it is, and explains the result the way a football analyst would.

What it does

MatchMind shows this week's fixtures for nine leagues, each with a quick forecast. Click any match, or pick two teams yourself, and it shows the probability of a home win, a draw and an away win, each team's expected goals and the five most likely scorelines. Gemini then writes a short preview that explains why the model favors one side and what the underdog would need to cause an upset.

It also answers the question every prediction app should: how often is it right? A backtest replays the season, predicting each past match using only the games played before it. So far it picks the correct result in 56.7% of matches, compared with 46.7% for always picking the home team, in Seria A.

How I built it

The backend is Java. A client class calls the football-data.org API for results, fixtures and team crests, and caches each league's data for 10 minutes to stay within the free tier's limit of 10 requests per minute.

The core is a Poisson model. Each team gets an attack and a defense strength relative to the league average, which gives the expected goals for each side:

Adding up the grid from 0-0 to 7-7 gives the win, draw and loss probabilities. Because the season has only just started, each team's strength is smoothed toward the league average so one unusual result doesn't dominate. The model lives in its own class, so the same code powers live predictions, the weekly fixtures and the backtest.

For the written preview, the backend sends the prediction and each team's season numbers to the Gemini API with instructions to use only that data and never invent players, injuries or news. The math stays in Java; the AI only explains it. The front end is a single HTML page with vanilla JavaScript, where the probabilities are drawn as a football pitch split into three zones.

Challenges I ran into

  • Keeping the backtest honest. A model trained on the whole season has already "seen" the results it predicts and looks far better than it is. Each match is now predicted using only matches that kicked off before it.
  • An overloaded AI. Gemini returned "503: high demand" errors in the middle of the hackathon. I added automatic retries and a fallback list of models, so the preview still appears when one model is busy, and the forecast itself never depends on the AI.
  • A prompt that echoed itself. My first prompt produced text that repeated my instructions word for word. Rewriting it for different situations made the previews much more natural.

Accomplishments that I'm proud of

Building a complete app on my own in one weekend: a real statistical model instead of asking an AI to guess, a backtest that measures it honestly against a baseline, live data from an external API, and an AI layer that only explains what the model actually found.

What I learned

How to structure a Spring Boot application into client, service and controller layers, how to protect API keys with environment variables, how Poisson models are used to predict football scores, why a backtest must never use future data, and how to design around an external service that can fail.

What's next for MatchMind

  • Deploy it online so anyone can try it.
  • Add previous seasons of data to make early-season forecasts more stable.
  • Separate home and away form, add richer stats such as shots and expected goals (xG), and use the backtest to check whether each change really improves accuracy.

Built With

Share this project:

Updates

Submission history