GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - AndreuMatoses/hopfield-RNN: A discrete Hopefield recurrent neural network implementation in MATLAB

BranchesTags
Open more actions menu

Latest commit

 

History

9 Commits
9 Commits

Folders and files

NameName
Last commit message
Last commit date
animation
animation
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
animation.m
animation.m
 
 
hf_learn.m
hf_learn.m
 
 
hf_update.m
hf_update.m
 
 
hopfield_network.m
hopfield_network.m
 
 
hopfield_network_mixed_tests.m
hopfield_network_mixed_tests.m
 
 
hopfield_network_partial_test.m
hopfield_network_partial_test.m
 
 
kth_logos.mat
kth_logos.mat
 
 
mixed_pattern.m
mixed_pattern.m
 
 
noisy_pattern.m
noisy_pattern.m
 
 
partial_pattern.m
partial_pattern.m
 
 
pattern2matrix.m
pattern2matrix.m
 
 
pattern_plot.m
pattern_plot.m
 
 
patterns.m
patterns.m
 
 

Repository files navigation

Hopfield-RNN implementation for Square sized patterns

A discrete Hopefield recurrent neural network implementation in MATLAB for square sized binary pattersn :

  • A cell can have a value of 1 (activated) or -1 (deactivated)
  • All cells are connected to each other (except itself). The synaptic strength of the connections needs to be calculated to make the network recognize an “attractor” state
    • Using Hebbian learning rule
    • Other possibilities: Pseudo-inverse method
  • Cells are updated in a pseudorandom sequence
  • From a given initial state (pattern), the network should converge to the closest attractor state (patterns used to train)

Algorithm

Patterns to remember are selected and stored in vector form (Vector of N neurons)

Weight matrix [N x N] is calculated from the stored patterns

  • Hebbian learning rule

    image

  • Pseudo-inverse method

    image

Initial pattern (Noisy, Partial, Mixed, …) is calculated with desired specifications Neurons are updated starting from the initial pattern sequentially following random but constant update order, until the last N updates do not create any change (convergence)

image

Some output examples

Plots of Patterns

Patterns

Synaptic strength matrix (i.e weight matrix)

image

Pattern complition animation

Fucntions

  • animation(pattern, time_step, filename). This function makes an animation of the simulation

input : pattern -> pattern in vector form

  • W = hf_learn(patterns, learning_rule). This function implements the leaning rule (Hebbian, Pseudo-inverse).

inputs : patterns -> in vector form size [1, N, n_patterns], learning rule -> string, "hebbian"

  • [evolution, iter_to_converge]=hf_update(W,pat0). This function updates the neurons following a pseudorandom sequence

inputs : W-> weight matrix NxN, pat0 -> initial pattern (vector)

  • hopfield_network. This script is used to run the patterns plots and animations

  • hopfield_network_mixed_tests. This script is used to run the mixed patterns animations

  • hopfield_network_partial_test. This script is used to run the partial patterns animations

  • m = mixed_pattern(pattern_A, pattern_B, n_cells_A, n_cells_B). This function computes the mixed pattern with 4 cells from pattern 4 and 4 cells from pattern 1

inputs : pattern_A, pattern_B -> patterns in vector form

  • n = noisy_pattern(pattern,pattern_index,n_cells_A,n_cells_B). This function computes the noisy patterns

inputs : patterns -> patterns in vector form, pattern_index -> index of the main pattern, n_cells_A -> number of cells for main pattern, n_cells_B -> number of cells for remaining patterns

  • p = partial_pattern(pattern, pattern_index, n_cells). This function computes the partial patterns

inputs : pattern -> pattern in vector form, pattern_index -> index number of the pattern we want to select, n_cells = number of cells selected from the pattern

  • v=pattern2matrix(pattern). This function transform the vector pattern to matrix pattern

inputs : pattern -> pattern in vector form

  • pattern_plot(pattern,names). This function plot the different patterns

inputs : pattern -> pattern in vector form, names -> cell array with chars inside

  • patterns. This script computes the basic patterns

About

A discrete Hopefield recurrent neural network implementation in MATLAB

Resources

Readme
MIT license
Activity

Stars

3 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.