{"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 warnings # suppress warnings\nwarnings.filterwarnings('ignore')\n#:::::::::::::::::::::::::::::::::::\nimport os\nimport gc\nimport glob\nimport random\nimport numpy as np \nimport pandas as pd\nimport seaborn as sns\nfrom tqdm import tqdm\nfrom scipy import stats\nfrom pathlib import Path\nfrom itertools import groupby\n#:::::::::::::::::::::::::::::::::::\nimport matplotlib.pyplot as plt\nimport plotly.figure_factory as ff\nimport plotly.express as px\n%matplotlib inline\n!ls ../input/*","metadata":{"_kg_hide-input":true,"_kg_hide-output":false,"execution":{"iopub.status.busy":"2023-10-31T03:04:47.694647Z","iopub.execute_input":"2023-10-31T03:04:47.695014Z","iopub.status.idle":"2023-10-31T03:04:51.169110Z","shell.execute_reply.started":"2023-10-31T03:04:47.694984Z","shell.execute_reply":"2023-10-31T03:04:51.167683Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"prediction = pd.read_csv('/kaggle/input/mlp-mf-onehot-baseline-op-5/submission (35).csv')","metadata":{"execution":{"iopub.status.busy":"2023-10-31T03:04:51.172359Z","iopub.execute_input":"2023-10-31T03:04:51.173568Z","iopub.status.idle":"2023-10-31T03:04:54.691017Z","shell.execute_reply.started":"2023-10-31T03:04:51.173514Z","shell.execute_reply":"2023-10-31T03:04:54.690274Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import1 = pd.read_csv('../input/op2-603/op2_603.csv', index_col='id')\nimport1.shape","metadata":{"execution":{"iopub.status.busy":"2023-10-31T03:04:54.692217Z","iopub.execute_input":"2023-10-31T03:04:54.692695Z","iopub.status.idle":"2023-10-31T03:04:58.562264Z","shell.execute_reply.started":"2023-10-31T03:04:54.692667Z","shell.execute_reply":"2023-10-31T03:04:58.560649Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import2 = pd.read_csv('../input/op2-720/op2_720.csv', index_col='id')\nimport2.shape","metadata":{"execution":{"iopub.status.busy":"2023-10-31T03:04:58.564374Z","iopub.execute_input":"2023-10-31T03:04:58.564648Z","iopub.status.idle":"2023-10-31T03:05:02.691683Z","shell.execute_reply.started":"2023-10-31T03:04:58.564627Z","shell.execute_reply":"2023-10-31T03:05:02.690263Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import3 = pd.read_csv('../input/op2-604/submission_df.csv', index_col='id')\nimport3.shape","metadata":{"execution":{"iopub.status.busy":"2023-10-31T03:05:02.695860Z","iopub.execute_input":"2023-10-31T03:05:02.696233Z","iopub.status.idle":"2023-10-31T03:05:06.142362Z","shell.execute_reply.started":"2023-10-31T03:05:02.696204Z","shell.execute_reply":"2023-10-31T03:05:06.141352Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import4 = pd.read_csv('../input/op2-607/OP2_607.csv', index_col='id')\nimport4.shape","metadata":{"execution":{"iopub.status.busy":"2023-10-31T03:05:06.143511Z","iopub.execute_input":"2023-10-31T03:05:06.143810Z","iopub.status.idle":"2023-10-31T03:05:09.518416Z","shell.execute_reply.started":"2023-10-31T03:05:06.143783Z","shell.execute_reply":"2023-10-31T03:05:09.516903Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import5 = pd.read_csv('/kaggle/input/cf-sim/CF_submission_Multi_Sim.csv')\nimport5.shape","metadata":{"execution":{"iopub.status.busy":"2023-10-31T03:05:55.565147Z","iopub.execute_input":"2023-10-31T03:05:55.565604Z","iopub.status.idle":"2023-10-31T03:05:58.751322Z","shell.execute_reply.started":"2023-10-31T03:05:55.565577Z","shell.execute_reply":"2023-10-31T03:05:58.749984Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"de_train = pd.read_parquet('/kaggle/input/open-problems-single-cell-perturbations/de_train.parquet')","metadata":{"execution":{"iopub.status.busy":"2023-10-31T03:06:19.303870Z","iopub.execute_input":"2023-10-31T03:06:19.304495Z","iopub.status.idle":"2023-10-31T03:06:21.616143Z","shell.execute_reply.started":"2023-10-31T03:06:19.304444Z","shell.execute_reply":"2023-10-31T03:06:21.614745Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission = pd.read_csv('/kaggle/input/open-problems-single-cell-perturbations/sample_submission.csv')","metadata":{"execution":{"iopub.status.busy":"2023-10-31T03:06:25.075080Z","iopub.execute_input":"2023-10-31T03:06:25.075419Z","iopub.status.idle":"2023-10-31T03:06:27.883828Z","shell.execute_reply.started":"2023-10-31T03:06:25.075393Z","shell.execute_reply":"2023-10-31T03:06:27.882650Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"col = list(de_train.columns.tolist()[5:])\nsubmission = sample_submission.copy()\n\nsubmission[col] = (import1[col] *0.2) + (import2[col] *0.12) + (import3[col] *0.2) + (import5[col] *0.15) + (prediction[col] *0.33)\nsubmission.shape","metadata":{"execution":{"iopub.status.busy":"2023-10-31T03:06:29.940245Z","iopub.execute_input":"2023-10-31T03:06:29.940704Z","iopub.status.idle":"2023-10-31T03:06:38.149437Z","shell.execute_reply.started":"2023-10-31T03:06:29.940671Z","shell.execute_reply":"2023-10-31T03:06:38.148415Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"num_genes = len(submission.columns.tolist()[1:])\ngenes = submission.columns.tolist()[1:]","metadata":{"execution":{"iopub.status.busy":"2023-10-31T03:05:14.169764Z","iopub.status.idle":"2023-10-31T03:05:14.170151Z","shell.execute_reply.started":"2023-10-31T03:05:14.169964Z","shell.execute_reply":"2023-10-31T03:05:14.169982Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"N = random.randrange(num_genes)\n\nprint(':' *40)\nprint('Column number :', N)\nprint('Column name :', genes[N])\nprint(':' *40)\n\nhist_data = [submission.iloc[:, N + 1], import1.iloc[:, N + 1], import2.iloc[:, N + 1], import3.iloc[:, N + 1], import4.iloc[:, N + 1], prediction.iloc[:, N + 1]]\ngroup_labels = [f'model_{i}' for i in range(len(hist_data))]\n\nfig = ff.create_distplot(hist_data, group_labels, bin_size=.2, show_hist=False, show_rug=False)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2023-10-31T03:05:14.171528Z","iopub.status.idle":"2023-10-31T03:05:14.173089Z","shell.execute_reply.started":"2023-10-31T03:05:14.172850Z","shell.execute_reply":"2023-10-31T03:05:14.172872Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission","metadata":{"execution":{"iopub.status.busy":"2023-10-31T03:05:14.174411Z","iopub.status.idle":"2023-10-31T03:05:14.175588Z","shell.execute_reply.started":"2023-10-31T03:05:14.175338Z","shell.execute_reply":"2023-10-31T03:05:14.175363Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for c in sample_submission.columns.tolist():\n    sample_submission[c] = submission[c]\n","metadata":{"execution":{"iopub.status.busy":"2023-10-31T03:06:40.689092Z","iopub.execute_input":"2023-10-31T03:06:40.690733Z","iopub.status.idle":"2023-10-31T03:06:48.318484Z","shell.execute_reply.started":"2023-10-31T03:06:40.690656Z","shell.execute_reply":"2023-10-31T03:06:48.317236Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission","metadata":{"execution":{"iopub.status.busy":"2023-10-31T03:06:52.792586Z","iopub.execute_input":"2023-10-31T03:06:52.792959Z","iopub.status.idle":"2023-10-31T03:06:52.865259Z","shell.execute_reply.started":"2023-10-31T03:06:52.792899Z","shell.execute_reply":"2023-10-31T03:06:52.864109Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2023-10-31T03:05:14.178794Z","iopub.status.idle":"2023-10-31T03:05:14.179228Z","shell.execute_reply.started":"2023-10-31T03:05:14.179041Z","shell.execute_reply":"2023-10-31T03:05:14.179060Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<div class=\"alert alert-success\">  \n</div>\n\n<p style=\"border-bottom: 5px solid darkgray\"></p>","metadata":{}}]}