{ "metadata": { "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.3-final" }, "orig_nbformat": 2, "kernelspec": { "name": "python38364bit88793c7347b34f2aaf15ee9ecb7c5f7a", "display_name": "Python 3.8.3 64-bit" } }, "nbformat": 4, "nbformat_minor": 2, "cells": [ { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "from tqdm.notebook import tqdm\n", "import matplotlib.pyplot as plt\n", "\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [], "source": [ "from xgboost import XGBClassifier\n", "from sklearn.metrics import brier_score_loss, roc_auc_score\n", "from sklearn.model_selection import train_test_split, GridSearchCV\n", "from sklearn.calibration import CalibratedClassifierCV\n", "from scikitplot.metrics import plot_calibration_curve" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [], "source": [ "import warnings\n", "warnings.filterwarnings('ignore', category=pd.io.pytables.PerformanceWarning)" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [], "source": [ "import os\n", "data_dir = os.getcwd() + '/data/wy_scout/'" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": " game_id competition_id season_id game_date home_team_id \\\n54 2057984 28 10078 2018-06-17 15:00:00 3148 \n55 2057979 28 10078 2018-06-17 12:00:00 16871 \n56 2057973 28 10078 2018-06-16 19:00:00 9598 \n57 2057967 28 10078 2018-06-16 16:00:00 15594 \n58 2057972 28 10078 2018-06-16 13:00:00 12274 \n59 2057966 28 10078 2018-06-16 10:00:00 4418 \n60 2057960 28 10078 2018-06-15 18:00:00 9905 \n61 2057961 28 10078 2018-06-15 15:00:00 16216 \n62 2057955 28 10078 2018-06-15 12:00:00 16129 \n63 2057954 28 10078 2018-06-14 15:00:00 14358 \n\n away_team_id \n54 15473 \n55 17322 \n56 16823 \n57 7712 \n58 7839 \n59 8493 \n60 1598 \n61 10840 \n62 15670 \n63 16521 ", "text/html": "
\n | game_id | \ncompetition_id | \nseason_id | \ngame_date | \nhome_team_id | \naway_team_id | \n
---|---|---|---|---|---|---|
54 | \n2057984 | \n28 | \n10078 | \n2018-06-17 15:00:00 | \n3148 | \n15473 | \n
55 | \n2057979 | \n28 | \n10078 | \n2018-06-17 12:00:00 | \n16871 | \n17322 | \n
56 | \n2057973 | \n28 | \n10078 | \n2018-06-16 19:00:00 | \n9598 | \n16823 | \n
57 | \n2057967 | \n28 | \n10078 | \n2018-06-16 16:00:00 | \n15594 | \n7712 | \n
58 | \n2057972 | \n28 | \n10078 | \n2018-06-16 13:00:00 | \n12274 | \n7839 | \n
59 | \n2057966 | \n28 | \n10078 | \n2018-06-16 10:00:00 | \n4418 | \n8493 | \n
60 | \n2057960 | \n28 | \n10078 | \n2018-06-15 18:00:00 | \n9905 | \n1598 | \n
61 | \n2057961 | \n28 | \n10078 | \n2018-06-15 15:00:00 | \n16216 | \n10840 | \n
62 | \n2057955 | \n28 | \n10078 | \n2018-06-15 12:00:00 | \n16129 | \n15670 | \n
63 | \n2057954 | \n28 | \n10078 | \n2018-06-14 15:00:00 | \n14358 | \n16521 | \n
\n | type_pass_a0 | \ntype_cross_a0 | \ntype_throw_in_a0 | \ntype_freekick_crossed_a0 | \ntype_freekick_short_a0 | \ntype_corner_crossed_a0 | \ntype_corner_short_a0 | \ntype_take_on_a0 | \ntype_foul_a0 | \ntype_tackle_a0 | \n... | \nend_angle_to_goal_a0 | \nend_dist_to_goal_a1 | \nend_angle_to_goal_a1 | \nend_dist_to_goal_a2 | \nend_angle_to_goal_a2 | \nteam_1 | \nteam_2 | \ntime_delta_1 | \ntime_delta_2 | \ngame_id | \n
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
80969 | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nTrue | \n... | \n0.088083 | \n46.801607 | \n0.160512 | \n38.019553 | \n0.107520 | \nTrue | \nTrue | \n3.724954 | \n5.269374 | \n2057954 | \n
80970 | \nTrue | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \n... | \n0.313155 | \n46.379806 | \n0.088083 | \n46.801607 | \n0.160512 | \nTrue | \nTrue | \n1.175848 | \n4.900802 | \n2057954 | \n
80971 | \nTrue | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \n... | \n0.163867 | \n37.524973 | \n0.313155 | \n46.379806 | \n0.088083 | \nTrue | \nTrue | \n1.412850 | \n2.588698 | \n2057954 | \n
80972 | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \n... | \n0.284537 | \n50.020077 | \n0.163867 | \n37.524973 | \n0.313155 | \nTrue | \nTrue | \n1.416485 | \n2.829335 | \n2057954 | \n
80973 | \nTrue | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \n... | \n0.485553 | \n33.913609 | \n0.284537 | \n50.020077 | \n0.163867 | \nTrue | \nTrue | \n1.416484 | \n2.832969 | \n2057954 | \n
80974 | \nTrue | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \n... | \n0.532102 | \n32.055017 | \n0.485553 | \n33.913609 | \n0.284537 | \nTrue | \nTrue | \n2.531683 | \n3.948167 | \n2057954 | \n
80975 | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nTrue | \n... | \n0.108906 | \n83.021503 | \n0.164555 | \n78.096249 | \n0.192750 | \nFalse | \nFalse | \n2.483783 | \n5.015466 | \n2057954 | \n
80976 | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nTrue | \nFalse | \n... | \n0.108906 | \n81.331839 | \n0.108906 | \n83.021503 | \n0.164555 | \nTrue | \nFalse | \n1.862786 | \n4.346569 | \n2057954 | \n
80977 | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \n... | \n1.570796 | \n25.717078 | \n0.350897 | \n25.717078 | \n0.350897 | \nFalse | \nFalse | \n66.594979 | \n68.457765 | \n2057954 | \n
80978 | \nTrue | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \nFalse | \n... | \n1.570796 | \n105.055033 | \n0.032370 | \n81.331839 | \n0.108906 | \nFalse | \nTrue | \n43.943937 | \n110.538916 | \n2057954 | \n
10 rows × 143 columns
\n