Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Images classification
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Saidi Aya
Images classification
Commits
bda06e60
Commit
bda06e60
authored
Nov 8, 2022
by
Saidi Aya
Browse files
Options
Downloads
Patches
Plain Diff
Update mlp.py
parent
06f5ead5
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
mlp.py
+5
-1
5 additions, 1 deletion
mlp.py
with
5 additions
and
1 deletion
mlp.py
+
5
−
1
View file @
bda06e60
import
numpy
as
np
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
math
import
random
from
read_cifar
import
*
#We are using the segmoid activation function
#We are using the segmoid activation function
def
segmoid
(
x
):
def
segmoid
(
x
):
return
1
/
(
1
+
np
.
exp
(
-
x
))
return
1
/
(
1
+
np
.
exp
(
-
x
))
...
@@ -19,7 +23,7 @@ def learn_once_mse(w1,b1,w2,b2,data,targets,learning_rate):
...
@@ -19,7 +23,7 @@ def learn_once_mse(w1,b1,w2,b2,data,targets,learning_rate):
A2
=
segmoid
(
np
.
matmul
(
A1
,
w2
)
+
b2
)
A2
=
segmoid
(
np
.
matmul
(
A1
,
w2
)
+
b2
)
#Let calculate the partial derivates
#Let calculate the partial derivates
#2
#2
D_A2
=
2
*
(
A2
-
t
r
agets
)
D_A2
=
2
*
(
A2
-
ta
r
gets
)
D_A2_T
=
np
.
matmul
(
A2
,(
1
-
A2
).
T
)
D_A2_T
=
np
.
matmul
(
A2
,(
1
-
A2
).
T
)
D_Z2
=
np
.
matmul
(
D_A2_T
,
D_A2
)
D_Z2
=
np
.
matmul
(
D_A2_T
,
D_A2
)
D_W2
=
np
.
matmul
(
A1
.
T
,
D_Z2
)
D_W2
=
np
.
matmul
(
A1
.
T
,
D_Z2
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment