{"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\nimport keras\nfrom keras.models import load_model\nfrom keras import Model\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":"inception_cnn = load_model(\"../input/mnist-inception-cnn-keras/model_acc.best.hdf5\")\ninception_cnn_datagen = load_model(\"../input/mnist-inception-cnn-data-gen/model_acc_inception_datagen.best.hdf5\")\ncnn = load_model(\"../input/mnist-cnn-kernel/model_cnn_acc.best.hdf5\")\ncnn_datagen = load_model(\"../input/mnist-cnn-using-imagedatagenerator/model_gen_cnn_acc.best.hdf5\")\ninception_cnn_datagen_even = load_model(\"../input/mnist-inception-cnn-data-gen-even/model_acc_inception_datagen.best.hdf5\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c0e6015a7f748994c0a1bd659bbc447e22ad2eb5"},"cell_type":"code","source":"test_data = pd.read_csv(\"../input/digit-recognizer/test.csv\")\ntest_data = test_data / 255\nX_test = np.array(test_data.loc[:,:])\nX_test = X_test.reshape(X_test.shape[0],28,28,1)\nX_test.shape","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"7486f2d7cca0388d707b54cb5d0e52bb32c96536"},"cell_type":"code","source":"predictions_inception_cnn = inception_cnn.predict(X_test)\npredictions_inception_cnn_datagen = inception_cnn_datagen.predict(X_test)\npredictions_cnn = cnn.predict(X_test)\npredictions_cnn_datagen = cnn_datagen.predict(X_test)\npredictions_cnn_datagen_even = inception_cnn_datagen_even.predict(X_test)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"3867d1a867b372cc0f62c6e7650e70d4978d41c4"},"cell_type":"code","source":"predictions = predictions_inception_cnn + predictions_inception_cnn_datagen + predictions_cnn + predictions_cnn_datagen + predictions_cnn_datagen_even\npredictions = predictions / 5","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"2a2ff4614663b86546558b141ab053ce8ab2e510"},"cell_type":"code","source":"predictions = np.argmax(predictions,axis = 1)\npredictions = pd.Series(predictions,name=\"Label\")\n\nsubmission = pd.concat([pd.Series(range(1,test_data.shape[0]+1),name = \"ImageId\"),predictions],axis = 1)\nsubmission.to_csv(\"cnn_mnist_load_model.csv\",index=False)\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"f0b4fbbd0b42247d5a6c4be881cc3c460eabaeaf"},"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.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}