ade.individual.Individual(object)
class documentation
Part of ade.individual
(View In Hierarchy)
I act like a sequence of parameter values, but with other stuff like an SSE value, too.
Construct me with a Population
object.
You can set my values with a 1-D Numpy array of initial values.
You can iterate my values in sequence. You can access them (read/write)
as items. You can even replace the whole 1-D Numpy array of them at once
with another array of like dimensions, although the safest way to do that
is supplying a list or 1-D array to update
.
Parameters | values | Set to a sequence of initial parameter values if you're not going to set
them with a call to update . |
Instance Variable | values | A 1-D Numpy array of parameter values. |
Instance Variable | p | The Population I
am part of. |
Instance Variable | dt | The time difference between start and end of my last evaluation. |
Method | __init__ | Individual(p, values=None) |
Method | __getstate__ | For pickling. Does not include the Population object
p. |
Method | __setstate__ | For unpickling. You have to set the p attribute of the unpickled
version of me to a Population
object. |
Method | __repr__ | Informative string representation, with SSE and pretty-printed values. |
Method | params | Property: A dict of my parameter values, keyed by name. |
Method | SSE 0 | Property: My SSE value, which must at least behave like a float.
Infinite if no SSE computed yet, a fatal error occurred during evaluation,
or was set to None . |
Method | SSE | Property setter: Sets my SSE value. |
Method | spawn | Returns another instance of my class with the same population and with the supplied values. |
Method | copy | Returns a complete copy of me, another instance of my class with the same population, values, and SSE. |
Method | __float__ | I can be evaluated as a float using my SSE. A negative SSE translates to
inf because it indicates a fatal error. |
Method | __getitem__ | Sequence-like read access to values when k is an integer, dict-like access otherwise. |
Method | __setitem__ | Sequence-like write access to values. |
Method | __iter__ | Sequence-like iteration over values. |
Method | __bool__ | I am True if there were no fatal errors during my last
evaluation, which would be indicated by an evaluation SSE result of less
than zero. |
Method | __hash__ | Undocumented |
Method | __eq__ | I am equal to another Individual if we have the same SSE
and values. |
Method | equals | Returns True if my values equal the other
individual's values, or the other values themselves if supplied as a
sequence or 1-D array. |
Method | __lt__ | My SSE less than other Individual or float? |
Method | __gt__ | My SSE greater than other Individual or float? |
Method | __sub__ | Subtract the other Individual 's values from mine and return
a new Individual whose values are the differences. |
Method | __add__ | Add the other Individual 's values to mine and return a new
Individual whose values are the sums. |
Method | __mul__ | Scales each of my values by the constant F. |
Method | blacklist | Sets my SSE to the worst possible value and forces my population to update its sorting to account for my degraded status. |
Method | update | Updates my values as an array form of the supplied list or tuple. |
Method | evaluate | Computes the sum of squared errors (SSE) from my evaluation function using my current values. |
Method | save | Saves my parameters to filePath as a pickled dict. |
For unpickling. You have to set the p attribute of the unpickled
version of me to a Population
object.
def SSE 0(self):
Property: My SSE value, which must at least behave like a float.
Infinite if no SSE computed yet, a fatal error occurred during evaluation,
or was set to None
.
Returns another instance of my class with the same population and with the supplied values.
Returns a complete copy of me, another instance of my class with the same population, values, and SSE.
I can be evaluated as a float using my SSE. A negative SSE translates to
inf
because it indicates a fatal error.
Sequence-like read access to values when k is an integer, dict-like access otherwise.
I am True
if there were no fatal errors during my last
evaluation, which would be indicated by an evaluation SSE result of less
than zero.
I will evaluate as True
even if my SSE is
None
, infinite, or NaN
, so long as it is not
negative.
Returns True
if my values equal the other
individual's values, or the other values themselves if supplied as a
sequence or 1-D array.
Subtract the other Individual
's values from mine and return
a new Individual
whose values are the differences.
Add the other Individual
's values to mine and return a new
Individual
whose values are the sums.
Sets my SSE to the worst possible value and forces my population to update its sorting to account for my degraded status.
Updates my values as an array form of the supplied list or tuple.
Raises an exception if there's a different number of values than my values length Nd.
Computes the sum of squared errors (SSE) from my evaluation function using my current values.
Stores the result in my SSE attribute and returns a reference to me for convenience.
If the SSE value is less than zero, or results in a Twisted failure, ade will abort operations. Use this feature to provide your evaluator with a simple way to stop everything if something goes terribly wrong.
Updates my dt attribute with the elapsed time for this evaluation.
Returns a Deferred
that fires with a reference to my
instance when the evaluation is done, pass or fail.