{"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":"# Libraries","metadata":{}},{"cell_type":"code","source":"import numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport matplotlib.pyplot as plt\n%matplotlib inline","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2021-07-01T03:51:01.824978Z","iopub.execute_input":"2021-07-01T03:51:01.825400Z","iopub.status.idle":"2021-07-01T03:51:01.832698Z","shell.execute_reply.started":"2021-07-01T03:51:01.825314Z","shell.execute_reply":"2021-07-01T03:51:01.831340Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Reading the enriched training labels file","metadata":{}},{"cell_type":"code","source":"training_labels = pd.read_csv('../input/g2net-gravitational-wave-detection-file-paths/training_labels_with_paths.csv')","metadata":{"execution":{"iopub.status.busy":"2021-07-01T03:51:48.157077Z","iopub.execute_input":"2021-07-01T03:51:48.157432Z","iopub.status.idle":"2021-07-01T03:51:49.690611Z","shell.execute_reply.started":"2021-07-01T03:51:48.157402Z","shell.execute_reply":"2021-07-01T03:51:49.689360Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Sampling only positive or only negative samples and visulizing corresponding time series from LIGO Hanford","metadata":{}},{"cell_type":"code","source":"_, axs = plt.subplots(10, 2, figsize=(12, 30), sharex=True, sharey=True)\n\npos_subsample = training_labels.loc[training_labels['target'] == 1, 'filepath'].sample(10)\nneg_subsample = training_labels.loc[training_labels['target'] == 0, 'filepath'].sample(10)\n\nfor row_i, pos_filepath in enumerate(pos_subsample):\n    pos_data = np.load(pos_filepath)\n    axs[row_i, 0].plot(pos_data[0], c='r')\n    \nfor row_i, neg_filepath in enumerate(neg_subsample):\n    neg_data = np.load(neg_filepath)\n    axs[row_i, 1].plot(neg_data[0], c='b')\n\naxs[0, 0].set_title('Positives', fontsize=15)\naxs[0, 1].set_title('Negatives', fontsize=15)\nplt.suptitle('Visual comparison of randomly sampled positive and negative samples', fontsize=19)","metadata":{"execution":{"iopub.status.busy":"2021-07-01T03:52:15.197419Z","iopub.execute_input":"2021-07-01T03:52:15.197766Z","iopub.status.idle":"2021-07-01T03:52:17.558618Z","shell.execute_reply.started":"2021-07-01T03:52:15.197737Z","shell.execute_reply":"2021-07-01T03:52:17.557250Z"},"trusted":true},"execution_count":null,"outputs":[]}]}