Commit 05701614 authored by Alexander Lercher's avatar Alexander Lercher

Merge branch 'develop' into support/time-measurements

parents b6e044be e7437efb
import json import json
import numpy as np import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from sklearn.cluster import DBSCAN, OPTICS from sklearn.cluster import OPTICS
from typing import List, Dict, Any, TypeVar from typing import List, Dict, Any, TypeVar
from deprecated import deprecated from deprecated import deprecated
...@@ -11,12 +11,12 @@ ClusterGroup = Dict[Any, List[Dict]] ...@@ -11,12 +11,12 @@ ClusterGroup = Dict[Any, List[Dict]]
class Clusterer: class Clusterer:
''' '''
Clusterer for applying density-based clustering on datasets. Clusterer for applying density-based clustering on datasets.
The clustering is done with DBSCAN. The clustering is done with OPTICS.
:param epsilon: Epsilon used in DBSCAN :param epsilon: Eps used in OPTICS
:param min_points: Min_points used in DBSCAN :param min_points: MinPts used in OPTICS
''' '''
def __init__(self, epsilon=11, min_points=2): def __init__(self, epsilon=11, min_points=5):
self.epsilon = epsilon self.epsilon = epsilon
self.min_points = min_points self.min_points = min_points
...@@ -59,7 +59,7 @@ class Clusterer: ...@@ -59,7 +59,7 @@ class Clusterer:
if features is None or len(features) == 0: if features is None or len(features) == 0:
return features # trash in trash out return features # trash in trash out
dbsc = OPTICS() # DBSCAN(eps = self.epsilon, min_samples = self.min_points) dbsc = OPTICS(min_samples=self.min_points) # DBSCAN(eps = self.epsilon, min_samples = self.min_points)
dbsc = dbsc.fit(features) dbsc = dbsc.fit(features)
labels = dbsc.labels_ labels = dbsc.labels_
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment