CostDistribution.from_data#
- classmethod CostDistribution.from_data(matrix, cost_matrix, *, min_bounds=None, max_bounds=None, bin_edges=None)[source]#
Convert values and a cost matrix into a CostDistribution.
- 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:
An instance of CostDistribution containing the given data.
- Return type:
cost_distribution
See also