GravityModelCalibrateResults#
- class caf.distribute.gravity_model.core.GravityModelCalibrateResults(cost_distribution, cost_convergence, value_distribution, target_cost_distribution, cost_function, cost_params)#
Bases:
GravityModelResultsA collection of results from a run of the Gravity Model.
- Parameters:
cost_distribution (caf.toolkit.cost_utils.CostDistribution) – The achieved cost distribution of the run.
cost_convergence (float) – The achieved cost convergence value of the run. If target_cost_distribution is not set, then this should be 0. This will be the same as calculating the convergence of cost_distribution and target_cost_distribution.
value_distribution (numpy.ndarray) – The achieved distribution of the given values (usually trip values between different places).
target_cost_distribution (caf.toolkit.cost_utils.CostDistribution) – The cost distribution the gravity model was aiming for during its run.
cost_function (caf.distribute.cost_functions.CostFunction) – The cost function used in the gravity model run.
cost_params (dict[str | int, Any]) – The cost parameters used with the cost_function to achieve the results.
Attributes Summary
Summary of the GM calibration parameters as a series.
Methods Summary
plot_distributions([truncate_last_bin])Plot a comparison of the achieved and target distributions.
Attributes Documentation
- summary#
Summary of the GM calibration parameters as a series.
Outputs the gravity model achieved parameters and the convergence.
- Returns:
a summary of the calibration
- Return type:
pd.DataFrame
Methods Documentation
- plot_distributions(truncate_last_bin=False)#
Plot a comparison of the achieved and target distributions.
This method returns a matplotlib figure which can be saved or plotted as the user decides.
- Parameters:
truncate_last_bin (bool, optional) – whether to truncate the graph to 1.2x the lower bin edge, by default False
- Returns:
the plotted distributions
- Return type:
figure.Figure
- Raises:
ValueError – when the target and achieved distributions have different binning