fix these later
This commit is contained in:
parent
bd6bffde48
commit
0222103c7f
@ -1,10 +1,10 @@
|
|||||||
# Sigmoid
|
# Sigmoid
|
||||||
σ(x) = 1 ./ (1 + exp.(-x))
|
σ(x) = 1 ./ (1 + exp.(-x))
|
||||||
back!(::typeof(σ), Δ, x) = Δ .* σ(x).*(1.-σ(x))
|
# back!(::typeof(σ), Δ, x) = Δ .* σ(x).*(1.-σ(x))
|
||||||
|
|
||||||
# Rectified Linear Unit
|
# Rectified Linear Unit
|
||||||
relu(x) = max(0, x)
|
relu(x) = max(0, x)
|
||||||
back!(::typeof(relu), Δ, x) = Δ .* (x .> 0)
|
# back!(::typeof(relu), Δ, x) = Δ .* (x .> 0)
|
||||||
|
|
||||||
softmax(xs) = exp.(xs) ./ sum(exp.(xs), 2)
|
softmax(xs) = exp.(xs) ./ sum(exp.(xs), 2)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
mse(ŷ, y) = sumabs2(ŷ .- y)/2
|
mse(ŷ, y) = sumabs2(ŷ .- y)/2
|
||||||
|
|
||||||
back!(::typeof(mse), Δ, ŷ, y) = Δ .* (ŷ .- y)
|
# back!(::typeof(mse), Δ, ŷ, y) = Δ .* (ŷ .- y)
|
||||||
|
|
||||||
logloss(ŷ, y) = -sum(y .* log.(ŷ))
|
logloss(ŷ, y) = -sum(y .* log.(ŷ))
|
||||||
|
|
||||||
back!(::typeof(logloss), Δ, ŷ, y) = 0 .- Δ .* y ./ ŷ
|
# back!(::typeof(logloss), Δ, ŷ, y) = 0 .- Δ .* y ./ ŷ
|
||||||
|
Loading…
Reference in New Issue
Block a user