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.5.tar.gz (9.2 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.5-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for optimflow-0.0.5.tar.gz
Algorithm Hash digest
SHA256 33597847fd6b4e4172feb0ad55ee8186efb14b9beb7ebfbf7e70f9b1bd316797
MD5 b8926ac858a3ffd6ade8c1c4117f0378
BLAKE2b-256 5e3d14edf8e8bdabd96f954d354610902285fe8daf05f2fc963b2011447fa624

See more details on using hashes here.

File details

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

File metadata

  • Download URL: optimflow-0.0.5-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.3

File hashes

Hashes for optimflow-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b097dc424ce544bc89ab13ce4375ef2c4fdb066f63253bfa9241eef69aa46666
MD5 c0efde0ad29ee68f32d1fa71c51a17f7
BLAKE2b-256 3af493c1cf2649bbf9e01e7759a04b1c23c3413b146e1fafb3d5e5145a835b50

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