-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUntitled.py
117 lines (44 loc) · 995 Bytes
/
Untitled.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import pandas as pd
import matplotlib.pyplot as plt, matplotlib.image as mpimg
from sklearn.model_selection import train_test_split
from sklearn import svm
get_ipython().run_line_magic('matplotlib', 'inline')
# In[5]:
labeled_images = pd.read_csv('./train.csv')
# In[6]:
labeled_images.shape
# In[7]:
images = labeled_images.iloc[0:5000,1:]
# In[8]:
images.shape
# In[17]:
labeled_images.iloc[:6,:6]
# In[18]:
labels = labeled_images.iloc[0:5000,:1]
# In[22]:
labels.head(30)
# In[26]:
train_images, test_images,train_labels, test_labels = train_test_split(images, labels, train_size=0.8, random_state=0)
# In[27]:
train_images.shape
# In[28]:
test_images.shape
# In[29]:
train_labels.shape
# In[31]:
i=1
img=train_images.iloc[i].as_matrix()
# In[32]:
img
# In[33]:
i=1
img=train_images.iloc[i]
# In[35]:
img.shape
# In[37]:
i=1
img=train_images.iloc[i].as_matrix()
# In[ ]: