Description Usage Arguments Value Examples
Integrate a feedforward Linear Leaky Integrate and Fire Network via forward Euler.
1 | lif_forward_R(n_in, l_h, n_h, n_out, Ws, Fin, t_eps, t_steps)
|
n_in |
The number of input neurons, a scalar integer. |
l_h |
The number of hidden layers, a scalar integer. |
n_h |
The number of hidden neurons in each layer (of length l_h). |
n_out |
The number of output neurons, a scalar integer, for now has to be 1. |
Ws |
A list of matrices giving the weights between layers, of length 1 fewer than the number of layers. The first matrix is of dimension n_in x n_h[1], etc. |
Fin |
A list of numeric vectors, giving the times of the input spikes. |
t_eps |
A scalar double, the step size for numerical integration. |
t_steps |
A scalar integer, the number of finite difference iterations. |
A list of lists of numeric vectors. The first entry will be Fin, and so on.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | t_eps <- 0.01
t_end <- 10
ts <- seq(0, t_end, by = t_eps)
t_steps <- length(ts)
n_in <- 2
n_out <- 1
n_h <- c(1)
layers <- 2 + length(n_h)
#Ws <- list(matrix(c(3.5), ncol = 1), matrix(c(3), ncol = 1))
Fin <- list(seq(0,10, by = 1), seq(0,10, by = 1))
# Generate random wieghts
set.seed(123)
sizes <- c(n_in, n_h, n_out)
Ws <- lapply(1:(length(sizes)-1), function(i)
matrix(rnorm(sizes[i]*sizes[i+1], 3), nrow = sizes[i], ncol = sizes[i+1]))
l_h <- length(n_h)
a <- lif_forward_R(n_in, l_h, n_h, n_out, Ws, Fin, t_eps, t_steps)
cat('Firing Times by layer-neuron:\n')
print(a)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.