DBSCAN: density-based clustering
Intermediate classical-mlunsupervisedclusteringdbscan
Implement:
def region_query(input: np.ndarray, point_idx: int, eps: float) -> np.ndarray:
"""Indices of every point within eps of input[point_idx], itself included."""
def dbscan_fit(input: np.ndarray, eps: float, min_samples: int) -> np.ndarray:
"""Returns a cluster id per sample, or -1 for noise."""
- Reuse
01-knn's pairwise_distances.
-1 means "noise," never a real cluster id, real cluster ids start at 0.