{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# La Liga Score Predictor Demo\n", "\n", "This notebook shows the simplest way to load the public model bundle and run a prediction from team names plus match date.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from la_liga_score_predictor import LaLigaScorePredictor\n", "\n", "predictor = LaLigaScorePredictor.from_defaults(dataset_csv_path='sample_history.csv')\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "result = predictor.predict_match(\n", " home_team='Athletic',\n", " away_team='Osasuna',\n", " match_date='2026-04-21',\n", ")\n", "result\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Batch Example\n", "\n", "You can also loop through `sample_fixtures.csv` or your own fixture list and write the outputs to a CSV.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import csv\n", "from pathlib import Path\n", "\n", "rows = []\n", "with Path('sample_fixtures.csv').open(newline='', encoding='utf-8') as src:\n", " reader = csv.DictReader(src)\n", " for row in reader:\n", " prediction = predictor.predict_match(\n", " home_team=row['home_team'],\n", " away_team=row['away_team'],\n", " match_date=row['match_date'],\n", " )\n", " rows.append({\n", " 'home_team': row['home_team'],\n", " 'away_team': row['away_team'],\n", " 'match_date': row['match_date'],\n", " 'predicted_score': prediction['predicted_score'],\n", " 'home_win': prediction['result_probabilities']['home_win'],\n", " 'draw': prediction['result_probabilities']['draw'],\n", " 'away_win': prediction['result_probabilities']['away_win'],\n", " 'confidence_level': prediction['confidence_level'],\n", " })\n", "rows\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.10" } }, "nbformat": 4, "nbformat_minor": 5 }