a.p.Population(object) : class documentation

Part of ade.population View In Hierarchy Source for population.py Project Page for ade

Construct me with a callable evaluation func that accepts a 1-D Numpy array of parameter values, a sequence of names for the parameters, and a sequence of bounds containing 2-tuples that each define the lower and upper limits of the values.

The evaluation function must return the sum of squared errors (SSE) as a single float value. In addition to the array of parameter values, it must also accept a keyword or optional second argument xSSE, which (if provided) is the SSE of the target individual being challenged. The evaluation function need not continue its computations if it accumulates an SSE greater than xSSE; it can just return that greater SSE and conclude operations. That's because DE uses a greedy evaluation function, where the challenger will always be accepted if it is *any* better than the target.

If just one argument (the paremeter value 1-D array) is provided, your evaluation function must return the fully computed SSE.

Method __init__ Undocumented
Method __getitem__ Undocumented
Method __setitem__ Use only this method (item setting) and push to replace individuals.
Method __len__ Undocumented
Method __iter__ Undocumented
Method __contains__ Undocumented
Method iSorted Undocumented
Method __repr__ Undocumented
Method limit Limits the individual's parameter values to the bounds in the way that my ParameterManager is configured to do, modifying the individual in place.
Method spawn Undocumented
Method setup No summary
Method addCallback Undocumented
Method replacement No summary
Method report No summary
Method waitForReports Undocumented
Method push Pushes the supplied individual into my population and kicks out the worst individual there to make room.
Method sample Returns a sample of N indices from my population that are unique from each other and from any excluded indices supplied as additional arguments.
Method individuals Immediately returns a list of the individuals at the specified indices.
Method lock Obtains the locks for individuals at the specified indices, submits a request to acquire them, and returns a Deferred that fires when all of them have been acquired.
Method release Undocumented
Method best Undocumented
def __init__(self, func, names, bounds, constraints=, popsize=None):
Undocumented
def __getitem__(self, k):
Undocumented
def __setitem__(self, k, i):

Use only this method (item setting) and push to replace individuals.

def __len__(self):
Undocumented
def __iter__(self):
Undocumented
def __contains__(self, i):
Undocumented
@property
def iSorted(self):
Undocumented
def __repr__(self):
Undocumented
def limit(self, i):

Limits the individual's parameter values to the bounds in the way that my ParameterManager is configured to do, modifying the individual in place.

def spawn(self, values, fromUnity=False):
Undocumented
@defer.inlineCallbacks
def setup(self, uniform=False, blank=False):

Sets up my initial population using a Latin hypercube to initialize pseudorandom parameters with minimal clustering. With parameter constraints, this doesn't work as well, because the initial values matrix must be refreshed, perhaps many times. But it may still be better than uniform initial population sampling.

Returns a Deferred fires when the population has been set up.

def addCallback(self, func, *args, **kw):
Undocumented
def replacement(self, improvementRatio=None, sqs=None):

Call with an integer improvementRatio to record a replacement occurring in this generation or iteration, or with the keyword sqs set to a float statusQuoScore other than my default. Otherwise, call with nothing to determine if the replacement that occurred in the previous generation/iteration were enough to warrant maintaining the status quo, and to reset the record.

The status quo will be maintained if several small improvements are made, or fewer larger ones, with the required number and/or size increasing for a larger population. For small populations where even a single improvement would be significant, the probability of status quo maintenance increases with smaller population and will sometimes happen even with no improvements for a given generation or iteration.

Returns True if the status quo should be maintained.

def report(self, iNew=None, iOld=None, rbb=False, force=False):

Provides a message via the log messenger about the supplied Individual, optionally with a comparison to another Individual. If no second individual is supplied, the comparison will be with the best individual thus far reported on.

Does a call to replacement if the new individual is better.

def waitForReports(self):
Undocumented
def push(self, i):

Pushes the supplied individual into my population and kicks out the worst individual there to make room.

def sample(self, N, *exclude):

Returns a sample of N indices from my population that are unique from each other and from any excluded indices supplied as additional arguments.

def individuals(self, *indices):

Immediately returns a list of the individuals at the specified indices.

def lock(self, *indices):

Obtains the locks for individuals at the specified indices, submits a request to acquire them, and returns a Deferred that fires when all of them have been acquired.

Release the locks (as soon as possible) by calling release with the indices that are locked.

def release(self, *indices):
Undocumented
def best(self):
Undocumented
API Documentation for ade, generated by pydoctor at 2018-07-14 12:24:23.