hann3: Three-layer Hopfield ANN

View source: R/hann3.R

hann3R Documentation

Three-layer Hopfield ANN

Description

This optimizes a three-layer Hopfield-based artificial neural network. The network is made of a Hopfield network with N input neurons all connected to H hidden neurons. The latter are all connected together (convoluation) which is equivalent to defining two hidden layers. Each hidden neuron is connected to C output neurons. The values of the parameters N and C are determined by the input data: xi has N columns (which is also the length of sigma) and the number of unique values of classes is equal to C. The value of H must be given by the user (a default of half the number of input neurons is defined).

See the vignette of this package for an example.

Usage

hann3(xi, sigma, classes,  H = 0.5 * length(sigma),
      net = NULL, control = control.hann())

## S3 method for class 'hann3'
print(x, details = FALSE, ...)

Arguments

xi

a matrix of patterns with K rows.

sigma

a vector coding the Hopfield network.

classes

the classes of the patterns (vector of length K).

H

the number of numbers in the hidden layer; by default half the number of input neurons (rounded to the lowest integer if the latter is odd).

net, x

an object of class "hann1".

control

the control parameters.

details

a logical value (whether to print the parameter values of the network).

...

further arguments passed to print.default.

Details

By default, the parameters of the neural network are initialized with random values from a uniform distribution between -1 and 1 (expect the biases which are initialized to zero).

If an object of "hann3" is given to the argument net, then its parameter values are used to initialize the parameters of the network.

The main control parameters are given as a list to the control argument. They are detaild in the page of the function control.hann().

Value

an object of class "hann3" with the following elements:

parameters

a list with three matrices, W1, W2, and W3, and two vectors, bias1 and bias3.

sigma

the Hopfield network.

beta

the hyperparameter of the activation function.

call

the function call.

Author(s)

Emmanuel Paradis

References

Hopfield, J. J. (1982) Neural networks and physical systems with emergent collective computational abilities. Proceedings of the National Academy of Sciences, USA, 79, 2554–2558. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1073/pnas.79.8.2554")}.

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

buildSigma, control.hann, predict.hann3


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