15 def __init__(self, similarity_matrix: np.ndarray,
19 lower_app_weights_method : str,
20 upper_app_weights_method : str):
21 super().
__init__(similarity_matrix, labels)
31 if upper_app_weights_method
not in [
'sup_weights_linear']:
32 raise ValueError(f
"Unsupported weight type: {upper_app_weights_method}")
33 if lower_app_weights_method
not in [
'inf_weights_linear']:
34 raise ValueError(f
"Unsupported weight type: {lower_app_weights_method}")
41 if(upper_app_weights_method ==
'sup_weights_linear'):
43 if(lower_app_weights_method ==
'inf_weights_linear'):
49 label_mask = (self.
labels[:,
None] == self.
labels[
None, :]).astype(float)
58 np.fill_diagonal(implication_vals, 0.0)
59 sorted_matrix = np.sort(implication_vals, axis=1)
60 sorted_matrix = sorted_matrix[:, ::-1]
61 sorted_matrix = sorted_matrix[:, :-1]
67 label_mask = (self.
labels[:,
None] == self.
labels[
None, :]).astype(float)
76 np.fill_diagonal(implication_vals, 0.0)
77 sorted_matrix = np.sort(implication_vals, axis=1)
78 sorted_matrix = sorted_matrix[:, ::-1]
79 sorted_matrix = sorted_matrix[:, :-1]