CMA-ES / libcmaes

libcmaes is a multithreaded C++11 library with Python bindings for high performance blackbox stochastic optimization using the CMA-ES algorithm for Covariance Matrix Adaptation Evolution Strategy
Other
321 stars 78 forks source link

Improve Python bindings API documentation #114

Closed beniz closed 9 years ago

beniz commented 9 years ago

As a starter, currently, help can be obtained as follows:

python
Python 2.7.8 (default, Oct 20 2014, 15:05:19) 
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import lcmaes
>>> help(lcmaes)

will yield a page with classes and methods. However, informative docstrings are missing and they will be added as to fulfill this ticket.

beniz commented 9 years ago

Bindings has now full documentation in code, and available from Python, such as:

python
Python 2.7.8 (default, Oct 20 2014, 15:05:19) 
[GCC 4.9.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import lcmaes
>>> help(lcmaes.CMAParametersNB)

yields:

Help on class CMAParametersNB in module lcmaes:

class CMAParametersNB(Boost.Python.instance)
 |  CMAParameters object for problems with unbounded function parameters
 |  
 |  Method resolution order:
 |      CMAParametersNB
 |      Boost.Python.instance
 |      __builtin__.object
 |  
 |  Methods defined here:
 |  
 |  __init__(...)
 |      __init__( (object)arg1) -> None
 |  
 |  __reduce__ = <unnamed Boost.Python function>(...)
 |  
 |  dim(...)
 |      dim( (CMAParametersNB)arg1) -> int :
 |          return the problem dimension
 |  
 |  get_algo(...)
 |      get_algo( (CMAParametersNB)arg1) -> int :
 |          return the optimization algorithm code (0 to 14)
 |  
 |  get_edm(...)
 |...

or:

help(lcmaes.pcmaes)

that yields:

Help on built-in function pcmaes in module lcmaes:

pcmaes(...)
    pcmaes( (fitfunc_pbf)fitfunc, (CMAParametersNB)parameters) -> CMASolutions :
        optimizes a function with unbounded parameters
beniz commented 9 years ago

Added how to use Python help to relevant page in documentation: https://github.com/beniz/libcmaes/wiki/Python-bindings