{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"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 in \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 \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nimport os\nprint(os.listdir(\"../input\"))\n\n# Any results you write to the current directory are saved as output.","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"from subprocess import check_output\nprint(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"def get_winner(cand_main, cand_sub1, cand_sub2):\n    if(cand_sub1==cand_sub2):\n        return cand_sub1\n    else:\n        return cand_main","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"아래의 세 개의 submission파일은 모두 https://www.kaggle.com/seriousran/what-0-95121-model-failed 에서 조금 수정하여 만들었으나, weight파일을 가지고 있지 않은 관계로 submission파일을 직접 이용하여 일종의 다수결 voting을 적용하였습니다. (사용된 모델은 EfficientNetB3, Xception, InceptionV3입니다. 약간의 hyperparameter tuning은 있었습니다.)\n\n(이후에 tta등을 적용한 실험들도 하였으나, 시간상 제출을 하지 못하여 해당 제출물이 최종본으로 남게 되었습니다.)"},{"metadata":{"trusted":true},"cell_type":"code","source":"df3 = pd.read_csv('../input/submissions/submission_LB94835.csv')\ndf2 = pd.read_csv('../input/submissions/submission_LB95026.csv')\ndf1 = pd.read_csv('../input/submissions/submission_LB95456.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"subm_df=pd.DataFrame(columns=['img_file', 'class', 'class1', 'class2', 'class3'])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"subm_df['img_file']=df1['img_file']","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"subm_df['class1']=df1['class']\nsubm_df['class2']=df2['class']\nsubm_df['class3']=df3['class']","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"subm_df['class']=subm_df.apply(lambda row : get_winner(row['class1'], row['class2'], row['class3']), axis=1)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"subm_df.drop(['class1','class2', 'class3'], axis=1, inplace=True)\nsubm_df.to_csv('./submission.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.4","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}