Spaces:
Running
Running
improve matching availability
Browse files- README.md +4 -6
- __main__.py +1 -0
- matching_series.py +8 -13
README.md
CHANGED
@@ -153,12 +153,10 @@ Let prediction instances be $P = \{p_1, p_2, \ldots, p_n\}$ and reference instan
|
|
153 |
- **.\*_features**: (list of float): The values computed individually for each feature.
|
154 |
- **macro_.\***: (float): Averaged values computed for each feature, average of the \*\_features.
|
155 |
- **distance**: (numpy.ndarray): The distance matrix between the generated instances and the reference instances.
|
156 |
-
- **match**: (numpy.ndarray): The matching
|
157 |
-
- **match_inv**: (numpy.ndarray): The matching
|
158 |
-
- **
|
159 |
-
- **
|
160 |
-
- **mean_g2r_index**: (numpy.ndarray): The index of the reference instance that matches the generated instance.
|
161 |
-
- **mean_r2g_index**: (numpy.ndarray): The index of the generated instance that matches the reference instance.
|
162 |
|
163 |
<!-- #### Values from Popular Papers -->
|
164 |
<!-- *Give examples, preferrably with links to leaderboards or publications, to papers that have reported this metric, along with the values they have reported.* -->
|
|
|
153 |
- **.\*_features**: (list of float): The values computed individually for each feature.
|
154 |
- **macro_.\***: (float): Averaged values computed for each feature, average of the \*\_features.
|
155 |
- **distance**: (numpy.ndarray): The distance matrix between the generated instances and the reference instances.
|
156 |
+
- **match**: (numpy.ndarray): The matching between the generated instances and the reference instances.
|
157 |
+
- **match_inv**: (numpy.ndarray): The matching between the reference instances and the generated instances.
|
158 |
+
- **match_features**: (numpy.ndarray): The matching between the generated instances and the reference instances for each feature.
|
159 |
+
- **match_inv_features**: (numpy.ndarray): The matching between the reference instances and the generated instances for each feature.
|
|
|
|
|
160 |
|
161 |
<!-- #### Values from Popular Papers -->
|
162 |
<!-- *Give examples, preferrably with links to leaderboards or publications, to papers that have reported this metric, along with the values they have reported.* -->
|
__main__.py
CHANGED
@@ -46,6 +46,7 @@ results = metric.compute(
|
|
46 |
num_processes=args.num_processes,
|
47 |
return_each_features=True,
|
48 |
return_coverages=True,
|
|
|
49 |
dtype=args.dtype,
|
50 |
)
|
51 |
logger.info(f"Time taken: {time.time() - s}")
|
|
|
46 |
num_processes=args.num_processes,
|
47 |
return_each_features=True,
|
48 |
return_coverages=True,
|
49 |
+
return_matching=True,
|
50 |
dtype=args.dtype,
|
51 |
)
|
52 |
logger.info(f"Time taken: {time.time() - s}")
|
matching_series.py
CHANGED
@@ -229,7 +229,6 @@ class matching_series(evaluate.Metric):
|
|
229 |
return_matching: bool = False,
|
230 |
return_each_features: bool = False,
|
231 |
return_coverages: bool = False,
|
232 |
-
return_matching_indices: bool = False,
|
233 |
return_all: bool = False,
|
234 |
dtype=np.float32,
|
235 |
eps: float = 1e-8,
|
@@ -270,6 +269,8 @@ class matching_series(evaluate.Metric):
|
|
270 |
distance (numpy.ndarray): The distance matrix.
|
271 |
match (numpy.ndarray): The matching matrix.
|
272 |
match_inv (numpy.ndarray): The inverse matching matrix.
|
|
|
|
|
273 |
"""
|
274 |
if return_all:
|
275 |
return_distance = True
|
@@ -328,6 +329,12 @@ class matching_series(evaluate.Metric):
|
|
328 |
out["distance"] = distance
|
329 |
if return_matching:
|
330 |
out.update({k: v for k, v in metrics.items() if "match" in k})
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
if return_coverages:
|
332 |
out["coverages"] = metrics["coverages"]
|
333 |
if return_each_features:
|
@@ -344,18 +351,6 @@ class matching_series(evaluate.Metric):
|
|
344 |
"coverages_features": [m["coverages"] for m in metrics_feature],
|
345 |
}
|
346 |
)
|
347 |
-
if return_matching_indices:
|
348 |
-
# matching index
|
349 |
-
g2r_index = distance.argmin(axis=1)
|
350 |
-
r2g_index = distance.argmin(axis=0)
|
351 |
-
# mean
|
352 |
-
mean_g2r_index = distance_mean.argmin(axis=1)
|
353 |
-
mean_r2g_index = distance_mean.argmin(axis=0)
|
354 |
-
|
355 |
-
out["g2r_index"] = g2r_index
|
356 |
-
out["r2g_index"] = r2g_index
|
357 |
-
out["mean_g2r_index"] = mean_g2r_index
|
358 |
-
out["mean_r2g_index"] = mean_r2g_index
|
359 |
|
360 |
return out
|
361 |
|
|
|
229 |
return_matching: bool = False,
|
230 |
return_each_features: bool = False,
|
231 |
return_coverages: bool = False,
|
|
|
232 |
return_all: bool = False,
|
233 |
dtype=np.float32,
|
234 |
eps: float = 1e-8,
|
|
|
269 |
distance (numpy.ndarray): The distance matrix.
|
270 |
match (numpy.ndarray): The matching matrix.
|
271 |
match_inv (numpy.ndarray): The inverse matching matrix.
|
272 |
+
match_features (list of numpy.ndarray): The matching matrix for each feature.
|
273 |
+
match_inv_features (list of numpy.ndarray): The inverse matching matrix for each feature.
|
274 |
"""
|
275 |
if return_all:
|
276 |
return_distance = True
|
|
|
329 |
out["distance"] = distance
|
330 |
if return_matching:
|
331 |
out.update({k: v for k, v in metrics.items() if "match" in k})
|
332 |
+
|
333 |
+
g2r_index = distance.argmin(axis=1)
|
334 |
+
r2g_index = distance.argmin(axis=0)
|
335 |
+
out["match_features"] = g2r_index
|
336 |
+
out["match_inv_features"] = r2g_index
|
337 |
+
|
338 |
if return_coverages:
|
339 |
out["coverages"] = metrics["coverages"]
|
340 |
if return_each_features:
|
|
|
351 |
"coverages_features": [m["coverages"] for m in metrics_feature],
|
352 |
}
|
353 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
|
355 |
return out
|
356 |
|