Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.
mattt edited this page Feb 7, 2020 · 1 revision

DBSCAN

A density-based, non-parametric clustering algorithm (DBSCAN).

public struct DBSCAN<Value: Equatable>

Given a set of points in some space, this algorithm groups points with many nearby neighbors and marks points in low-density regions as outliers.

  • Authors: Ester, Martin; Kriegel, Hans-Peter; Sander, Jörg; Xu, Xiaowei (1996) "A density-based algorithm for discovering clusters in large spatial databases with noise." Proceedings of the Second International Conference on Knowledge Discovery and Data Mining (KDD-96).

Nested Types

Initializers

init(_:)

Creates a new clustering algorithm with the specified values.

public init(_ values: [Value])
  • Parameter values: The values to be clustered.

Properties

values

The values to be clustered.

var values: [Value]

Methods

callAsFunction(epsilon:minimumNumberOfPoints:distanceFunction:)

Clusters values according to the specified parameters.

public func callAsFunction(epsilon: Double, minimumNumberOfPoints: Int, distanceFunction: (Value, Value) throws -> Double) rethrows -> (clusters: [[Value]], outliers: [Value])

Parameters

  • epsilon: The maximum distance from a specified value for which other values are considered to be neighbors.
  • minimumNumberOfPoints: The minimum number of points required to form a dense region.
  • distanceFunction: A function that computes the distance between two values.

Throws

Rethrows any errors produced by distanceFunction.

Returns

A tuple containing an array of clustered values and an array of outlier values.