application_vnd.jupyter.stderr_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

data_path = './data'
train = pd.read_json(data_path + '/' + 'train.json')
test = pd.read_json(data_path + '/' + 'test.json')
submission = pd.read_csv(data_path + '/' + 'sample_submission.csv').set_index('id')

train_band_1 = np.array([np.array(band).astype(np.float32).reshape((75, 75)) for band in train.band_1])
train_band_2 = np.array([np.array(band).astype(np.float32).reshape((75, 75)) for band in train.band_2])
X_train = np.concatenate([train_band_1[:, :, :, np.newaxis], train_band_2[:, :, :, np.newaxis], ((train_band_1 + train_band_2) / 2)[:, :, :, np.newaxis]], axis=-1)
test_band_1 = np.array([np.array(band).astype(np.float32).reshape((75, 75)) for band in test.band_1])
test_band_2 = np.array([np.array(band).astype(np.float32).reshape((75, 75)) for band in test.band_2])
X_test = np.concatenate([test_band_1[:, :, :, np.newaxis], test_band_2[:, :, :, np.newaxis], ((test_band_1 + test_band_2) / 2)[:, :, :, np.newaxis]], axis=-1)
y = np.array([target for target in train.is_iceberg]).reshape((-1, 1))

X_min = np.min(X_train)
X_max = np.max(X_train)
X_train = (X_train - X_min) / (X_max - X_min)
X_test = (X_test - X_min) / (X_max - X_min)

fig, ax = plt.subplots(2, 4, figsize=[12, 8])
ax[0, 0].imshow(X_train[0, :, :, 0])
ax[0, 1].imshow(X_train[0, :, :, 2])
ax[0, 2].imshow(X_train[2, :, :, 0])
ax[0, 3].imshow(X_train[2, :, :, 2])
ax[1, 0].imshow(X_train[1, :, :, 0])
ax[1, 1].imshow(X_train[1, :, :, 2])
ax[1, 2].imshow(X_train[6, :, :, 0])
ax[1, 3].imshow(X_train[6, :, :, 2])