Skip to content

Latest commit

 

History

History
72 lines (63 loc) · 1.45 KB

System_Model_Parameter_Sweep.md

File metadata and controls

72 lines (63 loc) · 1.45 KB

System Model Parameter Sweep

Parametrization of a System Model configuration that produces multiple configurations.

Set Parameters
params = {
    'alpha': [1],
    'beta': [2, 5],
    'gamma': [3, 4],
    'omega': [7]
}

The parameters above produce 2 simulations.

  • Simulation 1:
    • alpha = 1
    • beta = 2
    • gamma = 3
    • omega = 7
  • Simulation 2:
    • alpha = 1
    • beta = 5
    • gamma = 4
    • omega = 7

All parameters can also be set to include a single parameter each, which will result in a single simulation.

Example State Updates

Previous State: y = 0

def state_update(_params, step, sH, s, _input):
    y = 'state'
    x = s['state'] + _params['alpha'] + _params['gamma']
    return y, x
  • Updated State:
    • Simulation 1: y = 4 = 0 + 1 + 3
    • Simulation 2: y = 5 = 0 + 1 + 4
Example Policy Updates
# Internal States per Mechanism
def policies(_params, step, sH, s):
    return {'beta': _params['beta'], 'gamma': _params['gamma']}
  • Simulation 1: {'beta': 2, 'gamma': 3]}
  • Simulation 2: {'beta': 5, 'gamma': 4}
Configure Simulation
from cadCAD.configuration.utils import config_sim

g = {
    'alpha': [1],
    'beta': [2, 5],
    'gamma': [3, 4],
    'omega': [7]
}

sim_config = config_sim(
    {
        "N": 2,
        "T": range(5),
        "M": g,
    }
)

Example