{"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_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import jo_wilder","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-03-27T02:10:33.905431Z","iopub.execute_input":"2023-03-27T02:10:33.906235Z","iopub.status.idle":"2023-03-27T02:10:33.950143Z","shell.execute_reply.started":"2023-03-27T02:10:33.906180Z","shell.execute_reply":"2023-03-27T02:10:33.949279Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"env = jo_wilder.make_env()\niter_test = env.iter_test()","metadata":{"execution":{"iopub.status.busy":"2023-03-27T02:10:33.951945Z","iopub.execute_input":"2023-03-27T02:10:33.952561Z","iopub.status.idle":"2023-03-27T02:10:33.957063Z","shell.execute_reply.started":"2023-03-27T02:10:33.952524Z","shell.execute_reply":"2023-03-27T02:10:33.956041Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"correct_array = [1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1]\n\nfor (test, df) in iter_test:\n    df = df \\\n        .assign(question=lambda df: df['session_id'].str.extract(r'_q(\\d+)').astype(int)) \\\n        .assign(correct=lambda df: df['question'].apply(lambda q: correct_array[q - 1])) \\\n        .drop(columns=['question'])\n\n    env.predict(df)","metadata":{"execution":{"iopub.status.busy":"2023-03-27T02:10:33.958395Z","iopub.execute_input":"2023-03-27T02:10:33.958964Z","iopub.status.idle":"2023-03-27T02:10:34.039622Z","shell.execute_reply.started":"2023-03-27T02:10:33.958930Z","shell.execute_reply":"2023-03-27T02:10:34.038469Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# confirm submission file\nimport pandas as pd\ndf = pd.read_csv('submission.csv')\nprint(df.shape)\n#df.sample(n=10)\nprint(df.head(10))","metadata":{"execution":{"iopub.status.busy":"2023-03-27T02:10:34.041737Z","iopub.execute_input":"2023-03-27T02:10:34.042054Z","iopub.status.idle":"2023-03-27T02:10:34.057502Z","shell.execute_reply.started":"2023-03-27T02:10:34.042024Z","shell.execute_reply":"2023-03-27T02:10:34.055491Z"},"trusted":true},"execution_count":null,"outputs":[]}]}