atomica.calibration.calibrate

atomica.calibration.calibrate(project, parset, pars_to_adjust, output_quantities, max_time=None, method='asd', time_period=(-inf, inf), **kwargs)[source]

Run automated calibration

Parameters:
  • project – A project instance to provide data and sim settings

  • parset (ParameterSet) – A ParameterSet instance to calibrate

  • pars_to_adjust – list of tuples, (par_name, pop_name, lower_bound, upper_bound, initial_value) the pop name can be None, which will be expanded to all populations relevant to the parameter independently, or ‘all’ which will instead operate on the meta y factor. To calibrate a transfer, the parameter name should be set to '<tranfer_code_name>_from_<from_pop>' and then the destination population can be specified as the pop_name. For example, to automatically calibrate an aging transfer ‘age’ from 5-14 to 15-64, the tuple would contain pars_to_adjust=[('age_from_5-14','15-64',...)]

  • output_quantities – list of tuples, (var_label,pop_name,weight,metric), for use in the objective function. pop_name=None will expand to all pops. pop_name=’all’ is not supported. The output can optionally contain (var_label, pop_name, weight, metric, start_year, end_year) to select a subset of the data for evaluating the objective. The start year and end year specified here will take precedence over the time_period argument. In some cases, it may be desirable to fit to an aggregated total value across populations. In that case, the databook should have an extra row in the TDVE table for a population called “Total”. The measurable can then be given pop_name=”Total” which will cause the Atomica model outputs to be aggregated over all populations, and the aggregate value compared to the “Total” data. The aggregation methods will be automatically selected depending on units of the quantity (sum for “number” units, average for others).

  • max_time – If using ASD, the maximum run time

  • time_period – Tuple of start and end years to use for the objective function. Applies to all outputs unless the output has an explicitly specified start and end year

  • method – ‘asd’ or ‘pso’. If using ‘pso’ all upper and lower limits must be finite

  • kwargs – Dictionary of additional arguments to be passed to the optimization function, e.g. stepsize or pinitial

Return type:

ParameterSet

Returns:

A calibrated ParameterSet