knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

devtools::load_all('./../R')

Each neuron is composed of three layers:

Non linear neuron logical unit

Logical unit itself is composed of:

Non linear input unit

Non linear input unit behaviour

x <- seq(0.1, 1.99, length.out = 100)

plot(x, propagation(as.yan.neuronLogicalUnitInput(-1.5), x), col='dark green', type = 'l', xlab = 'x', ylab = 'y')
lines(x, propagation(as.yan.neuronLogicalUnitInput(-0.5), x), col='green', type = 'l')
lines(x, propagation(as.yan.neuronLogicalUnitInput(1.5), x), col='blue', type = 'l')
lines(x, propagation(as.yan.neuronLogicalUnitInput(5.5), x), col='dark blue', type = 'l')

legend(0.5, 14, legend=c("cutOff=-1.5", "cutOff=-0.5", "cutOff=1.5", "cutOff=5.5"), col=c('dark green', 'green', 'blue', 'dark blue'), lty=c(1,1,1,1))
a <- seq(-10, 10, length.out = 100)

plot(a, sapply(a, function(av) propagation(as.yan.neuronLogicalUnitInput(av), 1)), col='green', type = 'l', xlab = 'a', ylab = 'y')
lines(a, sapply(a, function(av) propagation(as.yan.neuronLogicalUnitInput(av), 1.1)), col='blue', type = 'l')
lines(a, sapply(a, function(av) propagation(as.yan.neuronLogicalUnitInput(av), 0.9)), col='red', type = 'l')

legend(-2, 10, legend=c("x=1", "x=1.1", "x=0.9"), col=c('green', 'blue', 'red'), lty=c(1,1,1))

Derrivatives

model <- as.yan.neuronLogicalUnitInput(2)
x <- seq(0.1, 1.99, length.out = 100)
y <- propagation(model, x)
dy <- backpropagation(model, x, y)

plot(x, y, col='yellow', type = 'l', xlab = 'x', ylab = 'y')
lines(x, dy$dX, col='green', type = 'l')
lines(x, dy$dCutOff, col='blue', type = 'l')

legend(0.5, 4, legend=c("y", "d_y/d_x", "d_y/d_cutOff"), col=c('yellow', 'green', 'blue'), lty=c(1,1,1))
model <- as.yan.neuronLogicalUnitInput(-2)
x <- seq(0.7, 5, length.out = 100)
y <- propagation(model, x)
dy <- backpropagation(model, x, y)

plot(x, y, col='yellow', type = 'l', xlab = 'x', ylab = 'y', ylim=c(min(c(y, dy$dX, dy$dCutOff)), max(c(y, dy$dX, dy$dCutOff))))
lines(x, dy$dX, col='green', type = 'l')
lines(x, dy$dCutOff, col='blue', type = 'l')

legend(2, -1, legend=c("y", "d_y/d_x", "d_y/d_cutOff"), col=c('yellow', 'green', 'blue'), lty=c(1,1,1))


tomaszbiegacz/yan documentation built on May 3, 2019, 1:33 p.m.