Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Heetak Chung
ML11_P1_G1
Commits
337545f7
Commit
337545f7
authored
May 16, 2018
by
Artem Oppermann
Browse files
final version
parent
48452bdf
Changes
3
Hide whitespace changes
Inline
Side-by-side
model v2/__pycache__/get_mnist.cpython-36.pyc
0 → 100644
View file @
337545f7
File added
model v2/get_mnist.py
View file @
337545f7
...
...
@@ -24,4 +24,4 @@ def get_mnist_data(n_samples=5000):
return
mnist_data
#data=get_mnist_data()
\ No newline at end of file
data
=
get_mnist_data
()
\ No newline at end of file
model v2/model_mnist.py
View file @
337545f7
...
...
@@ -10,6 +10,7 @@ val_after_iter= 10 # evaluate the training process after number of iterations
#n_samples= 500 # how many data samples should be used during training
learning_rate
=
0.1
# learning rate
n_epoch
=
20
class
Model
:
...
...
@@ -80,10 +81,11 @@ class Model:
@param data: matrix that contains 100 features and 1 label
'''
random
.
shuffle
(
data
)
for
epoch
in
range
(
0
,
1
):
for
epoch
in
range
(
0
,
n_epoch
):
random
.
shuffle
(
data
)
outputs
=
[]
error
=
0
...
...
@@ -97,7 +99,7 @@ class Model:
x
=
np
.
reshape
(
x
,
[
784
,
1
])
#bring the features into right shape
zeros
=
np
.
zeros
(
shape
=
[
N_OUTPUT
,
1
])
zeros
[
label
]
=
1
zeros
[
int
(
label
)
]
=
1
y
=
zeros
z_
=
[]
# storage of neurons values before activation
...
...
@@ -148,7 +150,7 @@ class Model:
if
__name__
==
"__main__"
:
data
=
get_mnist_data
()
data
=
get_mnist_data
(
n_samples
=
5000
)
model
=
Model
()
model
.
train
(
data
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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