'Perform DBSCAN clustering from features or distance matrix.
Parameters
X : array or sparse (CSR) matrix of shape (n_samples, n_features), or                 array of shape (n_samples, n_samples)
A feature array, or array of distances between samples if
``metric=\'precomputed\'``.
sample_weight : array, shape (n_samples,), optional
Weight of each sample, such that a sample with a weight of at least
``min_samples`` is by itself a core sample; a sample with negative
weight may inhibit its eps-neighbor from being core.
Note that weights are absolute, and default to 1.'

def fit(self, X, y=None, sample_weight=None):

    X = check_array(X, accept_sparse='csr')
    clust = dbscan(X, sample_weight=sample_weight, **self.get_params())
    (self.core_sample_indices_, self.labels_) = clust
    if len(self.core_sample_indices_):
        self.components_ = X[self.core_sample_indices_].copy()
    else:
        self.components_ = np.empty((0, X.shape[1]))
    return self
