Skip to content

a supervised model that predicts the match winning rate in LOL game based on the lineups of both sides. Implemented data processing by multiple python API including sklearn, NumPy, pandas, and by feature encoding, kNN, Synthetic Minority Oversampling Technique, etc

Notifications You must be signed in to change notification settings

ShiqiLu77/MachinLearning-LOL_Gaming

Repository files navigation

6105 Final Project: 🔮 LOL Match predict

Welcome to the summoner's rift! image

Contributors

Shiqi Lu, Jiawei Wang, Zeyu Liao

You may want to know:

File Tree:

Root:
│  .DS_Store
│  ChampionIdMapping.py	(Mapping Champions name into id)
│  DecisionTree.ipynb		(Decision Tree model)
│  DecisionTree2.ipynb														
│  LogisticRegression.ipynb		(LogisticRegression model)
│  MLP.ipynb										(MLP model)
│  README.txt
│  tmp2.ipynb
│  测试决策树预测的模拟阵容效果.ipynb
│  
├─dataProcessingAlgorithms (Codes to convert raw data into featured data )
│  │  .DS_Store
│  │  ChampionNameMapping.py (Mapping Champions name into id)
│  │  GenerateInputDataForMLModel.py (Convert data into ml model acceptable input)
│  │  step1.MergeOriginCsvsToOneCsv.ipynb (Combined 87 CSV into 1 CSV )
│  │  step2.ChampionJsonToDF.ipynb (Read Json format champions values)
│  │  step3.1.DataProcessing-dropNanAndUselessColumns.ipynb (drop Nan And Useless Columns)
│  │  step3.2.DataProcessing-dropOutliers.ipynb (drop Outliers)
│  │  step4.SplitByTime.ipynb (Spilt data into three stages data pre stage, mid stage, and late stage)
│  │  step5.1.ChampionCounterScores.ipynb (Calculate counter score)
│  │  step5.2.ChampionWinRate.ipynb (Calculate win rate)
│  │  step5.4&5&6.ChampionControl&Attack&DefenseScore.ipynb (Calculate champion score)
│  │  step6.transformOriTraindataToSelectedFeatureData.ipynb (Convert data into ml model acceptable input)
│  │  step7.transformTestdataToSelectedFeatureData.ipynb
│  │  
│  └─__pycache__
│          ChampionNameMapping.cpython-310.pyc
│          ChampionNameMapping.cpython-39.pyc
│          GenerateInputDataForMLModel.cpython-310.pyc
│          GenerateInputDataForMLModel.cpython-39.pyc
│          
├─datasets (All datasets include original data and processed data)
│  │  .DS_Store
│  │  championCrossJoin.csv (original data after preprocess: drop NaN values, Time spilt etc.)
│  │  championId.csv
│  │  train_late.csv
│  │  train_mid.csv
│  │  train_pre.csv
│  │  val_late.csv
│  │  val_mid.csv
│  │  val_pre.csv
│  │  
│  ├─all_feature_data (processed data with all useful features )
│  │     
│  ├─comparison_feature_data (processed data with compared useful features, eg. diff between two teams )
│  │      
│  ├─merged_data (Combined 87 CSV into 1 CSV )
│  │      
│  ├─origin (Raw data downloaded from Kaggle)
│  │              
│  ├─processed_data (original data after preprocess: drop NaN values)
│  │      
│  └─tmp_data_for_exploration (data for exploration)
│          
├─Useful Features (Calculation Sheet for feature restructuring)
│  │  .DS_Store
│  │  1.counterScore_late.csv
│  │  1.counterScore_mid.csv
│  │  1.counterScore_pre.csv
│  │  2.lineupCombo.csv
│  │  3.championWinRate_late.csv
│  │  3.championWinRate_mid.csv
│  │  3.championWinRate_pre.csv
│  │  4.championAttackDefenseScore_late.csv
│  │  4.championAttackDefenseScore_mid.csv
│  │  4.championAttackDefenseScore_pre.csv
│  │  5.championControlScore.csv
│  │  6.championGoldAbility_late.csv
│  │  6.championGoldAbility_mid.csv
│  │  6.championGoldAbility_pre.csv
│  │  
│  └─initial
│          3.championWinRate_late.csv
│          3.championWinRate_mid.csv
│          3.championWinRate_pre.csv
│          
└─__pycache__
        ChampionIdMapping.cpython-39.pyc
        dataMapping.cpython-39.pyc

Raw data features:

