/
kaggle_word_recognition.py
46 lines (32 loc) · 1.02 KB
/
kaggle_word_recognition.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# -*- coding: utf-8 -*-
"""Kaggle Word Recognition.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1Q24ashIKvQmdBmCv5rhWB7nMSaczxWgE
"""
!mkdir /root/.kaggle
import json
token = {"username":"you0824","key":"2e8ee96ce1abc9b4987d15cc7ce7be75"}
with open('/root/.kaggle/kaggle.json', 'w') as file:
json.dump(token, file)
!chmod 600 /root/.kaggle/kaggle.json
!ls /root/.kaggle
!kaggle competitions download -c titanic
import pandas as pd
train = pd.read_csv("train.csv")
print(train.shape)
train.head()
!kaggle competitions download --force digit-recognizer
import seaborn as sns
sns.set(style='white', context='notebook', palette='deep')
train = pd.read_csv("train.csv")
y_train = train["label"].values
g = sns.countplot(y_train)
import matplotlib.pyplot as plt
X_train = train.drop("label", axis=1).values
y_train = train["label"].values
print(X_train.shape)
plt.imshow(X_train[7, :].reshape(28, 28), cmap='gray')
plt.xticks([])
plt.yticks([])
plt.show()