Git Product home page Git Product logo

monkeys's Introduction

monkeys

PyPI version

"If an army of monkeys were strumming on typewriters they might write all the books in the British Museum."

monkeys is a framework designed to make genetic programming in Python accessible, quick, flexible, and fun.

Get started here.

What is genetic programming?

Genetic programming algorithms are a class of evolutionary algorithms in which solutions to a problem are represented as executable tree structures - programs. In order to use genetic programming in order to solve a problem, two things must be specified:

  1. What form(s) a potential solution can take.

  2. A method of scoring solutions based on their meritoriousness.

Given these, a genetic programming system can perform intelligent exploration and search through the space of potential solutions, narrowing in on those programs that best solve the problem as specified. Genetic programming has achieved human-competitive results in a wide swath of domains, including:

monkeys to the rescue!

"Ford, there's an infinite number of monkeys outside who want to talk to us about this script for Hamlet they've worked out."

monkeys makes getting started with genetic programming painless and fun. Install monkeys by running:

pip install monkeys

monkeys uses a variant of genetic programming called "strongly-typed genetic programming" in order to allow you to quickly and easily specify how your programs should be structured.

monkeys supports Python 2.7 and 3.x.

Examples

Tutorials:

Sample usages:

Contacts

monkeys's People

Contributors

hchasestevens avatar mrknmc avatar suchow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

monkeys's Issues

How to use multiple types?

Hi,

I tried the following code, attempting to use two types :
@params(bool,float,float)
@rtype(float)
def IfCond(c,a,b):
if c==True :
return a
return b

recevied the following error:

File "twoTypes.py", line 64, in IfCond
if c==True :

TypeError: 'bool' object is not callable

I wanted my function to receive a boolean value (produced by a function with a boolean rtype, for example) and return either a or b, depending upon that value

Could anyone please correct my code, or provide a working example with a boolean-returning function, used by a float-returning function?

Thanks in advance!
Ami

AST example: unable to reproduce evolved my_abs function

Running Monkeys in abstract syntax trees in Jupyter (on Python 2.7), I was unable to reproduce the result in the original notebook.

from monkeys.tools.display import type_graph
type_graph()

The code above generated the exact same type graph as shown in the original notebook. So far so good.
However, when calling optimize

best_abs = optimize(score, iterations=25)

it never managed to output a useful abs function. Most of the time the output was either

def my_abs(x):
    return int(x)

or

def my_abs(x):
    return int(-x)

After dumping all the generated intermediary ASTs, I have noticed that the conditional if_else never once appeared in any of the generated trees. What might be the reason for this?

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.