@@ -73,6 +73,35 @@ def __init__(
73
73
n_jobs = n_jobs ,
74
74
)
75
75
76
+ def return_information_imbalace (self , coordinates , k = 1 ):
77
+
78
+ distances = None
79
+ dist_indices = None
80
+
81
+ assert any (
82
+ var is not None for var in [self .X , self .distances , self .dist_indices ]
83
+ ), "MetricComparisons should be initialized with a dataset."
84
+
85
+ assert any (
86
+ var is not None for var in [coordinates , distances , dist_indices ]
87
+ ), "The overlap with data requires a second dataset. \
88
+ Provide at least one of coordinates, distances, dist_indices."
89
+
90
+ dist_indices_base , _ = self ._get_nn_indices (
91
+ self .X , self .distances , self .dist_indices , self .maxk
92
+ )
93
+
94
+ dist_indices_other , _ = self ._get_nn_indices (
95
+ coordinates , distances , dist_indices , self .maxk
96
+ )
97
+
98
+ assert dist_indices_base .shape [0 ] == dist_indices_other .shape [0 ]
99
+
100
+ imb_ij = _return_imbalance (dist_indices_base , dist_indices_other , self .rng , k = k )
101
+ imb_ji = _return_imbalance (dist_indices_other , dist_indices_base , self .rng , k = k )
102
+
103
+ return imb_ij , imb_ji
104
+
76
105
def return_inf_imb_two_selected_coords (self , coords1 , coords2 , k = 1 ):
77
106
"""Return the imbalances between distances taken as the i and the j component of the coordinate matrix X.
78
107
0 commit comments