adaptive_bins

adaptive split data into bins.

class AdaptiveBound(base_data, bins, base_bound=None)[source]

Bases: object

adaptive bound cut for data value

static base_bound(data)[source]

base bound for the data

get_bool_mask(data)[source]

bool mask for splitting data

get_bound_patch(**kwargs)[source]
get_bounds()[source]

get split data bounds

get_bounds_data()[source]

get split data bounds, and the data after splitting

static loop_split_bound(datas, n, base_bound=None)[source]

loop for multi_split_bound, so n is list of list of int

static multi_split_bound(datas, n, base_bound=None)[source]

multi data for single_split_bound, so n is list of int

>>> data = np.array([[1.0, 2.0, 1.4, 3.1], [2.0, 1.0, 3.0, 1.0]])
>>> bound, _ = AdaptiveBound.multi_split_bound(data, [2, 1])
>>> [(i[0][0]+1e-6, i[1][0]+1e-6) for i in bound]
[(1.0..., 1.7...), (1.7..., 3.1...)]
plot_bound(ax, **kwargs)[source]
static single_split_bound(data, n=2, base_bound=None)[source]

split data in the order of data value

>>> data = np.array([1.0, 2.0, 1.4, 3.1])
>>> AdaptiveBound.single_split_bound(data)
[(1.0, 1.7...), (1.7..., 3.1...)]
split_data(data)[source]

split data, the shape is same as base_data

split_full_data(data, base_index=None)[source]

split structure data, (TODO because large IO, the method is slow.)

adaptive_shape(m, bins, xmin, xmax)[source]
binning_shape_function(m, bins)[source]
cal_chi2(numbers, n_fp)[source]