buildSigma: Hopfield Network Energy

View source: R/energy.R

buildSigmaR Documentation

Hopfield Network Energy

Description

Minimize the energy of the Hopfield network.

Usage

buildSigma(xi, n = 20, nrep = 100, quiet = FALSE)

Arguments

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.

Details

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.

Value

a vector of integers (-1/1). The length of this vector (N) is equal to the number of columns in xi.

Author(s)

Emmanuel Paradis

References

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")}.

See Also

hann1

Examples

xi <- matrix(NA, K <- 1000, N <- 60)
xi[] <- sample(c(1L, -1L), K * N, TRUE)
(sigma <- buildSigma(xi))

hann documentation built on Aug. 8, 2025, 7:16 p.m.