{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# Import basic libraries\nimport numpy as np \nimport pandas as pd \nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport os","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-12-29T14:13:07.017109Z","iopub.execute_input":"2022-12-29T14:13:07.017959Z","iopub.status.idle":"2022-12-29T14:13:07.857754Z","shell.execute_reply.started":"2022-12-29T14:13:07.017924Z","shell.execute_reply":"2022-12-29T14:13:07.856791Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# List files available\nprint(os.listdir(\"../input/\"))","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:13:07.859579Z","iopub.execute_input":"2022-12-29T14:13:07.859947Z","iopub.status.idle":"2022-12-29T14:13:07.866069Z","shell.execute_reply.started":"2022-12-29T14:13:07.859914Z","shell.execute_reply":"2022-12-29T14:13:07.865063Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Installing and loading the library\n!pip install dabl\n\nimport dabl","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:13:07.867532Z","iopub.execute_input":"2022-12-29T14:13:07.868161Z","iopub.status.idle":"2022-12-29T14:13:19.964560Z","shell.execute_reply.started":"2022-12-29T14:13:07.868118Z","shell.execute_reply":"2022-12-29T14:13:19.963540Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nsample_df = pd.read_csv('/kaggle/input/nfl-player-contact-detection/sample_submission.csv')\n\n# A first look at data\nsample_df.shape","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:13:19.970272Z","iopub.execute_input":"2022-12-29T14:13:19.972493Z","iopub.status.idle":"2022-12-29T14:13:20.071962Z","shell.execute_reply.started":"2022-12-29T14:13:19.972455Z","shell.execute_reply":"2022-12-29T14:13:20.069811Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_df.head()","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:13:20.073646Z","iopub.execute_input":"2022-12-29T14:13:20.073986Z","iopub.status.idle":"2022-12-29T14:13:20.091404Z","shell.execute_reply.started":"2022-12-29T14:13:20.073952Z","shell.execute_reply":"2022-12-29T14:13:20.090546Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"helmets_df = pd.read_csv('/kaggle/input/nfl-player-contact-detection/test_baseline_helmets.csv')\n\n# A first look at data\nhelmets_df.shape","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:13:20.092538Z","iopub.execute_input":"2022-12-29T14:13:20.092953Z","iopub.status.idle":"2022-12-29T14:13:20.190801Z","shell.execute_reply.started":"2022-12-29T14:13:20.092920Z","shell.execute_reply":"2022-12-29T14:13:20.189924Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"helmets_df.head()","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:13:20.192081Z","iopub.execute_input":"2022-12-29T14:13:20.192530Z","iopub.status.idle":"2022-12-29T14:13:20.205914Z","shell.execute_reply.started":"2022-12-29T14:13:20.192489Z","shell.execute_reply":"2022-12-29T14:13:20.204961Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"helmets_df_clean = dabl.clean(helmets_df, verbose=1)","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:13:20.207503Z","iopub.execute_input":"2022-12-29T14:13:20.208166Z","iopub.status.idle":"2022-12-29T14:13:20.394594Z","shell.execute_reply.started":"2022-12-29T14:13:20.208132Z","shell.execute_reply":"2022-12-29T14:13:20.393585Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"types = dabl.detect_types(helmets_df_clean)\nprint(types) ","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:13:20.396231Z","iopub.execute_input":"2022-12-29T14:13:20.396586Z","iopub.status.idle":"2022-12-29T14:13:20.436653Z","shell.execute_reply.started":"2022-12-29T14:13:20.396553Z","shell.execute_reply":"2022-12-29T14:13:20.435698Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dabl.plot(helmets_df, target_col=\"game_play\")","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:13:20.441213Z","iopub.execute_input":"2022-12-29T14:13:20.441483Z","iopub.status.idle":"2022-12-29T14:13:31.830729Z","shell.execute_reply.started":"2022-12-29T14:13:20.441459Z","shell.execute_reply":"2022-12-29T14:13:31.829599Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ec = dabl.SimpleClassifier(random_state=0).fit(helmets_df, target_col=\"game_play\")","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:13:31.832180Z","iopub.execute_input":"2022-12-29T14:13:31.832810Z","iopub.status.idle":"2022-12-29T14:13:53.811388Z","shell.execute_reply.started":"2022-12-29T14:13:31.832770Z","shell.execute_reply":"2022-12-29T14:13:53.810256Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# installation and importing the library\n!pip install missingno\nimport missingno as msno","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:13:53.813134Z","iopub.execute_input":"2022-12-29T14:13:53.813533Z","iopub.status.idle":"2022-12-29T14:14:02.782568Z","shell.execute_reply.started":"2022-12-29T14:13:53.813494Z","shell.execute_reply":"2022-12-29T14:14:02.781411Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Let's check out the missing values first with the test.info() method\nhelmets_df.info()","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:02.784663Z","iopub.execute_input":"2022-12-29T14:14:02.785075Z","iopub.status.idle":"2022-12-29T14:14:02.810177Z","shell.execute_reply.started":"2022-12-29T14:14:02.785036Z","shell.execute_reply":"2022-12-29T14:14:02.809295Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"msno.matrix(helmets_df)","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:02.811595Z","iopub.execute_input":"2022-12-29T14:14:02.811962Z","iopub.status.idle":"2022-12-29T14:14:03.542524Z","shell.execute_reply.started":"2022-12-29T14:14:02.811929Z","shell.execute_reply":"2022-12-29T14:14:03.541548Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"msno.matrix(helmets_df.sample(50))","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:03.544030Z","iopub.execute_input":"2022-12-29T14:14:03.544736Z","iopub.status.idle":"2022-12-29T14:14:04.057907Z","shell.execute_reply.started":"2022-12-29T14:14:03.544696Z","shell.execute_reply":"2022-12-29T14:14:04.056773Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"msno.bar(helmets_df)","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:04.065216Z","iopub.execute_input":"2022-12-29T14:14:04.065760Z","iopub.status.idle":"2022-12-29T14:14:05.237471Z","shell.execute_reply.started":"2022-12-29T14:14:04.065730Z","shell.execute_reply":"2022-12-29T14:14:05.236537Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"player_df = pd.read_csv('/kaggle/input/nfl-player-contact-detection/test_player_tracking.csv')\n\n# A first look at data\nplayer_df.shape","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:05.239050Z","iopub.execute_input":"2022-12-29T14:14:05.239433Z","iopub.status.idle":"2022-12-29T14:14:05.290507Z","shell.execute_reply.started":"2022-12-29T14:14:05.239397Z","shell.execute_reply":"2022-12-29T14:14:05.289601Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"player_df.head()","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:05.291903Z","iopub.execute_input":"2022-12-29T14:14:05.292229Z","iopub.status.idle":"2022-12-29T14:14:05.312000Z","shell.execute_reply.started":"2022-12-29T14:14:05.292196Z","shell.execute_reply":"2022-12-29T14:14:05.310873Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"player_df_clean = dabl.clean(player_df, verbose=1)","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:05.313409Z","iopub.execute_input":"2022-12-29T14:14:05.314190Z","iopub.status.idle":"2022-12-29T14:14:05.404430Z","shell.execute_reply.started":"2022-12-29T14:14:05.314154Z","shell.execute_reply":"2022-12-29T14:14:05.403425Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"types = dabl.detect_types(player_df_clean)\nprint(types) ","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:05.407449Z","iopub.execute_input":"2022-12-29T14:14:05.407725Z","iopub.status.idle":"2022-12-29T14:14:05.465250Z","shell.execute_reply.started":"2022-12-29T14:14:05.407701Z","shell.execute_reply":"2022-12-29T14:14:05.463973Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dabl.plot(player_df, target_col=\"game_play\")","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:05.467004Z","iopub.execute_input":"2022-12-29T14:14:05.467411Z","iopub.status.idle":"2022-12-29T14:14:15.398644Z","shell.execute_reply.started":"2022-12-29T14:14:05.467375Z","shell.execute_reply":"2022-12-29T14:14:15.397696Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ec = dabl.SimpleClassifier(random_state=0).fit(player_df, target_col=\"game_play\")","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:15.400087Z","iopub.execute_input":"2022-12-29T14:14:15.401064Z","iopub.status.idle":"2022-12-29T14:14:21.434109Z","shell.execute_reply.started":"2022-12-29T14:14:15.401026Z","shell.execute_reply":"2022-12-29T14:14:21.432995Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# installation and importing the library\n!pip install missingno\nimport missingno as msno","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:21.435849Z","iopub.execute_input":"2022-12-29T14:14:21.436560Z","iopub.status.idle":"2022-12-29T14:14:35.009744Z","shell.execute_reply.started":"2022-12-29T14:14:21.436523Z","shell.execute_reply":"2022-12-29T14:14:35.008451Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Let's check out the missing values first with the test.info() method\nplayer_df.info()","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:35.011898Z","iopub.execute_input":"2022-12-29T14:14:35.012281Z","iopub.status.idle":"2022-12-29T14:14:35.032149Z","shell.execute_reply.started":"2022-12-29T14:14:35.012241Z","shell.execute_reply":"2022-12-29T14:14:35.031125Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"msno.matrix(player_df)","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:35.033484Z","iopub.execute_input":"2022-12-29T14:14:35.033826Z","iopub.status.idle":"2022-12-29T14:14:35.709459Z","shell.execute_reply.started":"2022-12-29T14:14:35.033790Z","shell.execute_reply":"2022-12-29T14:14:35.708516Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"msno.matrix(player_df.sample(50))","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:35.710883Z","iopub.execute_input":"2022-12-29T14:14:35.711603Z","iopub.status.idle":"2022-12-29T14:14:36.244618Z","shell.execute_reply.started":"2022-12-29T14:14:35.711565Z","shell.execute_reply":"2022-12-29T14:14:36.243605Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"msno.bar(player_df)","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:36.246402Z","iopub.execute_input":"2022-12-29T14:14:36.246806Z","iopub.status.idle":"2022-12-29T14:14:37.560155Z","shell.execute_reply.started":"2022-12-29T14:14:36.246767Z","shell.execute_reply":"2022-12-29T14:14:37.559275Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata_df = pd.read_csv('/kaggle/input/nfl-player-contact-detection/test_video_metadata.csv')\n\n# A first look at data\nmetadata_df.shape","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:37.569095Z","iopub.execute_input":"2022-12-29T14:14:37.571588Z","iopub.status.idle":"2022-12-29T14:14:37.589875Z","shell.execute_reply.started":"2022-12-29T14:14:37.571551Z","shell.execute_reply":"2022-12-29T14:14:37.589039Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata_df.head()","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:37.593478Z","iopub.execute_input":"2022-12-29T14:14:37.595908Z","iopub.status.idle":"2022-12-29T14:14:37.613128Z","shell.execute_reply.started":"2022-12-29T14:14:37.595874Z","shell.execute_reply":"2022-12-29T14:14:37.612320Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata_df_clean = dabl.clean(metadata_df, verbose=1)","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:37.616780Z","iopub.execute_input":"2022-12-29T14:14:37.619848Z","iopub.status.idle":"2022-12-29T14:14:37.656989Z","shell.execute_reply.started":"2022-12-29T14:14:37.619814Z","shell.execute_reply":"2022-12-29T14:14:37.656167Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"types = dabl.detect_types(metadata_df_clean)\nprint(types) ","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:37.660692Z","iopub.execute_input":"2022-12-29T14:14:37.662768Z","iopub.status.idle":"2022-12-29T14:14:37.683637Z","shell.execute_reply.started":"2022-12-29T14:14:37.662735Z","shell.execute_reply":"2022-12-29T14:14:37.682737Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dabl.plot(metadata_df, target_col=\"game_play\")","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:37.687396Z","iopub.execute_input":"2022-12-29T14:14:37.689611Z","iopub.status.idle":"2022-12-29T14:14:38.745247Z","shell.execute_reply.started":"2022-12-29T14:14:37.689578Z","shell.execute_reply":"2022-12-29T14:14:38.743969Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"baseline_df1 = pd.read_csv('/kaggle/input/nfl-player-contact-detection/train_baseline_helmets.csv')\n\nbaseline_df1.shape","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:38.746866Z","iopub.execute_input":"2022-12-29T14:14:38.747522Z","iopub.status.idle":"2022-12-29T14:14:45.062134Z","shell.execute_reply.started":"2022-12-29T14:14:38.747476Z","shell.execute_reply":"2022-12-29T14:14:45.061015Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"baseline_df1.head()","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:45.063775Z","iopub.execute_input":"2022-12-29T14:14:45.064146Z","iopub.status.idle":"2022-12-29T14:14:45.078101Z","shell.execute_reply.started":"2022-12-29T14:14:45.064112Z","shell.execute_reply":"2022-12-29T14:14:45.076954Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels_df = pd.read_csv('/kaggle/input/nfl-player-contact-detection/train_labels.csv')\n\nlabels_df.shape","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:45.079998Z","iopub.execute_input":"2022-12-29T14:14:45.080358Z","iopub.status.idle":"2022-12-29T14:14:54.065387Z","shell.execute_reply.started":"2022-12-29T14:14:45.080314Z","shell.execute_reply":"2022-12-29T14:14:54.064343Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels_df.head()","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:54.069331Z","iopub.execute_input":"2022-12-29T14:14:54.069977Z","iopub.status.idle":"2022-12-29T14:14:54.088983Z","shell.execute_reply.started":"2022-12-29T14:14:54.069944Z","shell.execute_reply":"2022-12-29T14:14:54.088009Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"player_df1 = pd.read_csv('/kaggle/input/nfl-player-contact-detection/train_player_tracking.csv')\n\nplayer_df1.shape","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:54.093369Z","iopub.execute_input":"2022-12-29T14:14:54.096375Z","iopub.status.idle":"2022-12-29T14:14:57.432767Z","shell.execute_reply.started":"2022-12-29T14:14:54.096342Z","shell.execute_reply":"2022-12-29T14:14:57.431593Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"player_df1.head()","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:57.434105Z","iopub.execute_input":"2022-12-29T14:14:57.434560Z","iopub.status.idle":"2022-12-29T14:14:57.456840Z","shell.execute_reply.started":"2022-12-29T14:14:57.434522Z","shell.execute_reply":"2022-12-29T14:14:57.455539Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata_df1 = pd.read_csv('/kaggle/input/nfl-player-contact-detection/train_video_metadata.csv')\n\nmetadata_df1.shape ","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:57.458520Z","iopub.execute_input":"2022-12-29T14:14:57.459172Z","iopub.status.idle":"2022-12-29T14:14:57.485466Z","shell.execute_reply.started":"2022-12-29T14:14:57.459133Z","shell.execute_reply":"2022-12-29T14:14:57.484620Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadata_df1.head()","metadata":{"execution":{"iopub.status.busy":"2022-12-29T14:14:57.486696Z","iopub.execute_input":"2022-12-29T14:14:57.487149Z","iopub.status.idle":"2022-12-29T14:14:57.502023Z","shell.execute_reply.started":"2022-12-29T14:14:57.487115Z","shell.execute_reply":"2022-12-29T14:14:57.500934Z"},"trusted":true},"execution_count":null,"outputs":[]}]}