Getting Started With Kaggle Digit Recognizer Competition

Soumik Rakshit
Apr 18 · 5 min read

What’s this competition all about???

How to start???

LeNet-5 Architecture

On With the Code….

Output:

['train.csv', 'sample_submission.csv', 'test.csv']

Output:

Exploring the data

Output:

Number of images in training dataset: 42000
Number of pixels in each image in training dataset: 784
Number of images in test dataset: 28000
Number of pixels in each image in test dataset: 784

Preprocessing the Data

Output:

((42000, 1024), (28000, 1024))

Output:

Shape of Training Labels: (42000,)
Shape of y_train after encoding: (42000, 10)

Building LeNet-5

Trainig LeNet-5

Output:

Epoch 500, Cost: 28595476.4296875, Accuracy: 73.4375 %
Epoch 1000, Cost: 5947898.984375, Accuracy: 86.71875 %
Epoch 1500, Cost: 7127918.71875, Accuracy: 88.28125 %
Epoch 2000, Cost: 3046355.96875, Accuracy: 92.96875 %
Epoch 2500, Cost: 3755678.59375, Accuracy: 93.75 %
Epoch 3000, Cost: 1928981.6875, Accuracy: 92.1875 %
Epoch 3500, Cost: 769532.8125, Accuracy: 96.875 %
Epoch 4000, Cost: 1833259.3125, Accuracy: 93.75 %
Epoch 4500, Cost: 1317497.5, Accuracy: 96.09375 %
Epoch 5000, Cost: 1188782.34375, Accuracy: 93.75 %
Epoch 5500, Cost: 267834.515625, Accuracy: 98.4375 %
Epoch 6000, Cost: 1112221.875, Accuracy: 96.09375 %
Epoch 6500, Cost: 467607.857421875, Accuracy: 94.53125 %
Epoch 7000, Cost: 400827.03125, Accuracy: 97.65625 %
Epoch 7500, Cost: 22324.25, Accuracy: 99.21875 %
Epoch 8000, Cost: 394928.5625, Accuracy: 98.4375 %
Epoch 8500, Cost: 71348.0625, Accuracy: 99.21875 %
Epoch 9000, Cost: 0.0, Accuracy: 100.0 %
Epoch 9500, Cost: 24381.53125, Accuracy: 99.21875 %
Epoch 10000, Cost: 10489.375, Accuracy: 98.4375 %
----------------------------------------------------------------------

Optimization Finished

Accuracy on Training Data: 98.4071433544159 %

Output:

Output:

Making Predictions:

Output:

array([2, 0, 9, ..., 3, 9, 2])

Making Kaggle Submission

Koderunners

We believe in Open Source, Open Education and Open Innovations

Soumik Rakshit

Written by

Chief Technology Officer at DeepWrex Technologies || Machine Learning Researcher

Koderunners

We believe in Open Source, Open Education and Open Innovations