cutcutcodec.core.edit.factor.proba.compute_cumhist

cutcutcodec.core.edit.factor.proba.compute_cumhist(expr: Basic | Real | str, n_per_bars: Integral = 3) Tensor[source]

Calculate the cumulative histogram of a law combination of reduced uniform probability.

Parameters

exprstr or sympy.Basic

The combination expression of uniform laws. The free_symbols variables correspond to the draws of these independent reduced uniform distributions.

n_per_barsint

The average number of samples by bars if there is enouth memory.

Returns

minfloat

The minimum value of the output of the expression expr.

maxfloat

The maximum value of the output of the expression expr.

cumhisttorch.Tensor

The float 32 cumulative histogram (1d vector) constitued of 256 bins. the min and max of the histograms match with the min and max of the expr.

Notes

This function can use some Gio of RAM.

Examples

>>> from cutcutcodec.core.edit.factor.proba import compute_cumhist
>>> min_, max_, cum = compute_cumhist("1 + x1 + x2")
>>> round(min_), round(max_)
(1, 3)
>>> cum.round(decimals=3)
tensor([0.0000, 0.0000, 0.0000, 0.0010, 0.0010, 0.0010, 0.0020, 0.0020, 0.0030,
        0.0030, 0.0040, 0.0040, 0.0050, 0.0060, 0.0070, 0.0080, 0.0090, 0.0100,
        0.0110, 0.0120, 0.0140, 0.0150, 0.0160, 0.0180, 0.0190, 0.0210, 0.0220,
        0.0240, 0.0260, 0.0280, 0.0290, 0.0310, 0.0330, 0.0350, 0.0380, 0.0400,
        0.0420, 0.0440, 0.0470, 0.0490, 0.0510, 0.0540, 0.0570, 0.0590, 0.0620,
        0.0650, 0.0680, 0.0700, 0.0730, 0.0760, 0.0800, 0.0830, 0.0860, 0.0890,
        0.0930, 0.0960, 0.0990, 0.1030, 0.1060, 0.1100, 0.1140, 0.1180, 0.1210,
        0.1250, 0.1290, 0.1330, 0.1370, 0.1410, 0.1460, 0.1500, 0.1540, 0.1580,
        0.1630, 0.1670, 0.1720, 0.1770, 0.1810, 0.1860, 0.1910, 0.1960, 0.2010,
        0.2060, 0.2110, 0.2160, 0.2210, 0.2260, 0.2310, 0.2370, 0.2420, 0.2480,
        0.2530, 0.2590, 0.2640, 0.2700, 0.2760, 0.2820, 0.2880, 0.2930, 0.2990,
        0.3060, 0.3120, 0.3180, 0.3240, 0.3300, 0.3370, 0.3430, 0.3500, 0.3560,
        0.3630, 0.3700, 0.3760, 0.3830, 0.3900, 0.3970, 0.4040, 0.4110, 0.4180,
        0.4250, 0.4330, 0.4400, 0.4470, 0.4550, 0.4620, 0.4700, 0.4770, 0.4850,
        0.4930, 0.5000, 0.5070, 0.5150, 0.5230, 0.5300, 0.5380, 0.5450, 0.5530,
        0.5600, 0.5670, 0.5750, 0.5820, 0.5890, 0.5960, 0.6030, 0.6100, 0.6170,
        0.6240, 0.6300, 0.6370, 0.6440, 0.6500, 0.6570, 0.6630, 0.6700, 0.6760,
        0.6820, 0.6880, 0.6940, 0.7010, 0.7070, 0.7120, 0.7180, 0.7240, 0.7300,
        0.7360, 0.7410, 0.7470, 0.7520, 0.7580, 0.7630, 0.7690, 0.7740, 0.7790,
        0.7840, 0.7890, 0.7940, 0.7990, 0.8040, 0.8090, 0.8140, 0.8190, 0.8230,
        0.8280, 0.8330, 0.8370, 0.8420, 0.8460, 0.8500, 0.8540, 0.8590, 0.8630,
        0.8670, 0.8710, 0.8750, 0.8790, 0.8820, 0.8860, 0.8900, 0.8940, 0.8970,
        0.9010, 0.9040, 0.9070, 0.9110, 0.9140, 0.9170, 0.9200, 0.9240, 0.9270,
        0.9300, 0.9320, 0.9350, 0.9380, 0.9410, 0.9430, 0.9460, 0.9490, 0.9510,
        0.9530, 0.9560, 0.9580, 0.9600, 0.9620, 0.9650, 0.9670, 0.9690, 0.9710,
        0.9720, 0.9740, 0.9760, 0.9780, 0.9790, 0.9810, 0.9820, 0.9840, 0.9850,
        0.9860, 0.9880, 0.9890, 0.9900, 0.9910, 0.9920, 0.9930, 0.9940, 0.9950,
        0.9960, 0.9960, 0.9970, 0.9970, 0.9980, 0.9980, 0.9990, 0.9990, 0.9990,
        1.0000, 1.0000, 1.0000, 1.0000])
>>>