Here's an R code that implements unsupervised learning.
Here's the code to display the hexagonal outputs you see in this page.
This is a specific instance of an unsupervised learning network used by Von Der Malsburg, hence VDM. He was interested in getting the network to exhibit similar behavior to what is observed about the human primary visual cortex. In humans, the primary visual neurons are organized in a columnar fashion according to their sensitivity and selectivity to visual line orientations. That is, each neuron in the primary visual cortex is maximally active for a specific orientation of lines that it receives visual signals from in the environmental space. Furthermore, these neurons are grouped together such that adjacent neurons are each sensitive to close orientations.
This R code implements the VDM network specifically using the following line orientation stimuli. The stimuli consist of 19 input units selectively made active (1 or 0) to give rise to "orientation". In fact, the input stimuli is realized in R as a matrix of 1s and 0s in the right positions.
At first, the network outputs a roughly clustered pattern of activity to a particular orientation (bottom left). But after several training iterations (about 100 cycles, which is quite fast!), it displays columnar organization (bottom right).
Interesting directions to pursue from this code are: object-level representation, color, moving stimuli, 3D representation, binding, repetition suppression.
Here's my paper which describes the model in greater detail [VDM.pdf].