{"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\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\nimport pyarrow.parquet as pq\nimport os\nprint(os.listdir(\"../input\"))\n\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\n# Any results you write to the current directory are saved as output.","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"%%time \n# Read in 5 signals\n# Each column contains one signal\nsubset_train = pq.read_pandas('../input/train.parquet', columns=[str(i) for i in range(5)]).to_pandas()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"684157c47bd309023d403175552287ff8668f853"},"cell_type":"code","source":"subset_train.info()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"eb236dfe038d1d6789ab0991e018a4c227ed4c53"},"cell_type":"code","source":"subset_train.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"3ad3cdf4ada7d1c81aa679842c61718c5b6bb6dd"},"cell_type":"code","source":"subset_train.tail()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"c971d263193c500574a7d6044271eca762628a63"},"cell_type":"code","source":"%%time\nmeta_train = pd.read_csv('../input/metadata_train.csv')\nmeta_test = pd.read_csv('../input/metadata_test.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"a8ca0df1e3a8e2f23a05f9e42aa6af36572e299d"},"cell_type":"code","source":"meta_train.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"be8eb8ae0940db45bcbe59ca0508cb8055c7d51a"},"cell_type":"code","source":"meta_test.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"5d651690ec9e6121142bdf4ff7c6a71cbb0abcbb"},"cell_type":"code","source":"meta_train.isna().sum()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"a45de185a102e1dca03674ea93a815b202cf39d3"},"cell_type":"code","source":"meta_test.isna().sum()","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-output":true,"trusted":true,"_uuid":"4d91863eb0cec07aef0365f7ebc0746759c8b2b5"},"cell_type":"code","source":"meta_train['signal_id']","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-output":true,"trusted":true,"_uuid":"52b98da095305cbe6cc7d783eda915425a61b7ec"},"cell_type":"code","source":"meta_test['signal_id']","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-output":true,"trusted":true,"_uuid":"9679c3369a31f9aa185d54513b938279b3e791e6"},"cell_type":"code","source":"meta_train['id_measurement'] # ID code for a trio of signals","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-output":true,"trusted":true,"_uuid":"2a1be34840cccb25455880ce1f12f37598e674c3"},"cell_type":"code","source":"meta_test['id_measurement']","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"8f713615b90cabc95621ae4ddbd938282db00679"},"cell_type":"markdown","source":"### Train and test signal_ids and id_measurements are sequential"},{"metadata":{"trusted":true,"_uuid":"b015d9b99ecb80e9bac2f21f4a9cfc6d815b0a86"},"cell_type":"code","source":"sns.countplot(meta_train['target']); # Quite unbalanced, 1 => fault in the power line","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"443bdbc671856a49119ef7e072dd975bb0e3298e"},"cell_type":"code","source":"meta_train['phase'].value_counts() # 3 phase values","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"7d97687c85bc4a2cd3c414607151ac80595d1327"},"cell_type":"code","source":"meta_test['phase'].value_counts() # 3 phase values","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"8fa052e320b0107651f5da7beb8be962fb638696"},"cell_type":"code","source":"sns.countplot(meta_train['phase']);","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1dd42f6c5ccbcc512349bb00430872e2f621382d"},"cell_type":"code","source":"sns.countplot(meta_test['phase']);","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"21b22a62cee04813371c094e0ab25f5c0042cc96"},"cell_type":"code","source":"subset_train.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"520f93b2a4d14890afbee61d872db58abfaa9f1e"},"cell_type":"code","source":"%%time \nsubset_test = pq.read_pandas('../input/test.parquet', columns=[str(i) for i in range(8712,8717)]).to_pandas()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"6121c1f8712a2cf6563bb699aaa537a10d3e03fa"},"cell_type":"code","source":"subset_test.shape","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"339103cbd20290ef56ab905b1cb712051feb308a"},"cell_type":"code","source":"subset_test.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"e3b76b3ebbee6724f25cea000c1efcc4daecbc1a"},"cell_type":"code","source":"subset_test.tail()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"91d65e5db3c7ca70efc2c99c1a8a81a70f8bb7c3"},"cell_type":"code","source":"meta_train.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"07a9b5d97a147c8169d8b1267944007b827ed2a9"},"cell_type":"code","source":"# Let's look at some of the signals\n\nfig, ((ax1, ax2), (ax3,ax4)) = plt.subplots(2,2, figsize=(12,12))\nax1.hist(subset_train['0'], bins=100);\nax2.hist(subset_train['1'], bins=100)\nax3.hist(subset_train['2'], bins=100)\nax4.hist(subset_train['3'], bins=100);","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"895040ba2658fcf118ae857e8ed593366ca96f65"},"cell_type":"code","source":"# How well does just the phase reflect the target?\nmeta_train.corr()['target']\n# Not very well it seems","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"6359492961a7860f597b0a0101ff0cc2afbe1055"},"cell_type":"markdown","source":".. to be continued"}],"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}