Last active
March 21, 2018 18:00
-
-
Save yoga1290/6ea0e57dd493d4148ac7f0183c1647eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@startuml | |
/' | |
PUML: https://gist.github.com/yoga1290/6ea0e57dd493d4148ac7f0183c1647eb | |
SVG: http://www.plantuml.com/plantuml/svg/RLDRJzim67tFhpY21spMDCae5yfbT4oRngIrOftQlXGvjPjOoYLAN9N2-E-p7KH2gIhPhh_lN1mVtrIAbMgL9evtW5YfekfxNYGhrOsaYbTXTv6dtYQFMF3vtFTE1FF5yIddlVCZtWjwPsnnklI3iwD5SD8x5U7-KYR2ZKh6fSWK5zL2JswXwN7WELRAAVGWbSmpo4pFB95F0iyEq0zn1V_2hDPwbHNT9r7c5I5SfXq4bDhIJ9T0WWxIFiGZIuj4L1JxKB50maAHL1VEY-EKeX1CEHhHwErz7zvF1lVVCBeVZWO_1kEVmzzxLbhpNgPCnTULZ596dgWM2Jo209-qI45SlKClFTjoqUv7p1Gskhi6JkPZJ3KcR9hRtIEo-VTek9-9nNKWbnOTq0v801VljttQVtabiZHRBBNsVDE2qZa9t0tz24ho26_03VHVKWEqMminMmtFRl-tmpzZ3RyZwmv2G-I2e5gbPBPDg2iVA65-7jBMTtpPkg2lWzjVksweRO9Fj33XTzGZV4rj6gOuF8ILdscr6PsFjuKQTDYWxH68zlz0v9LFvodg8ymbN3FIzomx_FujE5FYBKCJk5T812ipcKKFfIxX47poQY3SMGthxr3d5UjO9W94Ac7gNwZZjDH6fU1oOTQrOerfdwweE-pzT32rKGC9JA3U4aeanTIC9gTcfhZMKUiUcmpww21NiIZNiX9D-ep7BOUuD2ymMwMXA94lcxTeNb-byiAv4HdNB_y_ | |
PNG: http://www.plantuml.com/plantuml/png/RLDRJzim67tFhpY21spMDCae5yfbT4oRngIrOftQlXGvjPjOoYLAN9N2-E-p7KH2gIhPhh_lN1mVtrIAbMgL9evtW5YfekfxNYGhrOsaYbTXTv6dtYQFMF3vtFTE1FF5yIddlVCZtWjwPsnnklI3iwD5SD8x5U7-KYR2ZKh6fSWK5zL2JswXwN7WELRAAVGWbSmpo4pFB95F0iyEq0zn1V_2hDPwbHNT9r7c5I5SfXq4bDhIJ9T0WWxIFiGZIuj4L1JxKB50maAHL1VEY-EKeX1CEHhHwErz7zvF1lVVCBeVZWO_1kEVmzzxLbhpNgPCnTULZ596dgWM2Jo209-qI45SlKClFTjoqUv7p1Gskhi6JkPZJ3KcR9hRtIEo-VTek9-9nNKWbnOTq0v801VljttQVtabiZHRBBNsVDE2qZa9t0tz24ho26_03VHVKWEqMminMmtFRl-tmpzZ3RyZwmv2G-I2e5gbPBPDg2iVA65-7jBMTtpPkg2lWzjVksweRO9Fj33XTzGZV4rj6gOuF8ILdscr6PsFjuKQTDYWxH68zlz0v9LFvodg8ymbN3FIzomx_FujE5FYBKCJk5T812ipcKKFfIxX47poQY3SMGthxr3d5UjO9W94Ac7gNwZZjDH6fU1oOTQrOerfdwweE-pzT32rKGC9JA3U4aeanTIC9gTcfhZMKUiUcmpww21NiIZNiX9D-ep7BOUuD2ymMwMXA94lcxTeNb-byiAv4HdNB_y_ | |
'/ | |
start | |
partition initialize { | |
:b = 0; | |
:w = np.zeros((dim, 1)); | |
:Y = (1, m: examples) # the labels; | |
} | |
repeat | |
partition "FORWARD PROPAGATION" { | |
:<math>sigma(z) = 1/( 1 + exp(-z) )</math>; | |
:<math> hat y = sigma(W^T X + b)</math>; | |
:<math>P(y|x) = {(hat y, if y = 1), (1 - hat y, if y = 0):}</math> | |
<math>P(y|x) = hat y ^y (1 - hat y)^(1-y)</math> | |
<math>log P(y|x) = y log(hat y) + (1-y) log(1 - hat y)</math>; | |
:<math>COST = J(w, b) = - ( sum(Y log(hat y) + (1 - y) log(1 - hat y) ) ) / m</math>; | |
} | |
partition "BACKWARD PROPAGATION" { | |
:<math>dW = (dJ)/(dw) = (X ** (hat Y - Y)^T) / m</math>; | |
:<math>db = (dJ)/(db) = (sum_(i=0)^m (hat y^i - y^i)) / m</math>; | |
} | |
partition "Update" { | |
:W -= learning_rate * dW; | |
:b -= learning_rate * db; | |
} | |
repeat while (iterate?) | |
partition "Prediction" { | |
repeat | |
:<math>predict(w, b, X) = { (1, if sigma(W^(i) X^(i) + b^(i)) >= 0.5), (0 , otherwise):}</math>; | |
repeat while (i < m: number of examples) | |
} | |
stop | |
@enduml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment