{"cells":[{"metadata":{"_uuid":"b4f02200c4954f540f650bae7a5943504772c0b9"},"cell_type":"markdown","source":"# Overview\nWe take the first box for each individual, and predict the average location of that box with a confidence based on the probability of having pneumonia."},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"import pandas as pd\ntrain = pd.read_csv('../input/stage_1_train_labels.csv')","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"#We only want to focus on 1 box per person\ntrain = train.drop_duplicates('patientId')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"5ca1a8b312345cda773eda7725c1dd23091d85ee"},"cell_type":"code","source":"train.head(10)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"cc6af2297829b3b7783abe8f5127d3a55fe42169"},"cell_type":"code","source":"probability_of_pneumonia = train['Target'].sum() / train.shape[0]\nprobability_of_pneumonia","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"a7ffbbfd1615d16246caf78a6287ac1a9b89283d"},"cell_type":"code","source":"xAvg = round(train['x'].mean())\nwidthAvg = round(train['width'].mean())\nyAvg = round(train['y'].mean())\nheightAvg = round(train['height'].mean())","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"9bca251a9148a0a222463b8f6ddfe35263a2672e"},"cell_type":"code","source":"sub = pd.read_csv(\"../input/stage_1_sample_submission.csv\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"69031008a9fbb8e482ffb31faea4a02cc559196f"},"cell_type":"code","source":"preds = str(probability_of_pneumonia) + ' ' + str(xAvg) + ' ' + str(yAvg) + ' ' + str(widthAvg) + ' ' + str(heightAvg)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"7f3b88f94d76850fefd4021e38e80fc1f15f2c66"},"cell_type":"code","source":"preds","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1e776c7295cc41896be17a1c939ab15b9b532671"},"cell_type":"code","source":"sub['PredictionString'] = preds","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"8eaa3758a17967ea530c4d8a6423cbf5b193c3b5"},"cell_type":"code","source":"sub.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"840827b9b4d417241ec7ed0cb20a31e3fd6aff34"},"cell_type":"code","source":"sub.to_csv('mean_predictions.csv',index=False)","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}