IMPORTANT: In the end of each lab submit your code and answers to the questions (worth 1% of the final mark).
The Ising model is defined on a discrete collection of variables called
spins, which can take on the value +1
or
−1
(up or down). The spins can be thought of as living on
a graph, where each node has exactly one spin, and each edge connects
two spins with a nonzero interaction value. The goal is to study phase
(state) changes in the Ising model as a simplified form of phase (state)
changes in real substances. The two-dimensional NxN
square
lattice Ising model is one of the simplest models to study phase changes
and asymptotic behaviour of the modeled system.
S[i] = +1
.
S[i] = −1
.
w[i, j]
, which are real numbers from the (open) interval
(−1, +1)
.w[i, j] ≠ w[j, i]
.
b[i]
be the basal expression of a gene,
a real number from the interval (−1, +1)
.
Although we are dealing with linear data,
it is convenient to represent the data in a 2D
lattice
(for instance we may have 16
genes, so there would be
16
(binary) spin values -- which can be displayed in
a 4x4
grid).
The simplest visualization of the NxN
lattice can be to just
use text: where S[i] = +1
is represented by a black dot (or X);
and S[i] = −1
by a white dot (or .).
We will need it to observe how the state of the network evolves over time.
Example representation of 16 spin states:
XX.X
X..X
..XX
.XXX
The spin states need to be displayed at the start, and after each epoch of change.
In all experiments, initialize the network by assigning each gene a
state −1
or +1
with probability = 0.5
(flipping a virtual coin).
We can simulate time by iterating through the model, and discovering what equilibrium behaviour develops within the model: is there a Fixed point attractor; or a more dynamic Limit cycle attractor (oscillation); or Chaotic (strange) attractor?
These updates can be made as --
Asynchronous dynamics of the model:
At each iteration we randomly* pick one gene and update its state according to this rule:
S[i] = +1
if ( ∑j
w[i, j] S[j] + b[i] ) ≥ 0
S[i] = −1
if ( ∑j
w[i, j] S[j] + b[i] ) < 0
Here we take into account the current states of the genes in the network,
S[j]
.
So if we were to perform an 'epoch update' (ie, each value is updated once),
then for some values of j
, S[j]
would be the
value generated in the previous 'epoch' iteration, and for other values
S[j]
would be the value generated during this iteration.
* "randomly":
Ideally we want to train an entire epoch, updating gene-by-gene
-- so we
could simply update each gene 'in order' until the epoch is complete;
or we could decide a random permutation, and use that permutation of
gene orders for all epochs;
or we could use different random permutations for each epoch.
Obviously, it'll be easiest to process the genes "in order".
In this case we calculate all new values using the values for
S[j]
that had been calculated in the previous iteration.
So, this is similar to epoch training, where we do all the calculations
before making any updates.
Write a program to observe the evolution of the states over time, let us use:
N = 10
,
so there will be 100 spin states;
and finish updating after twenty epochs
After certain number of epochs the system should stay in one state when updating.
w[i, j]
as random real numbers
from the interval (−1, +1)
in such a way that the
interaction matrix is symmetric, i.e. w[i, j] = w[j, i]
and there are no direct feedbacks, i.e. w[i, i] = 0
for all i
.
b[i] = 0
for all i
.
Run the experiment several times, with different initial random configuration of gene states BUT with the same interaction matrix W. Answer these questions:
After certain number of epochs the system should switch between just few states when updating
w[i, j]
as random real numbers
from the interval (−1, +1)
in such a way that the
interaction matrix is symmetric, i.e. w[i, j] = w[j, i]
and there are no direct feedbacks, i.e. w[i, i] = 0
for all i
.
b[i]
as random numbers from
the interval (−1, +1)
.
Run the experiment several times, with different initial random configuration
of gene states BUT with the same interaction matrix W
and the
same basal expression values b[i]
. Answer these questions:
After certain number of epochs the system should follow a sequence of similar-but-never-the-same states.
w[i, j]
as random real numbers from
the interval (−1, +1)
in such a way that the interaction
matrix is NOT symmetric, i.e. w[i, j] ≠ w[j, i]
and
there are no direct feedbacks, i.e. w[i, i] = 0
for all i
.
b[i]
as random numbers from the
interval (−1, +1)
.
Run the experiment several times, with different initial random configuration
of gene states BUT with the same interaction matrix W
and the
same basal expression values b[i]
. Answer these questions:
If time permits, repeat the above experiments including feedback interaction,
i.e. generate w[i, i]
as random numbers from the interval
(−1, +1)
.