DBSCAN needs one radius eps, so clusters of different densities cannot all be found at once. OPTICS builds an ordering of the points in which nearby dense points come next to each other, and records a reachability distance for each point. Valleys in the reachability plot are clusters, and different cuts through the plot recover clusters at different densities.
Implement optics(X, min_samples, max_eps=inf). Return (ordering, reachability).
min_samples-th nearest point, counting the point itself. If it is larger than max_eps, the core distance is infinite.max_eps, set reachability(o) = min(current, max(core(p), d(p, o))).Points that were never reached keep reachability inf.
1 ≤ min_samples ≤ n, otherwise raise ValueError.X.Sort each row of the distance matrix once. The core distance is the entry at index min_samples − 1.
Use a boolean mask of unprocessed points and np.argmin on the reachability values of the seeds.
No results yet
Run your code to check it against the examples, or submit to run every test.