Skip to main content

No project description provided

Project description

Parameter Space Exploration and CMA-ES Optimisation

This package might be useful if you have a model taking as input a set of parameters.

Start simulations from any sample(s) drown from the parameter space. Sampling may be analytical (like ParameterSpaceExploration with param iterators) or unknown (like ParameterSpaceAsk for CMA-ES).

The simulation parameters are the main model parameters. Optimisation parameters define a subset of simu params and spawn the parameter space. This package basically builds SimulationParameters for any sample of the parameter space, allowing to easily start simulations, and optimisation.

Install

pip install optimflow

Run parameters exploration

out_path = Path(__file__).parent / "out"

# Declare parameters of interest
class Params(OptimParams):
    p1 = param.Number(1, bounds=(0, 1), doc="Parameter 1")
    p2 = param.Number(1, bounds=(0.9, 1.1), doc="Parameter 2")

# Create simulation and exploration parameters
simulation_params = SimulationParams()
optim_params = Params()

# Define your simulation worker
def worker(dname: str):
    # Load parameters from the directory (prepared by dump_params)
    params = SimulationParams.load_from(dname)

    # mock the model's result
    t = np.linspace(0, 1, 100)
    res = params.p1 * np.sin(params.p2 * 2 * np.pi * t)
    np.savetxt(params.out_dir / "result.txt", res)

# Main class to start exploring the parameter space
explo = ParameterSpaceExploration(out_path)
explo.dump_params(simulation_params, optim_params)  # linear iterator
explo.run(worker, parallel=True)  # start all models
explo.gather_results()  # build a big pandas dataframe
explo.plot_results()  # plot model results for each varying optim param

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

optimflow-0.0.4.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

optimflow-0.0.4-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file optimflow-0.0.4.tar.gz.

File metadata

  • Download URL: optimflow-0.0.4.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for optimflow-0.0.4.tar.gz
Algorithm Hash digest
SHA256 8abb046b1411543c7a4db2e409ff90da54a08415bc13ae9f3608adee0466698d
MD5 20ad28854c223c30054df37c59a60dec
BLAKE2b-256 8421d41d5255f93e84e59818e93c6a0db5ded6ed6e16f877816f0dff88de0128

See more details on using hashes here.

File details

Details for the file optimflow-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: optimflow-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for optimflow-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 00adb9c76fc7a41387b3fed545fcdfaed676c96cf83b1567ab0e3bb08b1d1839
MD5 d770c06481bd7737711f7e850525b7b2
BLAKE2b-256 c156d142955425a2da59fa65d8c1143aff256c10250b941ad4c1ac6652c5fb30

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page