skactiveml.utils.check_cost_matrix#

skactiveml.utils.check_cost_matrix(cost_matrix, n_classes, only_non_negative=False, contains_non_zero=False, diagonal_is_zero=False)[source]#

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

Parameters
cost_matrixarray-like, shape (n_classes, n_classes)

Cost matrix.

n_classesint

Number of classes.

only_non_negativebool, optional (default=True)

This parameter determines whether the matrix must contain only non negative cost entries.

contains_non_zerobool, optional (default=True)

This parameter determines whether the matrix must contain at least on non-zero cost entry.

diagonal_is_zerobool, optional (default=True)

This parameter determines whether the diagonal cost entries must be zero.

Returns
cost_matrix_newnp.ndarray, shape (n_classes, n_classes)

Numpy array as cost matrix.