(index_arr, check_arr=True)
return label_size
Infer the label size from a set of index arr.

    raise if all index are example index only.

    Parameters
    ----------
    index_arr: list or np.ndarray
        index array.

    Returns
    -------
    label_size: int
    the inferred label size.
Infer the label size from a set of index arr.
Infer the label size from a set of index arr .
def infer_label_size_multilabel(index_arr, check_arr=True):
    """Infer the label size from a set of index arr.

    raise if all index are example index only.

    Parameters
    ----------
    index_arr: list or np.ndarray
        index array.

    Returns
    -------
    label_size: int
    the inferred label size.
    """
    if check_arr:
        index_arr = check_index_multilabel(index_arr)
    data_len = np.array([len(i) for i in index_arr])
    if np.any(data_len == 2):
        label_size = np.max([i[1] for i in index_arr if len(i) == 2]) + 1
    elif np.all(data_len == 1):
        raise Exception(
            "Label_size can not be induced from fully labeled set, label_size must be provided.")
    else:
        raise ValueError(
            "All elements in indexes should be a tuple, with length = 1 (example_index, ) "
            "to query all labels or length = 2 (example_index, [label_indexes]) to query specific labels.")
    return label_size
def infer_label_size_multilabel ( index_arr , check_arr = True ) : if check_arr : index_arr = check_index_multilabel ( index_arr ) data_len = np . array ( [ len ( i ) for i in index_arr ] ) if np . any ( data_len == 2 ) : label_size = np . max ( [ i [ 1 ] for i in index_arr if len ( i ) == 2 ] ) + 1 elif np . all ( data_len == 1 ) : raise Exception ( "Label_size can not be induced from fully labeled set, label_size must be provided." ) else : raise ValueError ( "All elements in indexes should be a tuple, with length = 1 (example_index, ) " "to query all labels or length = 2 (example_index, [label_indexes]) to query specific labels." ) return label_size