danielpower1859 / HebbianEvolution

Code to run LV simulation with Hebbian evolution
MIT License
0 stars 0 forks source link

Testing pairwise orthognoality #3

Closed danielpower1859 closed 8 years ago

danielpower1859 commented 8 years ago

What are the properties we like?

What is is about certain random attractor pairs that creates the properties we like?

What does this property look like? How can we define it in a general way?

danielpower1859 commented 8 years ago
new function 
def correspondence_patterns_between_binary_vectors(v1, v2):
    '''
    for two vectors of the same length
    returns the proportion of entries which are:
        1 in both
        1 in v1, 0 in v2
        0 in v1, 1 in v2
        0 in both
        '''
        assert len(v1) == len(v2)
# to do :
# check inputs are binary

HH = np.sum( v1 * v2) 
HL = np.sum(v1 * (1-v2))
LH = np.sum((1-v1) * v2)
LL = np.sum((1-v1) * (1-v2))

assert HH+HL+LH+LL == len(v1)
return HH, HL, LH, LL

Results: for 50:50 vectors (ecah vector has 50 ones and 50 0s) The number of HL is always == number of LH and # HH == # LL

danielpower1859 commented 8 years ago

HH:Hl = 4 attractor states, each with 50% high /low?? 30:20 = fail 24:26 = fail 27:23 = fail 23:27 = fail 22:28 = fail 23:27 = fail 26:24 = fail 25:25 = Success!!!

Looks highly likely that, with the current parameter set, pairwise orthogonality is essential for 50:50 species density split

danielpower1859 commented 8 years ago

idea:

danielpower1859 commented 8 years ago

Looks very much like its only variations of 1 1 1 1 1 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0

That work. I.e. shuffled versions of the paired pattern. Damn

danielpower1859 commented 8 years ago

The system currently only works with random compositions such that each vector has the same proportion (25%) of each of:

`def pair_wise_orthogonal_patterns(N): ''' returns two binary np.vectors that are pairwise orthogonal. i.e. each has 25%: HH, HL, LH, LL '''

assert N%4 ==0

v = []
for i in range(int(N/4)):
    v.extend([[1,1], [1,0], [0,1], [0,0]])
shuffle(v)
v = np.array(v)
return  v.transpose()[0], v.transpose()[1]`
danielpower1859 commented 8 years ago

HOWEVER!! I haven't checked what happens to evolution on the patterns created by assymetric patterns. Although given how sensitive the "balanced" pattern is.. i don't hold much hope.

danielpower1859 commented 8 years ago

Have been testing system with HH: HL 26:24 Reducing m_values looks promising... playing in the range nm_values - 3 - 4 K = 3. # base carrying capacity 3. M = 0.5 # growth rate 0.5 is default

M_values: must be high enough to divide HL from LH (or vice versa) low enogh that HH and HL are v. similar

0.34 seems v good

danielpower1859 commented 8 years ago

Useful to have a function that compares density of HH with density of HL, LH and LL species Returns proportions.

danielpower1859 commented 8 years ago

Next step here: test 26:24 patterns with 0.0034 parameter Will low learning rate work?

YES :-)

danielpower1859 commented 8 years ago

Patterns: 23:27, 24,:26, 25:25, 26:24, 27:23 All can be parameterised for to produce systems with 2 attractor pairs, which Hebbian evolution can act upon to enlarge the BoA for the larger (lower MCC) attractor.

These 5 patterns account for about 68% of patterns produced by the shuffle 50 1s and 50 zeros method.

Pairwise orthogonality (equal proportions of HH:HL:LH:LL) adds a lot of stability