Discretization API¶
Use registered names or callables without importing implementation modules. Built-in rules are described separately.
lzsuite.discretize ¶
Apply a registered or callable discretizer to one numeric sequence.
Parameters:
-
data(array_like) –Nonempty, finite, real numeric 1D sequence. Strings, objects, complex values, and nonfinite observations are rejected.
-
method(str or callable, default:'mean') –Registered label or function. Built-ins are
mean,median,bins,quantile, andpermutation. A custom callable receives a copy of the numeric input and may change the output length. -
**kwargs(dict, default:{}) –Keyword arguments forwarded to the selected method, such as
n_bins,order,delay, or a custom threshold.
Returns:
-
labels(numpy.ndarray of integers) –Nonempty 1D integer or boolean labels. Original observations are not mutated by the method; its input is copied before invocation.
Raises:
-
TypeError–If input is not real numeric data, method is not a name/callable, or the method returns noninteger or multidimensional output.
-
ValueError–If input is empty, nonfinite, or not 1D, the method name is unknown, or its output is empty. Method-specific validation also applies.
Notes
There is no 256-category restriction at this stage. Analysis functions warn and merge categories if the prepared alphabet exceeds 256 symbols. Numeric labels do not need to be contiguous or start at zero.
See Also
available_discretizers : List registered labels. register_discretizer : Add a reusable custom method. h : Apply a method independently across an array.
Examples:
lzsuite.available_discretizers ¶
List the registered discretization names in sorted order.
Returns:
-
names(tuple of str) –Built-in and user-registered labels available in this Python process.
See Also
register_discretizer : Add or replace a named method. discretize : Run a method on a 1D signal.
Examples:
lzsuite.register_discretizer ¶
Register a named discretizer directly or as a decorator.
Parameters:
-
name(str) –Nonempty registry label, used as
discretization=namein analysis calls ormethod=nameindiscretize. -
function(callable, default:None) –Numeric 1D-to-integer-1D function. Omit to obtain a decorator. Its output may differ in length from its input.
-
replace(bool, default:False) –Allow replacing an existing label, including a built-in method.
Returns:
-
registered(callable) –The supplied function unchanged, or a decorator if no function was supplied. Registration lasts for the current Python process only.
Raises:
-
TypeError–If the supplied function is not callable.
-
ValueError–If the name is empty or already exists without
replace=True.
Notes
The callable's input/output contract is checked when it is used. Array preparation invokes it in the parent process before parallel native calculations, so locally defined functions work in IPython.
See Also
discretize : Invoke a registered name or a callable. available_discretizers : Inspect current names.
Examples: