Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
CHILD INTELLIGENT ASSESSMENT TOOL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2020-046
CHILD INTELLIGENT ASSESSMENT TOOL
Commits
b7f5f30d
Commit
b7f5f30d
authored
Nov 02, 2020
by
Dasun Madushanka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update bcpModel_Sequetail.py
parent
1f24a8f0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
bcpModel_Sequetail.py
bcpModel_Sequetail.py
+9
-4
No files found.
bcpModel_Sequetail.py
View file @
b7f5f30d
...
@@ -4,8 +4,11 @@
...
@@ -4,8 +4,11 @@
# In[13]:
# In[13]:
#add the tensorflow package
import
tensorflow
as
tf
import
tensorflow
as
tf
#assign values to parameters
mnist
=
tf
.
keras
.
datasets
.
mnist
mnist
=
tf
.
keras
.
datasets
.
mnist
(
x_train
,
y_train
),
(
x_test
,
y_test
)
=
mnist
.
load_data
()
(
x_train
,
y_train
),
(
x_test
,
y_test
)
=
mnist
.
load_data
()
...
@@ -13,6 +16,8 @@ mnist = tf.keras.datasets.mnist
...
@@ -13,6 +16,8 @@ mnist = tf.keras.datasets.mnist
x_train
=
tf
.
keras
.
utils
.
normalize
(
x_train
,
axis
=
1
)
x_train
=
tf
.
keras
.
utils
.
normalize
(
x_train
,
axis
=
1
)
x_test
=
tf
.
keras
.
utils
.
normalize
(
x_test
,
axis
=
1
)
x_test
=
tf
.
keras
.
utils
.
normalize
(
x_test
,
axis
=
1
)
#convential neural network archtecture
#change the parameters- add4 sequentail layers and chenge epochs to 40
model
=
tf
.
keras
.
models
.
Sequential
()
model
=
tf
.
keras
.
models
.
Sequential
()
model
.
add
(
tf
.
keras
.
layers
.
Flatten
())
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
))
...
@@ -20,12 +25,12 @@ model.add(tf.keras.layers.Dense(128, activation=tf.nn.relu))
...
@@ -20,12 +25,12 @@ model.add(tf.keras.layers.Dense(128, activation=tf.nn.relu))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
10
,
activation
=
tf
.
nn
.
softmax
))
model
.
add
(
tf
.
keras
.
layers
.
Dense
(
10
,
activation
=
tf
.
nn
.
softmax
))
model
.
compile
(
optimizer
=
'adam'
,
loss
=
'sparse_categorical_crossentropy'
,
model
.
compile
(
optimizer
=
'adam'
,
loss
=
'sparse_categorical_crossentropy'
,
metrics
=
[
'accuracy'
])
metrics
=
[
'accuracy'
])
model
.
fit
(
x_train
,
y_train
,
epochs
=
3
)
model
.
fit
(
x_train
,
y_train
,
epochs
=
40
)
# In[14]:
# In[14]:
#genrare accuracy level
val_loss
,
val_acc
=
model
.
evaluate
(
x_test
,
y_test
)
val_loss
,
val_acc
=
model
.
evaluate
(
x_test
,
y_test
)
print
(
val_loss
,
val_acc
)
print
(
val_loss
,
val_acc
)
...
@@ -34,7 +39,7 @@ print(val_loss,val_acc)
...
@@ -34,7 +39,7 @@ print(val_loss,val_acc)
# In[11]:
# In[11]:
#view plot diagram
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
...
@@ -45,7 +50,7 @@ print(x_train[0])
...
@@ -45,7 +50,7 @@ print(x_train[0])
# In[36]:
# In[36]:
#save the model
model
.
save
(
"num_reader.model"
)
model
.
save
(
"num_reader.model"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment