tadkit.utils package

Submodules

tadkit.utils.decomposable_tadlearner module

class tadkit.utils.decomposable_tadlearner.DecomposableTADLearner(**params)[source]

Bases: TADLearner

Abstract base class combining a Preprocessor and a TADLearner.

Learner: Type[TADLearner]
Preprocessor: Type
embed(X: ndarray | list | DataFrame) ndarray | list | DataFrame[source]
fit(X: ndarray | list | DataFrame, y: ndarray | list | DataFrame | None = None) DecomposableTADLearner[source]
score_samples(X: ndarray | list | DataFrame) ndarray | list | DataFrame[source]

The measure of normality of an observation according to the fitted model. Scikit-learn compatible.

Parameters:

X ({array-like, sparse matrix} of shape (n_samples, n_features)) – The input samples.

Returns:

scores – The anomaly score of the input samples. The lower, the more abnormal.

Return type:

ndarray of shape (n_samples,)

tadkit.utils.decomposable_tadlearner.decomposable_tadlearner_factory(Preprocessor: Type, Learner: Type[TADLearner], name: str | None = None) Type[TADLearner][source]

Create a TADLearner class combining a preprocessor and a learner with a proper __init__ signature.

tadkit.utils.param_spec module

tadkit.utils.param_spec.anchor_type_to_default(entry: Dict[str, Any]) Dict[str, Any][source]

If parameter has multiple possible types or categories, restrict to the one matching the default’s type.

tadkit.utils.param_spec.determine_widget(entry: Dict[str, Any]) Dict[str, Any][source]

Infer a UI widget and arguments from parameter metadata.

tadkit.utils.param_spec.get_default_class_values(cls) Dict[str, Any][source]
tadkit.utils.param_spec.get_param_descriptions(cls) Dict[str, str][source]
tadkit.utils.param_spec.params_from_class(cls) Dict[str, Dict[str, Any]][source]

Combine default values, docstrings, and sklearn parameter constraints into a unified param specification dictionary.

Returns:

param_name -> {

‘default’: Any, ‘type’: type or str, ‘bounds’: {‘min’:…, ‘max’:…, ‘closed’:…}, ‘options’: list[str] or None, ‘allow_none’: bool, ‘description’: str

}

Return type:

Dict[str, Dict[str, Any]]

tadkit.utils.param_spec.parse_sklearn_constraints(parameter_constraints) Dict[str, Dict[str, Any]][source]

Convert sklearn-style constraints to structured type info.

tadkit.utils.render_widgets_from_params module

tadkit.utils.render_widgets_from_params.render_widgets_from_params(params: dict, frontend='ipywidgets')[source]

Render or return parameter specs as widgets, Streamlit inputs, or dicts.

Adapted to new param spec including widget and widget_args.

tadkit.utils.ui module

class tadkit.utils.ui.WidgetFactory(frontend='ipywidgets')[source]

Bases: object

Factory for creating UI widgets or no-UI representations.

WIDGET_STYLE = {'description_width': 'initial'}
make_dict(label, default, description)[source]
make_dropdown(label, options, default, description)[source]

Create a dropdown input.

make_numeric(label, default, min_val, max_val, ptype, description, closed='both', allow_none=False)[source]

Create a numeric input widget.

make_text(label, default, description)[source]
tadkit.utils.ui.sanitize_default(default, min_val, max_val, ptype, closed='both', allow_none=False)[source]

Clamp and adjust defaults based on type and bounds.

Module contents