Data matching
Greedy matching of centroid points to expert annotations based on standard Euclidean distance.From its SKILL.md
npx -y skills add cxcscmu/SkillLearnBench --skill data-matchingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
1.3 KB, 316 tokens by cl100k_base, as published. Nobody here has run it
Logic
Greedy matching for two point sets.
import numpy as np
from scipy.spatial.distance import cdist
def match_points(centroids, expert_points, max_dist=100.0):
if len(centroids) == 0 or len(expert_points) == 0:
return 0, 0, 0 # TP, FN, FP
dist_matrix = cdist(centroids, expert_points, 'euclidean')
# Find all pairs within distance
matches = []
for i in range(len(centroids)):
for j in range(len(expert_points)):
if dist_matrix[i, j] <= max_dist:
matches.append((dist_matrix[i, j], i, j))
matches.sort(key=lambda x: x[0]) # Closest first
used_centroids = set()
used_experts = set()
total_dist = 0
num_matches = 0
for dist, i, j in matches:
if i not in used_centroids and j not in used_experts:
used_centroids.add(i)
used_experts.add(j)
total_dist += dist
num_matches += 1
# TP: num_matches
# FN: len(expert_points) - num_matches
# FP: len(centroids) - num_matches
return num_matches, len(expert_points) - num_matches, len(centroids) - num_matches, total_dist
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.