FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
DeepLearningIntro/DeepLearningIntro/Tutorial.py at master · Fletch153/DeepLearningIntro · GitHub
Fletch153
/
DeepLearningIntro
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
DeepLearningIntro
/
DeepLearningIntro
/
Tutorial.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
33 lines (18 loc) · 850 Bytes
Breadcrumbs
DeepLearningIntro
/
DeepLearningIntro
/
Tutorial.py
Copy path
File metadata and controls
33 lines (18 loc) · 850 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import
tensorflow
as
tf
import
matplotlib
.
pyplot
as
plt
import
numpy
as
np
mnist
=
tf
.
keras
.
datasets
.
mnist
# 28x28 images of hand-written digits 0-9
(
x_train
,
y_train
), (
x_test
,
y_test
)
=
mnist
.
load_data
()
x_train
=
tf
.
keras
.
utils
.
normalize
(
x_train
,
axis
=
1
)
x_test
=
tf
.
keras
.
utils
.
normalize
(
x_test
,
axis
=
1
)
model
=
tf
.
keras
.
models
.
Sequential
()
model
.
add
(
tf
.
keras
.
layers
.
Flatten
())
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
128
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
128
,
activation
=
tf
.
nn
.
relu
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
10
,
activation
=
tf
.
nn
.
softmax
))
model
.
compile
(
optimizer
=
'adam'
,
loss
=
'sparse_categorical_crossentropy'
,
metrics
=
[
'accuracy'
])
model
.
fit
(
x_train
,
y_train
,
epochs
=
1
)
predictions
=
model
.
predict
([
x_test
])
print
(
"Prediction for first letter:"
,
np
.
argmax
(
predictions
[
0
]))
plt
.
imshow
(
x_test
[
0
])
plt
.
show
()
Back
|
FazBrowse Home
|
New Git URL