normalised_cost_distribution#

caf.toolkit.cost_utils.normalised_cost_distribution(matrix, cost_matrix, min_bounds=None, max_bounds=None, bin_edges=None)[source]#

Calculate the normalised distribution of costs across a matrix.

Parameters:
  • matrix (ndarray) – The matrix to calculate the cost distribution for. This matrix should be the same shape as cost_matrix

  • cost_matrix (ndarray) – A matrix of cost relating to matrix. This matrix should be the same shape as matrix

  • min_bounds (list[float] | ndarray | None) – A list of minimum bounds for each edge of a distribution band. Corresponds to max_bounds.

  • max_bounds (list[float] | ndarray | None) – A list of maximum bounds for each edge of a distribution band. Corresponds to min_bounds.

  • bin_edges (list[float] | ndarray | None) – Defines a monotonically increasing array of bin edges, including the rightmost edge, allowing for non-uniform bin widths. This argument is passed straight into numpy.histogram

Returns:

  • cost_distribution – A numpy array of the sum of trips by distance band.

  • normalised_cost_distribution – Similar to cost_distribution, however the values in each band have been normalised to sum to 1.

Return type:

tuple[ndarray, ndarray]

See also

None, None