skactiveml.utils#

The skactiveml.utils module includes various utilities.

Classes#

utils.ExtLabelEncoder

Encode class labels with value between 0 and classes-1 and uses -1 for unlabeled samples.

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 parameters are compatible to each other (only if classes is not None).

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 if obj is one of the given types.

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 number of features for an estimator based on the input data.

utils._check_callable

Checks if func is a callable and if the number of free parameters is correct.

utils._check_forward_outputs

Check forward outputs required by SkorchMixin and make_criterion_tuple_aware.

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.