Code Monkey home page Code Monkey logo

pyanimats's Introduction

Usage

help - python pyanimats.py -h basic usage - pyanimats.py <output_dir> <tasks.yml> [options]

Installation

  1. Make virtualenv in Python 3

    • Mac

        `mkvirtualenv -p which python3 pyanimats`
      
    • Linux

        `mkvirtualenv -p /usr/bin/python3 pyanimats`
      
  2. pip install -r requirements.txt

    (make sure gcc is installed because you need gfortran compiler for scipy: brew install gcc)

  3. Rebuild each time any c++ changes

    python setup.py build_ext --inplace

Setup of a Task

  1. Prepare a task as a yaml file, example:

    # tasks/1-3-1-3.yml
    # PyAnimat goals and tasks.
    # 1 means catch the block, -1 means avoid it.
    ---
    # 1-3-1-3 task.
    - [ 1, '1000000000000000']
    - [-1, '1110000000000000']
    - [ 1, '1000000000000000']
    - [-1, '1110000000000000']
  2. Remove old build, and then rebuild it each time any c++ files change, (eg animats/constants.hpp)

    rm -r build && python setup.py build_ext --inplace

  3. Run it with 30,000 generations, and sample 600 individuals from the evolution

    python pyanimats.py ./raw_results/0.0.21/initial_tests/seed-0 ./tasks/1-3-1-3.yml -n 30000 -i 600

Outputs

In your selected output dir, will appear the following files:

  • config.json

    The configuration that this game was run with, including for example: NUM_MOTORS, TASKS, NUM_NODES, MUTATION_PROB, etc.

  • hof.pkl - "Hall of Fame"

    Individual's animat

  • lineages.pkl

  • logbook.pkl

  • metadata.json

    Contains elapsed - seconds elapsed, and version - the version of the code

Josh's Questions/Notes/ToDos

main entry points

  • pyanimats.py

    -i flag - total number of genomes to save in lineages.pkl make it use a db

  • analyze.py

    make it use a db? except Larissa and Billy don't like dbs

  • plot.py

  • make_pkl_for_pyphi.py - uses analyze.py

  • Main Inputs

    config.py - a bunch of defaults that prob get overridden configure.py - reads config.json's constants.py - params.yml - obsolete/deprecated (?) tasks/*.yml - animat/constants.hpp -

  • Main Outputs

    • config.json -
    • metadata.json - version should be in dir structure, but it's here too just in case
    • hof.pkl - documented by DEAP, rarely used
    • lineages.pkl - double nested tuple, eg ((lineage of final animat - eg list of Animats, which are genomes sorta), (), ...)
      • note, each generation is determined probabilistically from the last generation, based on each Animat's fitness. So if in gen 1 you have 100 Animats, gen 2 will be determined by a mutated version of the previous generation's Animats, and the animats chosen for mutation are selected probabilistically based on their fitness.
    • logbook.pkl - documented by DEAP, obj from DEAP, a book w chapters, each chapter is some stat, each line in the "book" is a generation

game related

  • Game.cpp

  • HMM.cpp

agent related

  • individual.py - wrapper around the imported c++ animat object, plus some convenience stuff, this gets acted upon by the GA

  • animat.pyx - cython file, wraps agent.cpp, gets turned into an importable file

  • Agent.cpp - interacts with Game.cpp

  • animat.cpp - autogenerated version of animat.pyx, this gets taken and turned into built object that can be imported by python

Development Notes

###pretty much for development and should be ignored###

  • misc:

    silver searcher instead of grep 42, 213 = start codon

  • --jumpstart

    • doesnt work if there's a config.json supplied
    • more start codons reaaaly slows things down... why?
  • installing from github, maintaining branch/commit in pip freeze > requirements.txt

    • pip install -e git+https://github.com/wmayner/pyphi.git@a408bad57ad6df6d3d1c41787c69cda77d49adac#egg=pyphi

ToDo

  • End to End tests

  • "analyze" module for loading genomes into python objects that can be manipulated

  • Tests - what can be tested

  • Architecture plan

  • Hard coded things are tagged with # TODO: hard-coded: <description>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.