Code Monkey home page Code Monkey logo

honeybee's Introduction

Honeybee

An artificial bee colony implementation in Python

Installation

To install with pip:

pip install honeybee

Usage

To use, first install the package as above, then define a function that you wish to optimize. This can be a simple mathematical formula, or something that calls a complicated model training routine. The important thing is that it depends on hyperparameters that can be passed to the function, and returns a fitness measure that will be maximized by the algorithm:

def my_func(**params):
    """ Implements Rastrigin's function of two inputs. """
    x = [v for v in params.values()]
    return 20 + sum([a**2 - 10*cos(2*np.pi*a) for a in x])

Next define the ranges of parameters over which you wish to optimize:

params = {'x1': (-5.12, 5.12),
          'x2': (-5.12, 5.12)}

Finally, initialize the colony and fit the objective function:

my_colony = Colony(my_func, params, num_bees=10)
my_colony.fit()

honeybee's People

Contributors

engineero avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

j-victorll

honeybee's Issues

Implement arbitrary distributions for parameters

Allow the user to input parameter bounds, in which case new explored points are chosen uniformly between the bounds, or arbitrary distributions that can be used to generate a draw for a new explored point.

Create examples

Create a few examples (notebooks?) that can be viewed or run to illustrate the utility of the algorithm.

Cannot import 'Colony'

Hi, thanks for your work first. When I ran "from honeybee import Colony", I got the ImportError: cannot import name 'Colony' from 'honeybee'.
Do you have any solution for it?

Implement a hash table for evaluated locations

Implement a hash table maintained by the colony that keeps track of the cost associated with every location already evaluated. Allow the table to be initialized with values by the user, and return the stored value if a location gets revisited.

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.