{"cells":[{"metadata":{},"cell_type":"markdown","source":"Use @Dieter 's post process to test  whether my submission can increase the lb score.\n","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"'''\nversion 1: only change es language values, then my lb score jump from 0.950  to 0.9503\nversion 2: only change es and fr language values, then my lb score jump from 0.950  to 0.9504\nversion 3: change  5 language values, then my lb score jump from 0.950  to 0.9509\n\n'''","execution_count":null,"outputs":[]},{"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)\nimport torch\n# Input data files are available in the \"../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\nos.listdir('../input/jigsaw-multilingual-toxic-comment-classification')\n\n# Any results you write to the current directory are saved as output.","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"#0.9476\ntest0 = pd.read_csv('/kaggle/input/fastsub-test/submission.csv')\ntest0.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"#lb 0.9494\ntest1 = pd.read_csv('/kaggle/input/kernel0531v4/submission.csv')\ntest1.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"#lb 0.9478\ntest2 = pd.read_csv('/kaggle/input/jmtfstsub0407/submission.csv')\ntest2.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"#This result should be lb 0.950\ntest3 = test1.copy()\ntest3['toxic'] = test1['toxic']*0.55 + 0.45*(test0['toxic']*0.5+test2['toxic']*0.5)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# do the post process","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"test=pd.read_csv('../input/jigsaw-multilingual-toxic-comment-classification/test.csv')\ntest3=pd.merge(test3,test,on='id')\ntest3.head()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"## We  change 5 language values","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"test3.loc[test3[\"lang\"] == \"es\", \"toxic\"] *= 1.06\ntest3.loc[test3[\"lang\"] == \"fr\", \"toxic\"] *= 1.04\ntest3.loc[test3[\"lang\"] == \"it\", \"toxic\"] *= 0.97\ntest3.loc[test3[\"lang\"] == \"pt\", \"toxic\"] *= 0.96\ntest3.loc[test3[\"lang\"] == \"tr\", \"toxic\"] *= 0.98","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"test3.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"test3[['id','toxic']].to_csv('submission.csv', index=False)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"test3['l']=test1['toxic']\ntest3.corr()","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}