Column name Use das input Path from Match-V5 type description
gameId No info/gameId str unique value for each match
matchId No metadata/matchId str gameId prefixed with the players region
gameVersion No info/gameVersion str game version, the first two parts can be used to determine the patch
gameDuration No info/gameDuration int game duration in seconds
teamVictory No info/teams[t]/win int Team victory, either 100 for blue, or 200 for red
team_100_gold No info/participants[]/goldEarned int Total gold earned by blue team
team_200_gold No info/participants[]/goldEarned int Total gold earned by red team
Player_id Yes info/participants/participantId int Player id ranging from 1 to 10 included
Player_{Player_id}_team Yes info/participants/teamId int Player team, either 100 for blue team, or 200 for red team
Player_{Player_id}_ban Yes info/teams[t]/bans[i]/championId int Player champion banned
Player_{Player_id}_pick Yes info/participants[i]/championId int Player champion picked
Player_{Player_id}_ban_turn Yes info/teams[t]/bans[i]/pickTurn int Player pick order
Player_{Player_id}_victory No info/teams[t]/win int Either 1 for victory or 0 for defeat
Player_{Player_id}_role No info/participants[i]/role str Role declared by the player before match. Possible values: DUO, DUOCARRY, DUOSUPPORT, NONE, and SOLO
Player_{Player_id}_position No info/participants[i]/teamPosition str Role deduced after match from every players position. Possible values: TOP, MIDDLE, JUNGLE, BOTTOM, UTILITY, APEX, and NONE
Player_{Player_id}_time_game No info/gameDuration int Game duration in seconds
Player_{Player_id}_gold No info/participants[i]/goldEarned int Total gold earned
Player_{Player_id}_xp No info/participants[i]/champExperience int Total XP accumulated
Player_{Player_id}_dmg_dealt No info/participants[i]/totalDamageDealtToChampions int Total damages dealt to other champions
Player_{Player_id}_dmg_taken No info/participants[i]/totalDamageTaken int Total damages received
Player_{Player_id}_time_ccing No info/participants[i]/timeCCingOthers int Total time of crowd control inflicted to other champs

Features Formula Explanation:

A. Champion’s Counter Score:
For Champion A vs B in this Position:
The counter score = 
∑ (Player Who Pick Champ A in This Position_gold)- ∑ (Player Who Pick Champ B in This Position_gold) / Matches Champion A vs Champion B
For Champion B vs A in this Position: counter score = -(Counter Score A vs B)

B. Champion’s win rate
N_win = Number of matches the champion won
N = Total number of matches in which the hero Champion was picked
N’_win = Number of matches the champion won in that position(Top, Jungle , Mid, Bottom, Utility)
N’ = Total number of matches in which the hero Champion was picked in that position
champion’s overall win rate = N_win / N
champion’s win rate in each position = N’_win / N’
For rare champions with few matches at each position:
when the number of matches in which a hero is picked in that position is less than N/n (n = 160 , the number of all champions), we consider this champion to be a rare hero in that position and his win rate is inaccurate. 
We use the weighted average win rate in that position of all rare champions as the win rate of each rare champion in that position.

C. Champion’s attack/defense ability
For each match:
dmg_dealt = total damages dealt by the champion to others
dmg_taken = total damages received by the champion
dmg_dealt_per_min = dmg_dealt / gameDuration * 60
dmg_taken_per_min = dmg_taken / gameDuration * 60
champion’s attack ability = ∑ dmg_dealt_per_min / N  (
champion’s defense ability = ∑ dmg_taken_per_min / N  Team’s composition 
Mean_attack_ability = ∑ champion’s attack ability / 5
Mean_defense_ability = ∑ champion’s attack ability / 5
team’s composition = Mean_attack_ability - Mean_defense_ability

D. Champion’s control ability
For each match:
time_control = total time of crowd control inflicted to other champs (in seconds)
time_control_per_min = time_control / gameDuration * 60
champion’s control ability = ∑ time_control / N  

Compile enviornment:

  • Windows System, VSCode, Python Version: 3.10.5 64bit
  • Python Library Needed:
    • numpy 1.23.2
    • pandas 1.4.4
    • scikit learn 1.1.2
    • matplotlib 3.5.3
    • seaborn 0.12.1

About

a supervised model that predicts the match winning rate in LOL game based on the lineups of both sides. Implemented data processing by multiple python API including sklearn, NumPy, pandas, and by feature encoding, kNN, Synthetic Minority Oversampling Technique, etc

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published