{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load in \n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nimport os\nprint(os.listdir(\"../input\"))\nINPUT_DIR = \"../input/\"\n# Any results you write to the current directory are saved as output.","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"787bf768cec1829e50eaa7f5748ee2b8986ce0d9"},"cell_type":"markdown","source":"**groupId** - Integer ID to identify a group within a match. If the same group of players plays in different matches, they will have a different groupId each time.\n\n**matchId** - Integer ID to identify match. There are no matches that are in both the training and testing set.\n\n**assists** - Number of enemy players this player damaged that were killed by teammates.\n\n**boosts** - Number of boost items used.\n\n**damageDealt** - Total damage dealt. Note: Self inflicted damage is subtracted.\n\n**DBNOs** - Number of enemy players knocked.\n\n**headshotKills** - Number of enemy players killed with headshots.\n\n**heals** - Number of healing items used.\n\n**killPlace** - Ranking in match of number of enemy players killed.\n\n**killPoints** - Kills-based external ranking of player. (Think of this as an Elo ranking where only kills matter.)\n\n**kills** - Number of enemy players killed.\n\n**killStreaks** - Max number of enemy players killed in a short amount of time.\n\n**longestKill** - Longest distance between player and player killed at time of death. This may be misleading, as downing a - player and driving away may lead to a large longestKill stat.\n\n**maxPlace** - Worst placement we have data for in the match. This may not match with numGroups, as sometimes the data skips over placements.\n\n**numGroups** - Number of groups we have data for in the match.\n\n**revives** - Number of times this player revived teammates.\n\n**rideDistance** - Total distance traveled in vehicles measured in meters.\n\n**roadKills** - Number of kills while in a vehicle.\n\n**swimDistance** - Total distance traveled by swimming measured in meters.\n\n**teamKills** - Number of times this player killed a teammate.\n\n**vehicleDestroys** - Number of vehicles destroyed.\n\n**walkDistance** - Total distance traveled on foot measured in meters.\n\n**weaponsAcquired** - Number of weapons picked up.\n\n**winPoints** - Win-based external ranking of player. (Think of this as an Elo ranking where only winning matters.)\n\n**winPlacePerc** - The target of prediction. This is a percentile winning placement, where 1 corresponds to 1st place, and 0 corresponds to last place in the match. It is calculated off of maxPlace, not numGroups, so it is possible to have missing chunks in a match."},{"metadata":{"_uuid":"eb44252e03b206c442c266d9e6d6148bf1124ee9"},"cell_type":"markdown","source":"# Load data"},{"metadata":{"trusted":true,"_uuid":"c0ecfb331d633e515237cb9a0a3d73c145dce84c"},"cell_type":"code","source":"data = pd.read_csv(INPUT_DIR + \"train_V2.csv\", nrows=10000)\ndata.info()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"b846fe82d6686ba1d6e2e539500056c3023df15b"},"cell_type":"markdown","source":"# Visualize data w.r.t. one parameter at a time.\nGet influence of parameter on the winPlacePerc"},{"metadata":{"trusted":true,"_uuid":"4978ed8d3e735ec1a0f60c6f4008a60b37c5ff86"},"cell_type":"code","source":"%matplotlib inline\nimport matplotlib as mpl\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\n# create co relation matrix using seaborn heatmap\ncolumns_to_ignore = [\"Id\", \"groupId\", \"matchId\"]\ncolumns_to_show = [column for column in data.columns if column not in columns_to_ignore]\nco_relation_matrix = data[columns_to_show].corr()\nplt.figure(figsize=(11,9))\nsns.heatmap(co_relation_matrix,\n             xticklabels=co_relation_matrix.columns.values,\n             yticklabels=co_relation_matrix.columns.values,\n             linecolor=\"white\",\n             linewidth=0.1,\n             cmap=\"RdBu\"\n           )\n","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"35fd68c830f8385db63747635b7a8f1c00ba696d"},"cell_type":"markdown","source":"**killPoints, matchDuration, maxPlace, numGroups, rankPoints, roadKills, swimDistance, teamKills, vehicleDestroys, winPoints Don't have a lot of significance on the winPlacePerc**"},{"metadata":{"_uuid":"aaafae3562c06b2b90f0cd6768eee5ab3bfee4a4"},"cell_type":"markdown","source":"# Aggrigate data wrt group ID"},{"metadata":{"trusted":true,"scrolled":true,"_uuid":"b8390f33c630ddc72d3021af522bcb4c463fe9d9"},"cell_type":"code","source":"agg = data.groupby(\"groupId\").size().to_frame('players_in_team')\ndata = data.merge(agg, how=\"left\", on=\"groupId\")\n\ndata['headshotKillsOverKills'] = data['headshotKills'] / data['kills']\ndata['headshotKillsOverKills'].fillna(0, inplace=True)\n\ndata['killPlaceOverMaxPlace'] = data['killPlace'] / data['maxPlace']\ndata['killPlaceOverMaxPlace'].fillna(0, inplace=True)\ndata['killPlaceOverMaxPlace'].replace(np.inf, 0, inplace=True)\n\ncorr = data[['killPlace', 'walkDistance', 'headshotKillsOverKills', 'players_in_team',\n             'killPlaceOverMaxPlace', 'winPlacePerc']].corr()\nsns.heatmap(corr,\n    xticklabels=corr.columns.values,\n    yticklabels=corr.columns.values,\n    annot=True,\n    linecolor='white',\n    linewidth=0.1,\n    cmap=\"RdBu\"\n)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"aa47d26f986bccfd55132edf194d052e4d82159b"},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}