cost_distribution#

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

Calculate the 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:

A numpy array of the sum of trips by distance band.

Return type:

cost_distribution

See also

None, None