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 Distribution

xevo-0.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

xevo-0.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file xevo-0.1.tar.gz.

File metadata

  • Download URL: xevo-0.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.6.6

File hashes

Hashes for xevo-0.1.tar.gz
Algorithm Hash digest
SHA256 f97be7dbef4a6bf11ff6cbad36b60c2dcf805e8295879f164a1b3cceefb14b6e
MD5 ff30a2abe75d14ef92d7309a52875e78
BLAKE2b-256 5378fbbb757fe7de7f7a3d1e5965031d431fd69167bcf60875c7d09a1af9b628

See more details on using hashes here.

File details

Details for the file xevo-0.1-py3-none-any.whl.

File metadata

  • Download URL: xevo-0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.23.4 CPython/3.6.6

File hashes

Hashes for xevo-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9eb73e8261afe4b459992fe012db2a7c08b230d7180cbc0f0dcd281b1bc9981f
MD5 19135ba95e225d257a8ee9bbf393bbc0
BLAKE2b-256 28d1d0730bf5c614e080c9b3f5f22e94c8f93ad55f444da0dfbb032721e282d0

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