{"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\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 read-only \"../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\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 5GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"fold1='/kaggle/input/all-results/'\nfold2='/kaggle/input/fold-2-inception-v3-all/'\nfold3='/kaggle/input/fold-3-inception-v3-all/'\nfold4='/kaggle/input/all-results/'\nfold5='/kaggle/input/fold-5-all/'","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true},"cell_type":"code","source":"from sklearn.metrics import confusion_matrix\n\nans_1=np.load(fold1+'answers_last_fold1.npy',allow_pickle=True).item()\nfold_1_pre=np.load(fold1+'predictions_last_fold1.npy',allow_pickle=True).item()\nans_1=list(ans_1.values())[0]\nfold_1_pre=list(fold_1_pre.values())[0]\nprint(confusion_matrix(ans_1,fold_1_pre))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"\nans_1=np.load(fold1+'answers_last_fold1.npy',allow_pickle=True).item()\nfold_1_pre=np.load(fold1+'predictions_last_best_fold1.npy',allow_pickle=True).item()\nans_1=list(ans_1.values())[0]\nfold_1_pre=list(fold_1_pre.values())[0]\nprint(confusion_matrix(ans_1,fold_1_pre))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"ans_1=np.load(fold2+'answers_last_fold2.npy',allow_pickle=True).item()\nfold_1_pre=np.load(fold2+'predictions_last_fold2.npy',allow_pickle=True).item()\nans_1=list(ans_1.values())[0]\nfold_1_pre=list(fold_1_pre.values())[0]\nprint(confusion_matrix(ans_1,fold_1_pre))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"\nans_1=np.load(fold2+'answers_last_fold2.npy',allow_pickle=True).item()\nfold_1_pre=np.load(fold2+'predictions_last_best_fold2.npy',allow_pickle=True).item()\nans_1=list(ans_1.values())[0]\nfold_1_pre=list(fold_1_pre.values())[0]\nprint(confusion_matrix(ans_1,fold_1_pre))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"ans_1=np.load(fold3+'answers_last_fold3.npy',allow_pickle=True).item()\nfold_1_pre=np.load(fold3+'predictions_last_fold3.npy',allow_pickle=True).item()\nans_1=list(ans_1.values())[0]\nfold_1_pre=list(fold_1_pre.values())[0]\nprint(confusion_matrix(ans_1,fold_1_pre))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"ans_1=np.load(fold3+'answers_last_fold3.npy',allow_pickle=True).item()\nfold_1_pre=np.load(fold3+'predictions_last_best_fold3.npy',allow_pickle=True).item()\nans_1=list(ans_1.values())[0]\nfold_1_pre=list(fold_1_pre.values())[0]\nprint(confusion_matrix(ans_1,fold_1_pre))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"ans_1=np.load(fold4+'answers_last_fold4.npy',allow_pickle=True).item()\nfold_1_pre=np.load(fold4+'predictions_last_fold4.npy',allow_pickle=True).item()\nans_1=list(ans_1.values())[0]\nfold_1_pre=list(fold_1_pre.values())[0]\nprint(confusion_matrix(ans_1,fold_1_pre))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"ans_1=np.load(fold4+'answers_last_fold4.npy',allow_pickle=True).item()\nfold_1_pre=np.load(fold4+'predictions_last_best_fold4.npy',allow_pickle=True).item()\nans_1=list(ans_1.values())[0]\nfold_1_pre=list(fold_1_pre.values())[0]\nprint(confusion_matrix(ans_1,fold_1_pre))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"\nans_1=np.load(fold5+'answers_last_fold5.npy',allow_pickle=True).item()\nfold_1_pre=np.load(fold5+'predictions_last_fold5.npy',allow_pickle=True).item()\nans_1=list(ans_1.values())[0]\nfold_1_pre=list(fold_1_pre.values())[0]\nprint(confusion_matrix(ans_1,fold_1_pre))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"\nans_1=np.load(fold5+'answers_last_fold5.npy',allow_pickle=True).item()\nfold_1_pre=np.load(fold5+'predictions_last_best_fold5.npy',allow_pickle=True).item()\nans_1=list(ans_1.values())[0]\nfold_1_pre=list(fold_1_pre.values())[0]\nprint(confusion_matrix(ans_1,fold_1_pre))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"fnl_time1=list(np.load(fold1+'times_last_fold1.npy',allow_pickle=True).item().values())[0]\nfnl_time2=list(np.load(fold2+'times_last_fold2.npy',allow_pickle=True).item().values())[0]\nfnl_time3=list(np.load(fold3+'times_last_fold3.npy',allow_pickle=True).item().values())[0]\nfnl_time4=list(np.load(fold4+'times_last_fold4.npy',allow_pickle=True).item().values())[0]\nfnl_time5=list(np.load(fold5+'times_last_fold5.npy',allow_pickle=True).item().values())[0]\nnp.mean([fnl_time1,fnl_time2,fnl_time3,fnl_time4,fnl_time5])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"fnl_time1=list(np.load(fold1+'final_accuracy_last_fold1.npy',allow_pickle=True).item().values())[0]\nfnl_time2=list(np.load(fold2+'final_accuracy_last_fold2.npy',allow_pickle=True).item().values())[0]\nfnl_time3=list(np.load(fold3+'final_accuracy_last_fold3.npy',allow_pickle=True).item().values())[0]\nfnl_time4=list(np.load(fold4+'final_accuracy_last_fold4.npy',allow_pickle=True).item().values())[0]\nfnl_time5=list(np.load(fold5+'final_accuracy_last_fold5.npy',allow_pickle=True).item().values())[0]\nnp.mean([fnl_time1,fnl_time2,fnl_time3,fnl_time4,fnl_time5])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"fnl_time1=list(np.load(fold1+'best_accuracy_last_fold1.npy',allow_pickle=True).item().values())[0]\nfnl_time2=list(np.load(fold2+'best_accuracy_last_fold2.npy',allow_pickle=True).item().values())[0]\nfnl_time3=list(np.load(fold3+'best_accuracy_last_fold3.npy',allow_pickle=True).item().values())[0]\nfnl_time4=list(np.load(fold4+'best_accuracy_last_fold4.npy',allow_pickle=True).item().values())[0]\nfnl_time5=list(np.load(fold5+'best_accuracy_last_fold5.npy',allow_pickle=True).item().values())[0]\nnp.mean([fnl_time1,fnl_time2,fnl_time3,fnl_time4,fnl_time5])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"\nhistory={}\nhistory['fold1']=np.load(fold1+'history_last_fold1.npy',allow_pickle=True).item()\nhistory['fold2']=np.load(fold2+'history_last_fold2.npy',allow_pickle=True).item()\nhistory['fold3']=np.load(fold3+'history_last_fold3.npy',allow_pickle=True).item()\nhistory['fold4']=np.load(fold4+'history_last_fold4.npy',allow_pickle=True).item()\nhistory['fold5']=np.load(fold5+'history_last_fold5.npy',allow_pickle=True).item()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"from matplotlib import pyplot as plt\nfor i in range(5):\n    fold='fold'+str(i+1)\n    fold1='fold_'+str(i+1)\n    plt.plot(history[fold][fold1]['accuracy'])\n    plt.title('loss for fold '+str(i))\n    plt.xlabel('epoch')\n    plt.ylabel('accuracy')\n    plt.title('Training all layers')\n    plt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"from matplotlib import pyplot as plt\nfor i in range(5):\n    fold='fold'+str(i+1)\n    fold1='fold_'+str(i+1)\n    plt.plot(history[fold][fold1]['loss'])\n    plt.title('loss for fold '+str(i))\n    plt.xlabel('epoch')\n    plt.ylabel('loss')\n    plt.title('Training all layers')\n    plt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"from matplotlib import pyplot as plt\nfor i in range(5):\n    fold='fold'+str(i+1)\n    fold1='fold_'+str(i+1)\n    plt.plot(history[fold][fold1]['val_loss'])\n    plt.title('loss for fold '+str(i))\n    plt.xlabel('epoch')\n    plt.ylabel('val_loss')\n    plt.title('Training all layers')\n    plt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"from matplotlib import pyplot as plt\nfor i in range(5):\n    fold='fold'+str(i+1)\n    fold1='fold_'+str(i+1)\n    plt.plot(history[fold][fold1]['val_accuracy'])\n    plt.title('loss for fold '+str(i))\n    plt.xlabel('epoch')\n    plt.ylabel('val_accuracy')\n    plt.title('Training all layers')\n    plt.show()","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}