Evolife
Evolife has been developed to study Genetic algorithms, Natural evolution and behavioural ecology.
Public Member Functions | Public Attributes | List of all members
Evolife.Ecology.Learner.Learner Class Reference

defines learning capabilities More...

Public Member Functions

def __init__ (self, Features, MemorySpan=5, AgeMax=100, Infancy=0, Imitation=0, Speed=3, JumpProbability=0, Conservatism=0, LearningSimilarity=10, toric=False, Start=-1)
 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. More...
 
def Reset (self, Newborn=True)
 Initializes Feature values to random values (if Start == -1) Age set to random value if Newborn is False (useful at start) More...
 
def adult (self)
 adult if age larger than AgeMax*Infancy/100 More...
 
def feature (self, F, Value=None)
 reads or sets feature value More...
 
def Limitate (self, x, Min, Max)
 
def imitate (self, models, Feature)
 The individual moves its own feature closer to its models' features. More...
 
def bestRecord (self, second=False)
 Retrieves the best (or the second best) solution so far. More...
 
def bestFeatureRecord (self, Feature)
 Alternative to bestRecord that aggregates similar feature values. More...
 
def avgRecord (self)
 Averaging past scores. More...
 
def loser (self)
 A looser has full experience and bad results. More...
 
def explore (self, Feature, Speed, Bottom=0, Top=100)
 the individual changes its feature values More...
 
def Learns (self, neighbours=None, Speed=None, hot=False, BottomValue=0, TopValue=100)
 Learns by randomly changing current value. More...
 
def wins (self, Points)
 stores a benefit More...
 

Public Attributes

 Features
 
 MemorySpan
 
 Scores
 
 AgeMax
 
 Performance
 
 Infancy
 
 Imitation
 
 Speed
 
 JumpProbability
 
 Conservatism
 
 LearningSimilarity
 
 Toric
 
 Start
 
 Age
 

Detailed Description

defines learning capabilities

Definition at line 61 of file Learner.py.

Constructor & Destructor Documentation

◆ __init__()

def Evolife.Ecology.Learner.Learner.__init__ (   self,
  Features,
  MemorySpan = 5,
  AgeMax = 100,
  Infancy = 0,
  Imitation = 0,
  Speed = 3,
  JumpProbability = 0,
  Conservatism = 0,
  LearningSimilarity = 10,
  toric = False,
  Start = -1 
)

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)

Definition at line 64 of file Learner.py.

Member Function Documentation

◆ adult()

def Evolife.Ecology.Learner.Learner.adult (   self)

adult if age larger than AgeMax*Infancy/100

Definition at line 113 of file Learner.py.

◆ avgRecord()

def Evolife.Ecology.Learner.Learner.avgRecord (   self)

Averaging past scores.

Definition at line 172 of file Learner.py.

◆ bestFeatureRecord()

def Evolife.Ecology.Learner.Learner.bestFeatureRecord (   self,
  Feature 
)

Alternative to bestRecord that aggregates similar feature values.

Definition at line 158 of file Learner.py.

◆ bestRecord()

def Evolife.Ecology.Learner.Learner.bestRecord (   self,
  second = False 
)

Retrieves the best (or the second best) solution so far.

Definition at line 142 of file Learner.py.

◆ explore()

def Evolife.Ecology.Learner.Learner.explore (   self,
  Feature,
  Speed,
  Bottom = 0,
  Top = 100 
)

the individual changes its feature values

Definition at line 184 of file Learner.py.

◆ feature()

def Evolife.Ecology.Learner.Learner.feature (   self,
  F,
  Value = None 
)

reads or sets feature value

Definition at line 118 of file Learner.py.

◆ imitate()

def Evolife.Ecology.Learner.Learner.imitate (   self,
  models,
  Feature 
)

The individual moves its own feature closer to its models' features.

Definition at line 130 of file Learner.py.

◆ Learns()

def Evolife.Ecology.Learner.Learner.Learns (   self,
  neighbours = None,
  Speed = None,
  hot = False,
  BottomValue = 0,
  TopValue = 100 
)

Learns by randomly changing current value.

Starting point depends on previous success and on neighbours. If 'hot' is true, perturbation is larger for children

Definition at line 194 of file Learner.py.

◆ Limitate()

def Evolife.Ecology.Learner.Learner.Limitate (   self,
  x,
  Min,
  Max 
)

Definition at line 125 of file Learner.py.

◆ loser()

def Evolife.Ecology.Learner.Learner.loser (   self)

A looser has full experience and bad results.

Definition at line 179 of file Learner.py.

◆ Reset()

def Evolife.Ecology.Learner.Learner.Reset (   self,
  Newborn = True 
)

Initializes Feature values to random values (if Start == -1) Age set to random value if Newborn is False (useful at start)

Definition at line 101 of file Learner.py.

◆ wins()

def Evolife.Ecology.Learner.Learner.wins (   self,
  Points 
)

stores a benefit

Definition at line 229 of file Learner.py.

Member Data Documentation

◆ Age

Evolife.Ecology.Learner.Learner.Age

Definition at line 105 of file Learner.py.

◆ AgeMax

Evolife.Ecology.Learner.Learner.AgeMax

Definition at line 89 of file Learner.py.

◆ Conservatism

Evolife.Ecology.Learner.Learner.Conservatism

Definition at line 95 of file Learner.py.

◆ Features

Evolife.Ecology.Learner.Learner.Features

Definition at line 86 of file Learner.py.

◆ Imitation

Evolife.Ecology.Learner.Learner.Imitation

Definition at line 92 of file Learner.py.

◆ Infancy

Evolife.Ecology.Learner.Learner.Infancy

Definition at line 91 of file Learner.py.

◆ JumpProbability

Evolife.Ecology.Learner.Learner.JumpProbability

Definition at line 94 of file Learner.py.

◆ LearningSimilarity

Evolife.Ecology.Learner.Learner.LearningSimilarity

Definition at line 96 of file Learner.py.

◆ MemorySpan

Evolife.Ecology.Learner.Learner.MemorySpan

Definition at line 87 of file Learner.py.

◆ Performance

Evolife.Ecology.Learner.Learner.Performance

Definition at line 90 of file Learner.py.

◆ Scores

Evolife.Ecology.Learner.Learner.Scores

Definition at line 88 of file Learner.py.

◆ Speed

Evolife.Ecology.Learner.Learner.Speed

Definition at line 93 of file Learner.py.

◆ Start

Evolife.Ecology.Learner.Learner.Start

Definition at line 98 of file Learner.py.

◆ Toric

Evolife.Ecology.Learner.Learner.Toric

Definition at line 97 of file Learner.py.


The documentation for this class was generated from the following file: