{"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":1,"outputs":[{"output_type":"stream","text":"['vsb-power-line-fault-detection', 'vsb-competition-base-neural-network', '5-fold-lstm-attention-fully-commented']\n","name":"stdout"}]},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"out1=pd.read_csv('../input/vsb-competition-base-neural-network/submission.csv')","execution_count":7,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"out2=pd.read_csv('../input/5-fold-lstm-attention-fully-commented/submission.csv')","execution_count":8,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"out1['5-fold']=out2['target']","execution_count":5,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"out1['target2']=out2.target","execution_count":17,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"out1['target']=pd.Categorical(out1['target'])\nout1['target2']=pd.Categorical(out1['target2'])","execution_count":23,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"pd.crosstab(out1.target,out1.target2)","execution_count":24,"outputs":[{"output_type":"execute_result","execution_count":24,"data":{"text/plain":"target2      0    1\ntarget             \n0        19389   57\n1          159  732","text/html":"<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th>target2</th>\n      <th>0</th>\n      <th>1</th>\n    </tr>\n    <tr>\n      <th>target</th>\n      <th></th>\n      <th></th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>19389</td>\n      <td>57</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>159</td>\n      <td>732</td>\n    </tr>\n  </tbody>\n</table>\n</div>"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"out2['target']=pd.to_numeric(out1['target'])+pd.to_numeric(out1['target2'])","execution_count":27,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"out2.loc[out2['target']==2,'target']=1","execution_count":29,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"out2['target'].value_counts()","execution_count":39,"outputs":[{"output_type":"execute_result","execution_count":39,"data":{"text/plain":"0    19389\n1      948\nName: target, dtype: int64"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"out2.to_csv('blending_addition.csv',index=False)","execution_count":32,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"out3=out2.copy()","execution_count":33,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"out3['target']=pd.to_numeric(out1['target'])*pd.to_numeric(out1['target2'])","execution_count":42,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"out3.loc[out3['target']==-1,'target']=0","execution_count":43,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"out3.target.value_counts()","execution_count":44,"outputs":[{"output_type":"execute_result","execution_count":44,"data":{"text/plain":"0    19605\n1      732\nName: target, dtype: int64"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"out3.to_csv('blending_multiplication.csv',index=False)","execution_count":45,"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}