text_plain_output_1.png
import numpy as np

import pandas as pd

dataset = pd.read_csv('../input/train.csv')
test = pd.read_csv('../input/test.csv')

def one_hot(num):
    output = np.zeros([1, 10])
    output[0, num] = 1
    return output.astype(int)

labels_encoded = np.array([np.array([int(i == l) for i in range(10)]) for l in dataset.iloc[:, 0].values])
dataset = dataset.drop('label', axis=1)
(dataset.shape, labels_encoded.shape)

train_size = 40000
validation_size = 2000

train = dataset.iloc[:train_size]
train_targets = labels_encoded[:train_size]
validation = dataset.iloc[train_size:]
validation_targets = labels_encoded[train_size:]
(train.shape, train_targets.shape, validation.shape, validation_targets.shape, test.shape)