→ summary
******************************************************************************************
Module Evolife.Ecology.Learner:
==============================
EVOLIFE: Module Learner:
Simple trial-and-error learning mechanism
******************************************************************************************
**************************************************************************************
Class Global:
============
General functions: Closer, Perturbate, Limitate, Decrease
**************************************************************************************
----------------------------------------------------------------------------------
Method Global.__init__:
======================
Definitions of Closer, Perturbate, Limitate, Decrease
----------------------------------------------------------------------------------
**************************************************************************************
Class LimitedMemory_: inherits from Evolife.Tools.Tools.LimitedMemory
====================
memory buffer with limited length
**************************************************************************************
**************************************************************************************
Class Learner:
=============
defines learning capabilities
**************************************************************************************
----------------------------------------------------------------------------------
Method Learner.__init__:
=======================
Features : Dictionary or list of features that will be learned
MemorySpan: size of memory
Scores : memory of past benefits
AgeMax: Max age before resetting
Performance : stores current performances
Infancy : percentage of lifetime when the learner is considered a child
Imitation : forced similarity wiht neighbouring values when learning continuous function
Speed : learning speed
JumpProbability: Probability of jumping far from last value
Conservatism: Importance in % of immediate past solutions
LearningSimilarity = LearningSimilarity
Influence of neighbouring feature values when retrieving best past feature value.
Between 0.1 (or so) and 100.
Influence of NeighbVal on Val is LearningSimilarity / abs(Val - NeighbVal)
10 means that a feature that differs by 30 contributes up to 1/3 of its value.
0.1 or so would cancel the effect of neighbouring feature values.
Toric = toric
If True, learning space is circular (toric): maximal feature values are next to smallest values.
Start: Features are created random (-1) or all-zero (0) or all-100 (1)
----------------------------------------------------------------------------------
Arguments:
. Features
. MemorySpan
. AgeMax
. Infancy
. Imitation
. Speed
. JumpProbability
. Conservatism
. LearningSimilarity
. toric
. Start
----------------------------------------------------------------------------------
Method Learner.Reset:
====================
Initializes Feature values to random values (if Start == -1)
Age set to random value if Newborn is False (useful at start)
----------------------------------------------------------------------------------
Arguments:
. Newborn
----------------------------------------------------------------------------------
Method Learner.adult:
====================
adult if age larger than AgeMax*Infancy/100
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Learner.feature:
======================
reads or sets feature value
----------------------------------------------------------------------------------
Arguments:
. F
. Value
----------------------------------------------------------------------------------
Method Learner.Limitate
----------------------------------------------------------------------------------
Arguments:
. x
. Min
. Max
----------------------------------------------------------------------------------
Method Learner.imitate:
======================
The individual moves its own feature closer to its models’ features
----------------------------------------------------------------------------------
Arguments:
. models
. Feature
----------------------------------------------------------------------------------
Method Learner.bestRecord:
=========================
Retrieves the best (or the second best) solution so far
----------------------------------------------------------------------------------
Arguments:
. second
----------------------------------------------------------------------------------
Method Learner.bestFeatureRecord:
================================
Alternative to bestRecord that aggregates similar feature values
----------------------------------------------------------------------------------
Arguments:
. Feature
----------------------------------------------------------------------------------
Method Learner.avgRecord:
========================
Averaging past scores
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Learner.loser:
====================
A looser has full experience and bad results
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Method Learner.explore:
======================
the individual changes its feature values
----------------------------------------------------------------------------------
Arguments:
. Feature
. Speed
. Bottom
. Top
----------------------------------------------------------------------------------
Method Learner.Learns:
=====================
Learns by randomly changing current value.
Starting point depends on previous success and on neighbours.
If ‘hot’ is true, perturbation is larger for children
----------------------------------------------------------------------------------
Arguments:
. neighbours
. Speed
. hot
. BottomValue
. TopValue
----------------------------------------------------------------------------------
Method Learner.wins:
===================
stores a benefit
----------------------------------------------------------------------------------
Arguments:
. Points
Back to Evolife