{"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":"markdown","source":"# ADAMS SoSe 2022 Assignment Demo\nThis notebook demonstartes how to make a sample submission to the ADAMS SoSe 2022 competition.\n","metadata":{}},{"cell_type":"code","source":"###### PACKAGES\n\nimport numpy  as np \nimport pandas as pd ","metadata":{"execution":{"iopub.status.busy":"2022-06-09T11:13:50.107988Z","iopub.execute_input":"2022-06-09T11:13:50.108906Z","iopub.status.idle":"2022-06-09T11:13:50.132434Z","shell.execute_reply.started":"2022-06-09T11:13:50.108815Z","shell.execute_reply":"2022-06-09T11:13:50.131648Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"##### FILE OVERVIEW\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))","metadata":{"execution":{"iopub.status.busy":"2022-06-09T11:14:01.775633Z","iopub.execute_input":"2022-06-09T11:14:01.776003Z","iopub.status.idle":"2022-06-09T11:14:01.782848Z","shell.execute_reply.started":"2022-06-09T11:14:01.775973Z","shell.execute_reply":"2022-06-09T11:14:01.781869Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"##### IMPORT DATA\n\ntrain = pd.read_csv('/kaggle/input/adams-sose22/train.csv')\ntest  = pd.read_csv('/kaggle/input/adams-sose22/test.csv')\nprint(train.shape, test.shape)","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-06-09T11:14:35.317157Z","iopub.execute_input":"2022-06-09T11:14:35.317548Z","iopub.status.idle":"2022-06-09T11:14:41.051032Z","shell.execute_reply.started":"2022-06-09T11:14:35.317517Z","shell.execute_reply":"2022-06-09T11:14:41.050198Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"##### COMPUTE MEAN PRICE OVER TRAINING DATA\n\nmean_price = train['price'].mean()\nmean_price","metadata":{"execution":{"iopub.status.busy":"2022-06-09T11:14:58.865273Z","iopub.execute_input":"2022-06-09T11:14:58.865656Z","iopub.status.idle":"2022-06-09T11:14:58.880644Z","shell.execute_reply.started":"2022-06-09T11:14:58.865629Z","shell.execute_reply":"2022-06-09T11:14:58.879523Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"##### PREPARE A NAIVE SUBMISSION\n\ntest['price'] = mean_price\nsubmission    = test[['listing_id', 'price']]\n\nsubmission.to_csv('sample_submission.csv', index = False)\nsubmission.head()","metadata":{"execution":{"iopub.status.busy":"2022-06-09T11:15:35.383163Z","iopub.execute_input":"2022-06-09T11:15:35.384119Z","iopub.status.idle":"2022-06-09T11:15:35.482387Z","shell.execute_reply.started":"2022-06-09T11:15:35.384076Z","shell.execute_reply":"2022-06-09T11:15:35.481348Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The CSV file just created is stored in your Kaggle working directory. ","metadata":{}},{"cell_type":"code","source":"##### LOCATE CSV FILE IN THE WORKING DIRECTORY\nfor dirname, _, filenames in os.walk('/kaggle/working'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))","metadata":{"execution":{"iopub.status.busy":"2022-06-09T11:20:52.74173Z","iopub.execute_input":"2022-06-09T11:20:52.742085Z","iopub.status.idle":"2022-06-09T11:20:52.747196Z","shell.execute_reply.started":"2022-06-09T11:20:52.742059Z","shell.execute_reply":"2022-06-09T11:20:52.746238Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Notice the panel on the right side of your screen. You will see headers inputs and, after running the notebook and creating the CSV file, also outputs. Clicking on outputs gives you access to the CSV file. You can download it and then submit to the ADAMS competition. There are also ways to automate this step, that is creating a submission entry directly from a notebook. However, the caveat is that a direct submission does not work for notebooks that you run on your computer, Google Colab, other other resources. Put differently, making a direct submission requires you to run your notebook on Kaggle. You find an example [here](https://www.kaggle.com/code/dansbecker/submitting-from-a-kernel/notebook) if interested but do not adopt this approach because it makes you publish your notebook, which could facilitate peer students to access your notebook.  ","metadata":{}},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}