{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":59093,"databundleVersionId":7469972,"sourceType":"competition"}],"dockerImageVersionId":30635,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np \nimport pandas as pd\nimport seaborn as sns\nimport matplotlib.pyplot as plt\nimport warnings\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        if '.csv' in filename:\n            print(os.path.join(dirname, filename))\n            \n            \nwarnings.filterwarnings('ignore')","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-01-20T13:04:13.769044Z","iopub.execute_input":"2024-01-20T13:04:13.769569Z","iopub.status.idle":"2024-01-20T13:04:13.872079Z","shell.execute_reply.started":"2024-01-20T13:04:13.769520Z","shell.execute_reply":"2024-01-20T13:04:13.870947Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def plot_votes(df0, eeg_id=1628180742):\n    df1 = df0.query(f'eeg_id == {eeg_id}')\n    df1.drop(['eeg_id','eeg_sub_id','spectrogram_id', 'spectrogram_sub_id', 'label_id', 'patient_id', 'expert_consensus', 'spectrogram_label_offset_seconds'], axis=1, inplace=True)\n    df1.set_index('eeg_label_offset_seconds', inplace=True)\n    df1.plot.bar(title=f'eeg id = {eeg_id}', xlabel='eeg label offset seconds', ylabel='Votes')\n    ","metadata":{"execution":{"iopub.status.busy":"2024-01-20T13:04:13.874512Z","iopub.execute_input":"2024-01-20T13:04:13.874858Z","iopub.status.idle":"2024-01-20T13:04:13.881449Z","shell.execute_reply.started":"2024-01-20T13:04:13.874826Z","shell.execute_reply":"2024-01-20T13:04:13.880303Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Train","metadata":{}},{"cell_type":"code","source":"df0 = pd.read_csv('/kaggle/input/hms-harmful-brain-activity-classification/train.csv')\ndf0.info()","metadata":{"execution":{"iopub.status.busy":"2024-01-20T13:04:13.883019Z","iopub.execute_input":"2024-01-20T13:04:13.883394Z","iopub.status.idle":"2024-01-20T13:04:14.112013Z","shell.execute_reply.started":"2024-01-20T13:04:13.883363Z","shell.execute_reply":"2024-01-20T13:04:14.109546Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df0.head(20)","metadata":{"execution":{"iopub.status.busy":"2024-01-20T13:04:14.113525Z","iopub.execute_input":"2024-01-20T13:04:14.113866Z","iopub.status.idle":"2024-01-20T13:04:14.141748Z","shell.execute_reply.started":"2024-01-20T13:04:14.113836Z","shell.execute_reply":"2024-01-20T13:04:14.140692Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df0.describe().transpose()","metadata":{"execution":{"iopub.status.busy":"2024-01-20T13:04:14.144998Z","iopub.execute_input":"2024-01-20T13:04:14.145449Z","iopub.status.idle":"2024-01-20T13:04:14.236781Z","shell.execute_reply.started":"2024-01-20T13:04:14.145408Z","shell.execute_reply":"2024-01-20T13:04:14.235698Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(data=df0, x='expert_consensus')","metadata":{"execution":{"iopub.status.busy":"2024-01-20T13:04:14.238097Z","iopub.execute_input":"2024-01-20T13:04:14.238423Z","iopub.status.idle":"2024-01-20T13:04:14.573917Z","shell.execute_reply.started":"2024-01-20T13:04:14.238394Z","shell.execute_reply":"2024-01-20T13:04:14.572950Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"eeg_s = list(set(df0['eeg_id'].to_list()))\nlen(eeg_s)","metadata":{"execution":{"iopub.status.busy":"2024-01-20T13:04:14.575831Z","iopub.execute_input":"2024-01-20T13:04:14.576291Z","iopub.status.idle":"2024-01-20T13:04:14.594096Z","shell.execute_reply.started":"2024-01-20T13:04:14.576249Z","shell.execute_reply":"2024-01-20T13:04:14.592947Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for eeg in eeg_s[:200]:\n    plot_votes(df0, eeg_id=eeg)","metadata":{"execution":{"iopub.status.busy":"2024-01-20T13:05:40.815960Z","iopub.execute_input":"2024-01-20T13:05:40.816385Z","iopub.status.idle":"2024-01-20T13:07:24.561218Z","shell.execute_reply.started":"2024-01-20T13:05:40.816341Z","shell.execute_reply":"2024-01-20T13:07:24.560056Z"},"trusted":true},"execution_count":null,"outputs":[]}]}