Git Product home page Git Product logo

pyshark's Introduction

pyshark

This project tries to provide a Python scripting interface for the CMA-ES and MO-CMA-ES algorithms implemented in the SHARK ML library. Its purpose is to create a simple python interface to the MO-CMA-ES algorithm. For more elaborate solutions have a look at the DEAP or chocolate project. The wrapper for the single-objective CMA-ES algorithm has been implemented for didactic purposes. For production calculations using Python I recommend the implementation by Nikolaus Hansen.

Getting Started

Prerequisites

In order to use this wrapper you have to have a working Shark installation. Please make sure, that Shark is build as shared library. This wrapper has only been tested with Shark release 3.1.4. In addition at least Python 2.7, including numpy and ctypes are needed. If you want to use the provided example for the MO-CMA-ES algorithm the optproblems package has to be installed.

Installation

In order to install the code follow the following steps:

git clone https://github.com/jduerholt/pyshark.git
cd pyshark
mkdir build
cd build
cmake "-DShark_DIR=/PATH/TO/SHARK" ../src/.
make
cd ../pyshark
ln -s ../build/libsharkwrapper .

In addition, make sure that the pyshark directory is in the PYTHONPATH.

Using the code

Two examples showing how to use the code are given in the examples subdirectory.

CMA-ES

The file cma.py use CMA-ES to optimize a three dimensional sphere function. Run the example by the help of the following command:

python cma.py

At the end it will print the final solution after 500 iterations.

MO-CMA-ES

The file mocma.py uses the multi-objective variant of CMA-ES to optimize the DTLZ2 objective function in dimension three using two objectives. The example can be run by executing the following command:

python mocma.py

At the end it will print the solutions after 2500 iterations. In addition a file called pareto.dat is created holding the values of the optimal solutions.

Acknowledgments

  • Prof. Tobias Glasmachers for a great lecture on Evolutionary Algorithms and for initial help with wrapping Shark.

pyshark's People

Contributors

jduerholt avatar

Stargazers

 avatar  avatar  avatar

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.