{"cells":[{"metadata":{},"cell_type":"markdown","source":"## RANZCR Quick Submission Template\n\nKaggle runs the submission on a private dataset so there is no need to do inference or training while saving the notebook. This simple template uses this fact to help saving time and GPU ressources during submission.\n\nWhat it does:\n* during saving it will just copy the `sample_submission.csv`.\n* it will detect if it is run against the private dataset since `sample_submission.csv` is different in the private environment. As far as I can see this does not count towards the GPU quota.\n* if you want to run everything during saving (for debugging etc.) choose `QUICKRUN=False` "},{"metadata":{"trusted":true},"cell_type":"code","source":"import numpy as np\nimport pandas as pd","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"QUICKRUN=True\n\nimport hashlib\nstream = open('../input/ranzcr-clip-catheter-line-classification/sample_submission.csv','rb').read()\nif QUICKRUN and hashlib.md5(stream).hexdigest()=='3bf8eb33a1a25f1f79940d019c18ebbc':\n    #just copy sample_submission.csv\n    f=open('submission.csv','wb')\n    f.write(stream)\n    f.close()\nelse:\n    df_test = pd.read_csv('../input/ranzcr-clip-catheter-line-classification/sample_submission.csv')\n    Y_COLS = df_test.columns[1:]\n    \n    \n    #everything time consuming like training and inference goes here\n    preds = np.ones((len(df_test), len(Y_COLS)))\n    \n    df_test[Y_COLS] = preds\n    df_test.to_csv('submission.csv', index=False)\n    ","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"#just showing what we are submitting\ndf = pd.read_csv('submission.csv')\ndf.head()","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}