agentsclimarketplace

Run2 matching metrics

Skill cxcscmu/SkillLearnBench/skills/b2-self-feedback-gemini-3-flash-preview/dbscan-parameter-tuning/run2_matching-metrics

Greedy point matching and calculation of F1 score and average distance (delta).From its SKILL.md

Install
npx -y skills add cxcscmu/SkillLearnBench --skill run2_matching-metrics

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

1.6 KB, 390 tokens by cl100k_base, as published. Nobody here has run it

Greedy Point Matching and Metrics

Detailed implementation of the matching process and metric calculations for image-based clustering.

Implementation

from scipy.spatial.distance import cdist
import numpy as np

def match_and_evaluate(predicted, expert, max_dist=100):
    """
    Match predicted centroids to expert points and compute metrics.
    """
    if len(predicted) == 0:
        return 0.0, np.nan
    
    if len(expert) == 0:
        return 0.0, np.nan

    # Greedy matching based on Euclidean distance
    dists = cdist(predicted, expert, metric='euclidean')
    
    # Flatten and sort pairs by distance
    pairs = []
    for i in range(dists.shape[0]):
        for j in range(dists.shape[1]):
            if dists[i, j] <= max_dist:
                pairs.append((dists[i, j], i, j))
    pairs.sort()

    matched_p = set()
    matched_e = set()
    match_distances = []
    for d, i, j in pairs:
        if i not in matched_p and j not in matched_e:
            matched_p.add(i)
            matched_e.add(j)
            match_distances.append(d)

    tp = len(match_distances)
    fp = len(predicted) - tp
    fn = len(expert) - tp
    
    precision = tp / (tp + fp) if (tp + fp) > 0 else 0
    recall = tp / (tp + fn) if (tp + fn) > 0 else 0
    f1 = 2 * precision * recall / (precision + recall) if (precision + recall) > 0 else 0
    
    delta = np.mean(match_distances) if match_distances else np.nan
    return f1, delta

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.