challenge link: Sports Analytics Challenge
pandas==0.23.4 numpy==1.15.4 lxml==4.3.3 scikit-learn==0.20.3 xgboost==0.82 tensorflow==1.12.0 absl-py==0.7.0
for x in $(ls ../resources/raw_games/):
do
echo $x
python3 transform_xml --dim_player_team '../resources/Players and IDs - F40 - L1 20162017.xml' \
--dim_event '../resources/dim/event.txt' \
--dim_qualifier '../resources/dim/qualifier.txt' \
--game_file $x\
--output_dir '../resources/games_friendly'
done
python3 players.py --game_dir '../resources/games_friendly/' \
--player_file '../resources/Players and IDs - F40 - L1 20162017.xml' \
--output_use_player '../resources/dim/use_player.pkl' \
--output_player_info '../resources/dim/players.tsv'
3.1 make sample by loop through all 15 minutes from a game and calculate team's performance (shoot, pass, foul, and so on...) as team features.
python3 make_sample_team.py --event_file '../resources/dim/event.txt' \
--qualifier_file '../resources/dim/qualifier.txt' \
--associate_file '../resources/dim/associate_use.tsv' \
--game_file '../resources/games_friendly/8_PSG_vs_Bordeaux.xml' \
--save_dir '../resources/samples/team'
3.2 make sample by loop through all 15 minutes from a game and calculate player's performance (shoot, pass, foul, and so on...) as player features.
python3 make_sample_player.py --event_file '../resources/dim/event.txt' \
--qualifier_file '../resources/dim/qualifier.txt' \
--associate_file '../resources/dim/associate_use.tsv' \
--game_file '../resources/games_friendly/8_PSG_vs_Bordeaux.xml' \
--save_dir '../resources/samples/player' \
--player_file '../resources/dim/players.tsv' \
--use_player_file '../resources/dim/use_player'
for x in {1..19}
do
echo $x
bash bash_scripts/$x.sh &
done
I take first 18 rounds of games as training set and the 19th round as the valid set.
The model scoring below is evaluation on the valid set based on model built from training set.
accuracy on valid set: 9%
python3 train_player_model.py --sample_dir '../resources/samples/player' \
--model_dir 'model' \
--dim_game '../resources/dim/games.csv' \
--transformer_file 'player_transformer.pkl' \
--model_file 'player_model.pkl' \
--trees 2000 \
--patience 100 \
--xgb_n_jobs 20 \
--depth_search '3' \
--gamma_search '0.5,0' \
--alpha_search '0.5,0'
accuracy on valid set: 78%
python3 train_next_team_model.py --sample_dir '../resources/samples/team' \
--model_dir 'model' \
--dim_game '../resources/dim/games.csv' \
--transformer_file 'next_team_transformer.pkl' \
--model_file 'next_team_model.pkl' \
--trees 2000 \
--patience 100 \
--xgb_n_jobs 20 \
--depth_search '3' \
--gamma_search '0.5,0' \
--alpha_search '0.5,0'
accuracy on valid set: 82% (improving 4% compared to gbdt)
python3 train_next_team_rnn.py --sample_dir '../resources/samples/team' \
--model_dir 'model' \
--dim_game '../resources/dim/games.csv' \
--tokenizer_file 'last10_tokenizer.pkl' \
--model_json 'next_team_rnn.json' \
--weights_file 'next_team_rnn.hdf5' \
--patience 5
mae on valid set 16.80
python3 train_next_xy_model.py --sample_dir '../resources/samples/team' \
--model_dir 'model' \
--dim_game '../resources/dim/games.csv' \
--transformer_file 'next_x_transformer.pkl' \
--model_file 'next_x_model.pkl' \
--trees 2000 \
--patience 100 \
--xgb_n_jobs 20 \
--depth_search '3' \
--gamma_search '0.5,0' \
--alpha_search '0.5,0' \
--predict_y=False
mae on valid set 24.66
python3 train_next_xy_model.py --sample_dir '../resources/samples/team' \
--model_dir 'model' \
--dim_game '../resources/dim/games.csv' \
--transformer_file 'next_y_transformer.pkl' \
--model_file 'next_y_model.pkl' \
--trees 2000 \
--patience 100 \
--xgb_n_jobs 20 \
--depth_search '3' \
--gamma_search '0.5,0' \
--alpha_search '0.5,0' \
--predict_y=True