agentsclimarketplace

Run2 dbscan custom metric

Skill cxcscmu/SkillLearnBench/skills/b2-self-feedback-claude-opus-4-6/dbscan-parameter-tuning/run2_dbscan-custom-metric

DBSCAN with custom weighted Euclidean distance metric for spatial clustering of annotations.From its SKILL.md

Install
npx -y skills add cxcscmu/SkillLearnBench --skill run2_dbscan-custom-metric

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

SKILL.md

0.9 KB, 233 tokens by cl100k_base, as published. Nobody here has run it

DBSCAN with Custom Distance Metrics

Custom Metric Definition

For shape_weight w: d(a, b) = sqrt((w * Δx)² + ((2-w) * Δy)²)

from sklearn.cluster import DBSCAN
import numpy as np

def custom_metric(a, b, w):
    dx = a[0] - b[0]
    dy = a[1] - b[1]
    return np.sqrt((w * dx)**2 + ((2 - w) * dy)**2)

db = DBSCAN(eps=epsilon, min_samples=min_samples,
            metric=custom_metric, metric_params={'w': shape_weight})
labels = db.fit_predict(points_xy)

Key Details

  • metric accepts callable with signature f(a, b, **metric_params)
  • Labels: -1 = noise, >=0 = cluster ID
  • Centroids: mean of (x, y) for each cluster (excluding noise points with label -1)
  • For evaluation, use standard Euclidean distance (not custom) for matching centroids to expert points

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.