Skip to main content

A simple polymorph evolutionary class system

Project description

xevo

This is a simple set of classes to use for evolutionary coding in a polymorphic way. The central classes are given by "eobj", which implements the basic structure for an object that will be optimized by the second one "evo", which handles the optimization.

#eobj Each eobj needs to at least implement: def add(a,b): how to combine objects a and b def randomize(s): return a new completely random version of this class def mutate(s): return a sligthly mutated version of this object def calcstrength(s)->float: how strong is this objects version def _copy(s): copy the specifics of this object

you can also override shallmaximize->bool to chance if the strength should be maximized

Finally init(s) should not contain any nonoptional parameters and call s.initial()

There are two simple examples of this object. pion.py tries to find a fixed value (aka np.pi) and bitflip.py tries to maximize the sum of a list of booleans. This is very simple and implements a simple counter, that counts how often any state is evaluated. You can also take a look at the deep learning example below.

#evo This object only needs to implement two functions def generation(s)->None: update the objects (stored in s.q) def _copy(s) -> "subclass of evo": copy the specifics of this object

Here there is a simple example implemented in crossevo (which is also given in the package), of a batch of object, in which 2 random objects figth against each other and the weaker one is replaced by either a combination of both objects, or by a mutation of the winning one.

#erun Runs an experiment given an evo object and an eobj object. You can also specify the size population in the initializer. To run the experiment call run(s,maxsteps=1000000,goalstrength=1000000.0), where maxsteps is the maximum number of generation calls that can be called. And by beating goalstrength the run is stopped before. After the run, you can call show_history(s,log=False) to show a strength history (with an optional logarithmic y axis (if log=True))

#machine learning If you take a look at the eobj deep (deep.py and deeptools.py), you find a simple optimizer object, which tries to find the perfect network setup for a keras dense network setup. So using it requires keras and tensorflow.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xevo-0.2-py3.9.egg (43.2 kB view details)

Uploaded Egg

File details

Details for the file xevo-0.2-py3.9.egg.

File metadata

  • Download URL: xevo-0.2-py3.9.egg
  • Upload date:
  • Size: 43.2 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/54.1.1 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.9.2

File hashes

Hashes for xevo-0.2-py3.9.egg
Algorithm Hash digest
SHA256 809e0c4d246ff8c08d3029bbcec918883c01d4452cb1f87b38d3137d1082700c
MD5 959cca3b67246a37994dd04b44f731ac
BLAKE2b-256 256cffadd68b09bf10ed83dac81d414fbbd8ff236843877997d2510f0e6b9840

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page