skactiveml.utils#

The skactiveml.utils module includes various utilities.

Classes#

utils.ExtLabelEncoder

Encode class labels with integers in [0, ..., n_classes-1] and use -1 for unlabeled.

utils.TargetSpec

Immutable description of resolved target semantics.

Functions#

utils.rand_argmax

Returns index of maximum value.

utils.rand_argmin

Returns index of minimum value.

utils.compute_vote_vectors

Counts number of votes per class label for each sample.

utils.majority_vote

Assigns a label to each sample based on weighted voting.

utils.is_unlabeled

Creates a boolean mask indicating missing labels.

utils.is_labeled

Creates a boolean mask indicating present labels.

utils.check_classes

Check whether class labels are uniformly strings or numbers.

utils.check_missing_label

Check whether a missing label is compatible to a given target type.

utils.check_cost_matrix

Check whether cost matrix has shape (n_classes, n_classes).

utils.check_scalar

Validate scalar parameters type and value.

utils.check_classifier_params

Check whether the general classifier are compatible with each other.

utils.check_X_y

Input validation for standard estimators.

utils.check_random_state

Check validity of the given random state.

utils.call_func

Calls a function with the given parameters given in kwargs, if they exist as parameters in f_callable.

utils.match_signature

A decorator that matches the signature to a given method from a reference and hides it when the reference object does not have the wrapped function.

utils.check_class_prior

Check if the class_prior is a valid prior.

utils.ext_confusion_matrix

Compute confusion matrix [R3479f72bc894-1] to evaluate the accuracy of a classification.

utils.labeled_indices

Return an array of indices indicating present labels.

utils.unlabeled_indices

Return an array of indices indicating missing labels.

utils.check_type

Check whether an object satisfies type, value, or indicator rules.

utils.check_bound

Validates bound and returns the bound of X if bound is None.

utils.check_equal_missing_label

Check whether two missing label values are equal to each other.

utils.check_budget_manager

Validate if budget_manager is a budget manager class and create a copy budget_manager_.

utils.check_indices

Check if indices fit to array.

utils.simple_batch

Generates a batch by selecting the highest values in the utilities.

utils.check_n_features

Validate and update the expected number of features of an estimator.

utils._check_callable

Check whether func is callable with the expected arity.

utils._check_forward_outputs

Validate the forward_outputs mapping used by SkorchMixin.

utils._has_nested_classes

Check whether classes contains one vocabulary per target label.

utils.resolve_target_spec

Resolve declared intent and target evidence to a target specification.

utils.make_criterion_tuple_aware

Create a loss class (or wrap an existing instance) that selects part of a model's (possibly tuple-valued) output before passing it to the criterion.