{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"#worsened score from 0.992 to 1.001\n#improved SVM score from 1.382 to 1.139\n#dfnn=pd.read_csv(\"../input/mergeneural512newparamsless/mergeNeuralNTPost99.csv\")\n\n# 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":{"trusted":true,"_uuid":"b8e39e5733fd342f4837bcca31e919fd91c27b39"},"cell_type":"code","source":"pdf=pd.read_csv(\"../input/mergeneural512newparamsless/mergeNeuralNTPost99.csv\")\npdf.shape\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"a72d0f65e255d25f37bee17a5c632c3094d6b54d"},"cell_type":"code","source":"pdf.describe()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"ca6beee9c133821abdea3318c2739c920117745e"},"cell_type":"code","source":"import copy\n\ndef alterProbabilities(odf, sqrt=False):\n    df=copy.deepcopy(odf)\n    for cindex in df.columns:\n        df['adjSum']=0\n        if cindex != 'object_id':\n            df.loc[:,'not_' + str(cindex)]=1.0 - df.loc[:,cindex]\n            zeroFilter=(df.loc[:,'not_' + str(cindex)]==0)\n            df.loc[zeroFilter,'adj_' + str(cindex)]=999999\n            df.loc[~zeroFilter,'adj_' + str(cindex)]=df.loc[~zeroFilter,cindex] / df.loc[~zeroFilter,'not_' + str(cindex)]\n            if sqrt:\n                df['adj_' + str(cindex)]=np.sqrt(df['adj_' + str(cindex)])\n                \n            #df.loc[:,'adjSum']+=df.loc[:,'adj_' + str(cindex)]\n    \n    for cindex in odf.columns:\n        if cindex !='object_id':\n            df.loc[:,'adjSum']+=df.loc[:,'adj_' + str(cindex)]\n        \n\n    for cindex in odf.columns:\n        if cindex !='object_id':\n            odf.loc[:,cindex]=df.loc[:,'adj_' + str(cindex)] / df.loc[:,'adjSum']\n        \n    return odf, df\n\ns, os=alterProbabilities(pdf)\ns.head()\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"29cbdd63e5d4e88fedc63ecc90c0a4aeb8d16bf4"},"cell_type":"code","source":"os.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c1fd2e0cae60d5b6ffd45d96ad577625c6d62501"},"cell_type":"code","source":"s.describe()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"103ae2199f4542d8ef9e885b4483ce3c21d69a28"},"cell_type":"code","source":"os.describe()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1e695be7be19d4553b6a5c9bd134e1ef861d31d6"},"cell_type":"code","source":"#from Scirpus discussion:\n\ndef GenUnknown(data):\n    return ((((((data[\"mymedian\"]) + (((data[\"mymean\"]) / 2.0)))/2.0)) + (((((1.0) - (((data[\"mymax\"]) * (((data[\"mymax\"]) * (data[\"mymax\"]))))))) / 2.0)))/2.0)\n\nfeats = ['class_6', 'class_15', 'class_16', 'class_42', 'class_52', 'class_53',\n         'class_62', 'class_64', 'class_65', 'class_67', 'class_88', 'class_90',\n         'class_92', 'class_95']\n\ny = pd.DataFrame()\ny['mymean'] = s[feats].mean(axis=1)\ny['mymedian'] = s[feats].median(axis=1)\ny['mymax'] = s[feats].max(axis=1)\n\ns['class_99'] = GenUnknown(y)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"321fa5adabced557b33ead870d452b02395619ad"},"cell_type":"code","source":"s.describe()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"f475a2d5f36283145d2fc921aa5238aea5b3eca6"},"cell_type":"code","source":"s.to_csv('moreDecisiveNeural.csv', index=False)","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}