{"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":"markdown","source":"Notebook is copied from HHACHE \nhttps://www.kaggle.com/code/hhache/scp-blends-streamlined\n\nUsed submission from JJLEE's \"[0.583] Ensemble Submition OP\" notebook\nhttps://www.kaggle.com/code/jjleesunny/0-583-ensemble-submition-op?scriptVersionId=148293371\n\nI would like to thank authors for sharing your submissions and datasets","metadata":{}},{"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        pass\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","execution":{"iopub.status.busy":"2023-11-07T12:31:57.754158Z","iopub.execute_input":"2023-11-07T12:31:57.754567Z","iopub.status.idle":"2023-11-07T12:31:58.186555Z","shell.execute_reply.started":"2023-11-07T12:31:57.754537Z","shell.execute_reply":"2023-11-07T12:31:58.185709Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"s720 = pd.read_csv('/kaggle/input/op2-720/op2_720.csv', index_col='id')\ns607 = pd.read_csv('/kaggle/input/op2-607/OP2_607.csv', index_col='id')\ns604 = pd.read_csv('/kaggle/input/op2-604/submission_preds/kaggle/working/submission_df.csv', index_col='id')\ns603 = pd.read_csv('/kaggle/input/op2-603/op2_603.csv', index_col='id')\n\ns617_Priors = pd.read_csv('/kaggle/input/open-problems-2-submits-collection/LB617_Priors0802noModel_Lonnie_nbV6.csv' , index_col='id')\n\ns635_PytorchEmbed = pd.read_csv('/kaggle/input/open-problems-2-submits-collection/LB635_PytorchEmbeds_Alex_nbV1.csv', index_col='id')\n\ns621_Conv1D = pd.read_csv('/kaggle/input/open-problems-2-submits-collection/LB621_Conv1D_Lonnie_nbV24.csv' , index_col='id')\n\ns633_NN_Kibira = pd.read_csv('/kaggle/input/open-problems-2-submits-collection/LB633_NN_Kibira_nbV1.csv' , index_col='id')\n\ns599_NN6Layers = pd.read_csv('/kaggle/input/open-problems-2-submits-collection/LB599_NN6LayersMAEonehot_CheldievaBasedOnKishan_nbV3.csv', index_col='id')\n\ns664_LGB = pd.read_csv('/kaggle/input/open-problems-2-submits-collection/LB664_LGB_MehranHhache_nbV2.csv', index_col='id')\n\ns603_Ridge_Chembert = pd.read_csv('/kaggle/input/open-problems-2-submits-collection/LB603_RidgeAlpha06ChembertClsEncodingCompoundCellTypTSVD30blendWithPriors04501_NicolenkoBasedAlex_nbV4.csv', index_col='id')\n\ns608_SVR = pd.read_csv('/kaggle/input/open-problems-single-cell-perturbations-submitsetc/LB0608_0607_tsvd50_SVR_target_enc_i_th_target_BothEncoded_10-17-01-33_V202/submission_Random_20_42.csv', index_col='id')\n\ns608_CATB = pd.read_csv('/kaggle/input/open-problems-single-cell-perturbations-submitsetc/LB0608_tsvd25_CATB_target_enc_i_th_target_BothEncoded_10-18-13-29_V254/submission_Random_20_42.csv', index_col='id')\n\n\n# 0.588: blend = (s603+s720+s604+s607)/4\n# 0.586 blend = (0.8/3*s603+0.2*s720+0.8/3*s604+0.8/3*s607)\n# 0.587 blend = (0.3*s603+0.1*s720+0.3*s604+0.3*s607)\n# 0.592 blend = (1.0/3*s603+0.0*s720+1.0/3*s604+1.0/3*s607)\n\n# 0.590 blend = (1.0/3*s603+0.0*s720+1.0/3*s599_NN6Layers+1.0/3*s607)\n\n# 0.585 blend = (0.8/3*s603+0.2*s720+0.8/3*s599_NN6Layers+0.8/3*s607)\n\n# 0.583 blend = (0.8/3*s603+0.2*s720+0.8/3*s599_NN6Layers+0.8/3*s607)*0.9 + 0.1*(s664_LGB)\n\n# 0.583 (a bit higher) blend = (0.8/3*(s603+s603_Ridge_Chembert)/2+0.2*s720+0.8/3*s599_NN6Layers+0.8/3*s607)*0.9 + 0.1*(s664_LGB)\n\n# 0.585 blend = (0.8/3*(s603+s603_Ridge_Chembert)/2+0.2*s720+0.8/3*s599_NN6Layers+0.8/3*(s607 + s608_SVR + s608_CATB)/3)*0.9 + 0.1*(s664_LGB)\n\n# 0.582 blend = (0.8/3*(s603+s603_Ridge_Chembert + (s608_SVR + s608_CATB)/2)/3+0.2*s720+0.8/3*s599_NN6Layers+0.8/3*(s607))*0.9 + 0.1*(s664_LGB)\n\n### here we start the blend with JJLEE's submission\n### we retrieved JJLEE's prediction by subtracting all other public sumbissions\nimport1 = pd.read_csv('/kaggle/input/op2-603/op2_603.csv', index_col='id')\nimport2 = pd.read_csv('/kaggle/input/op2-720/op2_720.csv', index_col='id')\nimport3 = pd.read_csv('/kaggle/input/op2-604/submission_df.csv', index_col='id')\nimport4 = pd.read_csv('/kaggle/input/op2-607/OP2_607.csv', index_col='id')\ns583_ensemble_submit = pd.read_csv('/kaggle/input/0-583-ensemble-submit-dataset/submission.csv', index_col='id')\n\n# retrieve prediction from JJLEE's notebook\nprediction = (s583_ensemble_submit - import1*0.2 - import2*0.12 - import3*0.2 - import4*0.15) / 0.33\n\n#(0.583 a bit higher) blend \nbest_blend = (0.8/3*(s603+s603_Ridge_Chembert)/2+0.2*s720+0.8/3*s599_NN6Layers+0.8/3*s607)*0.9 + 0.1*(s664_LGB)\n\n# 0.58 blend = best_blend*0.8 + prediction*0.2\n\nblend_0582 = (0.8/3*(s603+s603_Ridge_Chembert + (s608_SVR + s608_CATB)/2)/3+0.2*s720+0.8/3*s599_NN6Layers+0.8/3*(s607))*0.9 + 0.1*(s664_LGB)\n# 0.581 blend = blend_0582*0.8 + prediction*0.2\nblend = blend_0582*0.8 + prediction*0.2\n\n# See https://www.kaggle.com/competitions/open-problems-single-cell-perturbations/discussion/453110#2513189\n\n# 0.587 blend = (0.8/3*s603+0.2*s720+0.8/3*s604+0.8/3*s607)*0.8+ 0.2*s617_Priors\n\n# 0.587 blend = (0.8/3*s603+0.2*s720+0.8/3*s604+0.8/3*s607)*0.85+ 0.15*s635_PytorchEmbed\n\n# 0.587 blend = (0.8/3*s603+0.2*s720+0.8/3*s604+0.8/3*s607)*0.9+ 0.1*s621_Conv1D\n\n# 0.587 blend = (0.8/3*s603+0.2*s720+0.8/3*s604+0.8/3*s607)*0.9+ 0.1/3*(s621_Conv1D + s635_PytorchEmbed + s633_NN_Kibira )\n\n\n\nblend.to_csv('submission.csv')","metadata":{"execution":{"iopub.status.busy":"2023-11-07T12:31:58.188585Z","iopub.execute_input":"2023-11-07T12:31:58.189686Z","iopub.status.idle":"2023-11-07T12:32:38.582285Z","shell.execute_reply.started":"2023-11-07T12:31:58.189653Z","shell.execute_reply":"2023-11-07T12:32:38.581265Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# !cp /kaggle/input/3-op2-feature-augmentation-lightgbm/prediction.csv submit_featureaugmentationlightgbm_from_prediction.csv","metadata":{"execution":{"iopub.status.busy":"2023-11-07T12:32:38.583510Z","iopub.execute_input":"2023-11-07T12:32:38.584195Z","iopub.status.idle":"2023-11-07T12:32:38.588843Z","shell.execute_reply.started":"2023-11-07T12:32:38.584166Z","shell.execute_reply":"2023-11-07T12:32:38.587515Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}