GravityModelResults#

class caf.distribute.gravity_model.core.GravityModelResults(cost_distribution, target_cost_distribution, cost_convergence, value_distribution, cost_function, cost_params)#

Bases: object

A collection of results from the Gravity Model.

Attributes Summary

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

Parameters:
  • cost_distribution (CostDistribution)

  • target_cost_distribution (CostDistribution)

  • cost_convergence (float)

  • value_distribution (ndarray)

  • cost_function (CostFunction)

  • cost_params (dict[str | int, Any])

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