Skip to content

DBSCAN

Defined in: ds/src/ml/estimators/DBSCAN.js:17

Extends

  • Estimator

Constructors

Constructor

new DBSCAN(params?): DBSCAN

Defined in: ds/src/ml/estimators/DBSCAN.js:23

Parameters

params?

{ eps, minSamples }

eps

number = 0.5

Maximum distance between two points for neighborhood (default: 0.5)

minSamples

number = 5

Minimum number of points to form a dense region (default: 5)

Returns

DBSCAN

Overrides

Estimator.constructor

Properties

_state

_state: object

Defined in: ds/src/core/estimators/estimator.js:27

Inherited from

Estimator._state


_warnings

_warnings: any[]

Defined in: ds/src/core/estimators/estimator.js:29

Inherited from

Estimator._warnings


coreSampleIndices

coreSampleIndices: any

Defined in: ds/src/ml/estimators/DBSCAN.js:93


eps

eps: number

Defined in: ds/src/ml/estimators/DBSCAN.js:25


fitted

fitted: boolean

Defined in: ds/src/ml/estimators/DBSCAN.js:30

Inherited from

Estimator.fitted


labels

labels: any

Defined in: ds/src/ml/estimators/DBSCAN.js:90


minSamples

minSamples: number

Defined in: ds/src/ml/estimators/DBSCAN.js:26


model

model: any

Defined in: ds/src/ml/estimators/DBSCAN.js:29


nClusters

nClusters: any

Defined in: ds/src/ml/estimators/DBSCAN.js:91


nNoise

nNoise: any

Defined in: ds/src/ml/estimators/DBSCAN.js:92


params

params: any

Defined in: ds/src/core/estimators/estimator.js:24

Inherited from

Estimator.params


X_train

X_train: any

Defined in: ds/src/ml/estimators/DBSCAN.js:31

Accessors

components

Get Signature

get components(): any

Defined in: ds/src/ml/estimators/DBSCAN.js:147

Get components (core samples) - returns array of core sample data points

Returns

any


coreSampleMask

Get Signature

get coreSampleMask(): any[]

Defined in: ds/src/ml/estimators/DBSCAN.js:135

Get core sample mask (boolean array indicating which samples are core points)

Returns

any[]

Methods

_prepareArgsForFit()

_prepareArgsForFit(args?): { columns?: undefined; columnsX: any[]; prepared: boolean; raw?: undefined; rows: any[]; X: any[][]; y: any[]; } | { columns: any[]; columnsX?: undefined; prepared: boolean; raw?: undefined; rows: any[]; X: any[][]; y?: undefined; } | { columns?: undefined; columnsX?: undefined; prepared?: undefined; raw: any[]; rows?: undefined; X?: undefined; y?: undefined; }

Defined in: ds/src/core/estimators/estimator.js:367

Convenience helper: parse arguments passed to fit/predict/transform.

Supports declarative table-style inputs:

  • fit({ X, y, data, omit_missing })
  • fit({ data, columns, … })

Returns an object { X, y, prepared, rows } where X/y are numeric arrays if preparation was required, otherwise returns the original values.

Note: this helper only prepares numeric matrices/vectors using core table utilities; it does not perform encoding of categorical predictors.

Parameters

args?

any[] = []

Returns

{ columns?: undefined; columnsX: any[]; prepared: boolean; raw?: undefined; rows: any[]; X: any[][]; y: any[]; } | { columns: any[]; columnsX?: undefined; prepared: boolean; raw?: undefined; rows: any[]; X: any[][]; y?: undefined; } | { columns?: undefined; columnsX?: undefined; prepared?: undefined; raw: any[]; rows?: undefined; X?: undefined; y?: undefined; }

Inherited from

Estimator._prepareArgsForFit


_repr_html_()

_repr_html_(): string

Defined in: ds/src/core/estimators/estimator.js:201

Observable/Jupyter HTML representation

Returns

string

HTML representation

Inherited from

Estimator._repr_html_


clearWarnings()

clearWarnings(): void

Defined in: ds/src/core/estimators/estimator.js:139

Clear all warnings

Returns

void

Inherited from

Estimator.clearWarnings


fit()

fit(X, opts?): DBSCAN

Defined in: ds/src/ml/estimators/DBSCAN.js:48

Fit the DBSCAN model.

Accepts:

  • numeric input: fit(Xarray, { eps, minSamples })
  • declarative input: fit({ data: tableLike, columns: [‘c1’,‘c2’], eps, … })

