{"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\n# Linear algebra\nimport numpy as np\n# Data processing, CSV file I/O (e.g. pd.read_csv)\nimport pandas as pd \nimport os\n# Keras\nfrom keras.preprocessing.image import ImageDataGenerator, load_img\nfrom keras.models import Sequential\nfrom keras.layers import Conv2D, MaxPooling2D\nfrom keras.layers import Activation, Dropout, Flatten, Dense\nfrom keras import backend as K\n# Input data files are available in the \"../input/\" directory.","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","collapsed":true,"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":false},"cell_type":"markdown","source":"# Global constants"},{"metadata":{"trusted":true,"_uuid":"b73888ac91fdce80c1f07ec732c8e4a43e81503c"},"cell_type":"code","source":"# Directories\ntrain_directory=\"../input/stage_2_train_images/\"\ntest_directory=\"../input/stage_2_test_images/\"\nvalidate_samples = 2560","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"9ef90dba632b3bd2b7798d70613644c21294dbb7"},"cell_type":"markdown","source":"# Split data for train and validation"},{"metadata":{"trusted":true,"_uuid":"d9c148233552598c90c2c7b5ce10450a1d0114f9"},"cell_type":"code","source":"filenames = os.listdir(train_directory)\nprint(len(filenames))\ntrain_filenames= filenames[validate_samples:]\nvalidate_filenames= filenames[:validate_samples]\ntrain_filenames_lenght=len(train_filenames)\nvalidate_filenames_lenght=len(validate_filenames)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"78fdb97c26ac1ef202cf215acda2c20e2046e209"},"cell_type":"markdown","source":"# Pneumonia Location"},{"metadata":{"trusted":true,"_uuid":"a9c3b4d91fd4267c3355ea2c0eca1b2564e0dc68"},"cell_type":"code","source":"train_df = pd.read_csv('../input/stage_2_train_labels.csv')\ntrain_df.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"735289889e3c0d0f3cdeac0468e0ca60c98a16c3"},"cell_type":"code","source":"pneumonia_locations=train_df[train_df.Target != 0]\n# Sort by patientId\npneumonia_locations.groupby(['patientId'], sort=False)\npneumonia_locations.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"7aa833ec93573c22e8a9ae35ccd91ff4222927c4"},"cell_type":"code","source":"any(train_df['patientId'].duplicated())","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}