Question: data = [ [ 4 , 3 , 1 , 1 ] , [ 2 , 3 , 0 . 5 , 0 ] ,
data
mysteryAnimal
def sigmoidx:
return npexpx
def sigmoidpx:
return sigmoidxsigmoidx
def train:
w
w
w
wb
Iterations
learningrate
Costs
For i in rangeiterations:
ri nprandom.randintlendata
point datari
z point w point w point w b
pred sigmoidz
target point
cost npsquarepred target
if I :
c
For j in rangelendata:
p dataj
ppred sigmoidw p w p w p b
c npsquareppred p
costs.appendc
dcostdpred pred target
dpreddz sigmoidpz
dzdw point
dzdw point
dzdw point
dzdb
dcostdz dcostdpred dpreddz
dcostdw dcostdz dzdw
dcostdw dcostdz dzdw
dcostdw dcostdz dzdw
dzdb dcostdz dzdb
w w learningrate dcostdw
w w learningrate dcostdw
w w learningrate dcostdw
b b learningrate dcostdb
return costs, w w w b
costs, w w w b train
z wmysteryAnimal wmysteryAnimal wmysteryAnimal b
pred sigmoidz
printpred can you fix this code I want to print the updated weights for epoch also I want the graph
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
