{"cells":[{"metadata":{},"cell_type":"markdown","source":"## Data if Kagging","execution_count":null},{"metadata":{},"cell_type":"markdown","source":"Credit to origin author for MinMaxBestBaseStacking (https://github.com/QuantScientist/Deep-Learning-Boot-Camp/blob/master/Kaggle-PyTorch/PyTorch-Ensembler/utils.py)\n\n","execution_count":null},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport os","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"sub_path = \"../input/topmysubmission/\"\nall_files = os.listdir(sub_path)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"all_files","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# from IPython.display import display\n# for f in all_files:\n#     display(pd.read_csv(sub_path+f).head())","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true},"cell_type":"code","source":"# outs = [pd.read_csv(os.path.join(sub_path, f), index_col=0) for f in all_files if '.csv' in f and '_me' in f]\nouts = [pd.read_csv(os.path.join(sub_path, f), index_col=0) for f in all_files if '.csv' in f]\n\nconcat_sub = pd.concat(outs, axis=1)\ncols = list(map(lambda x: \"target\" + str(x), range(len(concat_sub.columns))))\nconcat_sub.columns = cols\nconcat_sub.reset_index(inplace=True)\nconcat_sub.head()\nncol = concat_sub.shape[1]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# get the data fields ready for stacking\nconcat_sub['target_mean'] = concat_sub.iloc[:, 1:ncol].mean(axis=1)\nconcat_sub['target_median'] = concat_sub.iloc[:, 1:ncol].median(axis=1)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"concat_sub.describe()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"concat_sub['target'] = concat_sub['target_mean']\n# concat_sub[['image_name', 'target']].to_csv('submission_mean.csv', \n#                                         index=False, float_format='%.6f')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# concat_sub['target'] = concat_sub['target_median']\n# concat_sub[['image_name', 'target']].to_csv('submission_median.csv', \n#                                         index=False, float_format='%.6f')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# loading recently created .csv files from working directory\neff = pd.read_csv('../input/topmysubmission/submission (9) - 9507.csv')\nmeta = pd.read_csv('../input/analysis-of-melanoma-metadata-and-effnet-ensemble/meta_simplified_img_data.csv')\nsample = pd.read_csv('../input/siim-isic-melanoma-classification/sample_submission.csv')\n\n\nsample['target'] = (\n                           \n                           eff['target'] * 0.9 +\n                           meta['target'] * 0.1 \n                          \n                          )\n\n# final submissions\n\nsample.to_csv('fin_submission.csv', header=True, index=False)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"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":4,"nbformat_minor":4}