Returns this.

Parameters

X

any

Feature matrix (n samples × p features), or a declarative options object ({ data, columns, eps, … }).

opts?

Optional fitting overrides for the positional numeric form.

eps?

number

Maximum distance between two points for them to be neighbors.

minSamples?

number

Minimum number of points to form a dense region.

Returns

DBSCAN

The fitted estimator (for chaining).

Overrides

Estimator.fit


getMemoryUsage()

getMemoryUsage(): string

Defined in: ds/src/core/estimators/estimator.js:97

Get memory usage in human-readable format

Returns

string

Memory usage string (e.g., “2.3 MB” or “145 KB”)

Inherited from

Estimator.getMemoryUsage


getParams()

getParams(): any

Defined in: ds/src/core/estimators/estimator.js:294

Get a shallow copy of parameters.

Returns

any

Inherited from

Estimator.getParams


getState()

getState(): any

Defined in: ds/src/core/estimators/estimator.js:65

Get comprehensive model state

Returns

any

State information including fitted status, memory estimate, warnings

Inherited from

Estimator.getState


getWarnings()

getWarnings(): any[]

Defined in: ds/src/core/estimators/estimator.js:124

Get all warnings

Returns

any[]

Array of warning objects

Inherited from

Estimator.getWarnings


getWarningsByType()

getWarningsByType(type): any[]

Defined in: ds/src/core/estimators/estimator.js:148

Get warnings of a specific type

Parameters

type

string

Warning type

Returns

any[]

Filtered warnings

Inherited from

Estimator.getWarningsByType


hasWarnings()

hasWarnings(): boolean

Defined in: ds/src/core/estimators/estimator.js:132

Check if model has warnings

Returns

boolean

Inherited from

Estimator.hasWarnings


isFitted()

isFitted(): boolean

Defined in: ds/src/core/estimators/estimator.js:36

Check if model is fitted

Returns

boolean

Inherited from

Estimator.isFitted


predict()

predict(X): number[]

Defined in: ds/src/ml/estimators/DBSCAN.js:113

Predict cluster labels for new data.

Note: DBSCAN doesn’t naturally support prediction on new points. This assigns new points to the cluster of their nearest core point if within eps distance, otherwise marks as noise (-1).

Accepts:

  • numeric array: predict([[x1,x2], [x1,x2], …])
  • declarative: predict({ data: tableLike, columns: [‘c1’,‘c2’], omit_missing: true })

Parameters

X

any

Feature matrix to assign, or a declarative options object ({ data, columns, … }).

Returns

number[]

Predicted cluster labels (cluster id >= 0, or -1 for noise) for each sample.

Overrides

Estimator.predict


save()

save(): string

Defined in: ds/src/core/estimators/estimator.js:329

Save model to JSON string

Returns

string

JSON representation of the model

Inherited from

Estimator.save


setParams()

setParams(params?): DBSCAN

Defined in: ds/src/core/estimators/estimator.js:285

Set parameters (mutates instance).

Parameters

params?

any = {}

Returns

DBSCAN

Inherited from

Estimator.setParams


summary()

summary(): object

Defined in: ds/src/ml/estimators/DBSCAN.js:155

Convenience: return summary stats for fitted model

Returns

object

coreRatio

coreRatio: number

eps

eps: number

minSamples

minSamples: number

nClusters

nClusters: any

nCore

nCore: any

nNoise

nNoise: any

noiseRatio

noiseRatio: number

nSamples

nSamples: any


toJSON()

toJSON(): object

Defined in: ds/src/ml/estimators/DBSCAN.js:178

Serialization helper

Returns

object

__class__

__class__: string = 'DBSCAN'

fitted

fitted: boolean

model

model: any

params

params: any

X_train

X_train: any

Overrides

Estimator.toJSON


transform()

transform(): void

Defined in: ds/src/core/estimators/estimator.js:431

Transform should be implemented by transformers.

Returns

void

Inherited from

Estimator.transform


fromJSON()

static fromJSON(obj?): DBSCAN

Defined in: ds/src/ml/estimators/DBSCAN.js:188

Basic deserialization. Subclasses should override if they need to restore learned arrays / matrices.

Parameters

obj?

Returns

DBSCAN

Overrides

Estimator.fromJSON


load()

static load(jsonString): Estimator

Defined in: ds/src/core/estimators/estimator.js:346

Load model from JSON string

Parameters

jsonString

string

JSON representation

Returns

Estimator

Reconstructed estimator instance

Inherited from

Estimator.load