{"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":"# 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\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 read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_kg_hide-input":true,"_kg_hide-output":true,"execution":{"iopub.status.busy":"2022-08-18T10:08:48.717847Z","iopub.execute_input":"2022-08-18T10:08:48.718312Z","iopub.status.idle":"2022-08-18T10:08:48.729433Z","shell.execute_reply.started":"2022-08-18T10:08:48.718272Z","shell.execute_reply":"2022-08-18T10:08:48.727932Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**TABLE OF CONTENTS (CHECK RIGHT WINDOW) & DON'T FORGET TO UPVOTE IF IT'S USEFULL :)**","metadata":{}},{"cell_type":"markdown","source":"# Import necessary libraries","metadata":{}},{"cell_type":"code","source":"\nimport pandas as pd\nimport seaborn as sns\nimport matplotlib.pyplot as plt","metadata":{"execution":{"iopub.status.busy":"2022-08-18T10:08:48.732078Z","iopub.execute_input":"2022-08-18T10:08:48.732561Z","iopub.status.idle":"2022-08-18T10:08:48.741452Z","shell.execute_reply.started":"2022-08-18T10:08:48.732514Z","shell.execute_reply":"2022-08-18T10:08:48.740056Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# First look at files","metadata":{}},{"cell_type":"code","source":"!pip install tables\nmetadataset=pd.read_csv('../input/open-problems-multimodal/metadata.csv')\n#train_cite=pd.read_hdf('../input/open-problems-multimodal/train_cite_inputs.h5')\ntrain_cite_target=pd.read_hdf('../input/open-problems-multimodal/train_cite_targets.h5')","metadata":{"_kg_hide-output":true,"execution":{"iopub.status.busy":"2022-08-18T10:08:48.742869Z","iopub.execute_input":"2022-08-18T10:08:48.743325Z","iopub.status.idle":"2022-08-18T10:09:01.228665Z","shell.execute_reply.started":"2022-08-18T10:08:48.743280Z","shell.execute_reply":"2022-08-18T10:09:01.227435Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadataset","metadata":{"execution":{"iopub.status.busy":"2022-08-18T10:09:01.231955Z","iopub.execute_input":"2022-08-18T10:09:01.232347Z","iopub.status.idle":"2022-08-18T10:09:01.268535Z","shell.execute_reply.started":"2022-08-18T10:09:01.232312Z","shell.execute_reply":"2022-08-18T10:09:01.266946Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_cite_target","metadata":{"execution":{"iopub.status.busy":"2022-08-18T10:09:01.271407Z","iopub.execute_input":"2022-08-18T10:09:01.272522Z","iopub.status.idle":"2022-08-18T10:09:01.376707Z","shell.execute_reply.started":"2022-08-18T10:09:01.272474Z","shell.execute_reply":"2022-08-18T10:09:01.375561Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# EDA","metadata":{}},{"cell_type":"markdown","source":"**Firstly - unique values for each column**","metadata":{}},{"cell_type":"code","source":"unique_dict={}\nfor i in metadataset.columns:\n    unique_dict[i]=len(metadataset[i].unique())\nunique_dict","metadata":{"execution":{"iopub.status.busy":"2022-08-18T10:09:01.377991Z","iopub.execute_input":"2022-08-18T10:09:01.378404Z","iopub.status.idle":"2022-08-18T10:09:01.485871Z","shell.execute_reply.started":"2022-08-18T10:09:01.378374Z","shell.execute_reply":"2022-08-18T10:09:01.484756Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Now we need to take a look at values distributions**","metadata":{}},{"cell_type":"code","source":"metadataset.hist(figsize=(8,8))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-18T10:09:01.487401Z","iopub.execute_input":"2022-08-18T10:09:01.487860Z","iopub.status.idle":"2022-08-18T10:09:01.893690Z","shell.execute_reply.started":"2022-08-18T10:09:01.487818Z","shell.execute_reply":"2022-08-18T10:09:01.892401Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Common info & scalar metrics about dataset**","metadata":{}},{"cell_type":"code","source":"metadataset.info()","metadata":{"execution":{"iopub.status.busy":"2022-08-18T10:09:01.896576Z","iopub.execute_input":"2022-08-18T10:09:01.896955Z","iopub.status.idle":"2022-08-18T10:09:01.952646Z","shell.execute_reply.started":"2022-08-18T10:09:01.896922Z","shell.execute_reply":"2022-08-18T10:09:01.950746Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"metadataset.describe()","metadata":{"execution":{"iopub.status.busy":"2022-08-18T10:09:01.954042Z","iopub.execute_input":"2022-08-18T10:09:01.954387Z","iopub.status.idle":"2022-08-18T10:09:01.989986Z","shell.execute_reply.started":"2022-08-18T10:09:01.954356Z","shell.execute_reply":"2022-08-18T10:09:01.988114Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Correlation matrix**","metadata":{}},{"cell_type":"code","source":"metadataset.corr()","metadata":{"execution":{"iopub.status.busy":"2022-08-18T10:09:01.991794Z","iopub.execute_input":"2022-08-18T10:09:01.992209Z","iopub.status.idle":"2022-08-18T10:09:02.013886Z","shell.execute_reply.started":"2022-08-18T10:09:01.992178Z","shell.execute_reply":"2022-08-18T10:09:02.012938Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Features pairplot**","metadata":{}},{"cell_type":"markdown","source":"# Distribution plots","metadata":{}},{"cell_type":"code","source":"sns.displot(metadataset['day'],kind='kde')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-18T10:09:02.014960Z","iopub.execute_input":"2022-08-18T10:09:02.015314Z","iopub.status.idle":"2022-08-18T10:09:03.397979Z","shell.execute_reply.started":"2022-08-18T10:09:02.015283Z","shell.execute_reply":"2022-08-18T10:09:03.396696Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Day bar distributions**","metadata":{}},{"cell_type":"code","source":"sns.barplot(metadataset['day'].unique(),metadataset['day'].value_counts())\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-18T10:09:03.399365Z","iopub.execute_input":"2022-08-18T10:09:03.399709Z","iopub.status.idle":"2022-08-18T10:09:03.590510Z","shell.execute_reply.started":"2022-08-18T10:09:03.399664Z","shell.execute_reply":"2022-08-18T10:09:03.589363Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Donor bar counts**","metadata":{}},{"cell_type":"code","source":"sns.barplot(metadataset['donor'].unique(),metadataset['donor'].value_counts())\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-18T10:09:03.591912Z","iopub.execute_input":"2022-08-18T10:09:03.592243Z","iopub.status.idle":"2022-08-18T10:09:03.782702Z","shell.execute_reply.started":"2022-08-18T10:09:03.592214Z","shell.execute_reply":"2022-08-18T10:09:03.781355Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Cell type distributions**","metadata":{}},{"cell_type":"code","source":"sns.barplot(metadataset['cell_type'].unique(),metadataset['cell_type'].value_counts())\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-18T10:09:03.784036Z","iopub.execute_input":"2022-08-18T10:09:03.784382Z","iopub.status.idle":"2022-08-18T10:09:04.029054Z","shell.execute_reply.started":"2022-08-18T10:09:03.784351Z","shell.execute_reply":"2022-08-18T10:09:04.028107Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Technology type**","metadata":{}},{"cell_type":"code","source":"sns.barplot(metadataset['technology'].unique(),metadataset['technology'].value_counts())\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-18T10:09:04.030168Z","iopub.execute_input":"2022-08-18T10:09:04.031273Z","iopub.status.idle":"2022-08-18T10:09:04.232245Z","shell.execute_reply.started":"2022-08-18T10:09:04.031236Z","shell.execute_reply":"2022-08-18T10:09:04.231036Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Feature-to-feature dependency","metadata":{}},{"cell_type":"markdown","source":"**Cell type bar distributions for each technology type**","metadata":{}},{"cell_type":"code","source":"fig, axs = plt.subplots(1, 2)\ntechnology_list=metadataset['technology'].unique()\nfor i in range(2):\n    axs[i].set_title(technology_list[i])\n    axs[i].bar(metadataset[metadataset['technology']==technology_list[i]]['cell_type'].unique(), metadataset[metadataset['technology']==technology_list[i]]['cell_type'].value_counts())\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-18T11:25:31.914769Z","iopub.execute_input":"2022-08-18T11:25:31.915568Z","iopub.status.idle":"2022-08-18T11:25:32.368886Z","shell.execute_reply.started":"2022-08-18T11:25:31.915524Z","shell.execute_reply":"2022-08-18T11:25:32.367615Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Percentage pie diagram for cell types**","metadata":{}},{"cell_type":"code","source":"\nplt.figure(figsize=(6,6))\nplt.title('Cell type circle diagramm')\nplt.pie(metadataset['cell_type'].value_counts(), labels=metadataset['cell_type'].unique())\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-18T10:21:23.220175Z","iopub.execute_input":"2022-08-18T10:21:23.220592Z","iopub.status.idle":"2022-08-18T10:21:23.394519Z","shell.execute_reply.started":"2022-08-18T10:21:23.220556Z","shell.execute_reply":"2022-08-18T10:21:23.393653Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Cell types for each day**","metadata":{}},{"cell_type":"code","source":"fig, axs = plt.subplots(1, 4)\nday_list=metadataset['day'].unique()\nfor i in range(4):\n    axs[i].set_title(day_list[i])\n    axs[i].bar(metadataset[metadataset['day']==day_list[i]]['cell_type'].unique(), metadataset[metadataset['day']==day_list[i]]['cell_type'].value_counts())\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2022-08-18T11:16:23.980309Z","iopub.execute_input":"2022-08-18T11:16:23.980762Z","iopub.status.idle":"2022-08-18T11:16:24.564629Z","shell.execute_reply.started":"2022-08-18T11:16:23.980726Z","shell.execute_reply":"2022-08-18T11:16:24.563582Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Train cite target EDA","metadata":{}},{"cell_type":"code","source":"train_cite_target","metadata":{"execution":{"iopub.status.busy":"2022-08-18T11:38:11.079895Z","iopub.execute_input":"2022-08-18T11:38:11.080379Z","iopub.status.idle":"2022-08-18T11:38:11.146083Z","shell.execute_reply.started":"2022-08-18T11:38:11.080341Z","shell.execute_reply":"2022-08-18T11:38:11.144939Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_cite_target.info()","metadata":{"execution":{"iopub.status.busy":"2022-08-18T11:38:57.139075Z","iopub.execute_input":"2022-08-18T11:38:57.139494Z","iopub.status.idle":"2022-08-18T11:38:57.160113Z","shell.execute_reply.started":"2022-08-18T11:38:57.139463Z","shell.execute_reply":"2022-08-18T11:38:57.159133Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_cite_target.describe()","metadata":{"execution":{"iopub.status.busy":"2022-08-18T11:39:12.382726Z","iopub.execute_input":"2022-08-18T11:39:12.383336Z","iopub.status.idle":"2022-08-18T11:39:13.146071Z","shell.execute_reply.started":"2022-08-18T11:39:12.383301Z","shell.execute_reply":"2022-08-18T11:39:13.144861Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_cite_target.corr()","metadata":{"execution":{"iopub.status.busy":"2022-08-18T11:40:21.808726Z","iopub.execute_input":"2022-08-18T11:40:21.809730Z","iopub.status.idle":"2022-08-18T11:40:25.670305Z","shell.execute_reply.started":"2022-08-18T11:40:21.809666Z","shell.execute_reply":"2022-08-18T11:40:25.669328Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**WORK IN PROCESS :)**","metadata":{}}]}