buildSigma | R Documentation |
Minimize the energy of the Hopfield network.
buildSigma(xi, n = 20, nrep = 100, quiet = FALSE)
xi |
a matrix of patterns coded with 1 and -1. |
n |
the parameter of the energy function (integer). |
nrep |
the number of attempts. |
quiet |
a logical value indicating whether to print the details for each attempt. |
The number of columns in xi
is equal to the size of the
Hopfield network (i.e., the number of input neurons denoted as N),
whereas the number of columns is the number of memories denoted as K
(Krotov and Hopfield, 2016).
A random vector ‘sigma’ is first generated and then updated in order to minimize the energy level of the Hopfield network. The convergence to a low energy level depends on the initial values in ‘sigma’, so the procedure is repeated several times. The vector with the lowest energy level is returned.
a vector of integers (-1/1). The length of this vector (N) is equal to
the number of columns in xi
.
Emmanuel Paradis
Krotov, D. and Hopfield, J. J. (2016) Dense associative memory for pattern recognition. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.48550/ARXIV.1606.01164")}.
hann1
xi <- matrix(NA, K <- 1000, N <- 60)
xi[] <- sample(c(1L, -1L), K * N, TRUE)
(sigma <- buildSigma(xi))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.