create_log_bins#

caf.toolkit.cost_utils.create_log_bins(max_value, n_bin_pow=0.51, log_factor=2.2, final_val=1500.0)[source]#

Dynamically choose the bins based on the maximum possible value.

n_bins = int(max_value ** n_bin_pow) Is used to choose the number of bins to use. bins = (np.array(range(2, n_bins)) / n_bins) ** log_factor * max_value is used to determine the bin edges being used.

Parameters:
  • max_value (float) – The maximum value seen in the data, this is used to scale the bins appropriately.

  • n_bin_pow (float) – The power used to determine the number of bins to use, depending on the max value. This value should be between 0 and 1. (0, 1) max_value ** n_bin_pow.

  • log_factor (float) – The log factor to determine the bin spacing. This should be a value greater than 1. Larger numbers mean closer bins

  • final_val (float) – The final value to append to the end of the bin edges. The second to last bin will be less than max_value, therefore this number needs to be larger than the max value.

Returns:

A numpy array of bin edges.

Return type:

bin_edges