Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
05701614
Commit
05701614
authored
Jun 02, 2020
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into support/time-measurements
parents
b6e044be
e7437efb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
clusterer.py
...ction-microservice/app/processing/clustering/clusterer.py
+6
-6
No files found.
src/data-hub/community-detection-microservice/app/processing/clustering/clusterer.py
View file @
05701614
import
json
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
sklearn.cluster
import
DBSCAN
,
OPTICS
from
sklearn.cluster
import
OPTICS
from
typing
import
List
,
Dict
,
Any
,
TypeVar
from
deprecated
import
deprecated
...
...
@@ -11,12 +11,12 @@ ClusterGroup = Dict[Any, List[Dict]]
class
Clusterer
:
'''
Clusterer for applying density-based clustering on datasets.
The clustering is done with
DBSCAN
.
The clustering is done with
OPTICS
.
:param epsilon: Eps
ilon used in DBSCAN
:param min_points: Min
_points used in DBSCAN
:param epsilon: Eps
used in OPTICS
:param min_points: Min
Pts used in OPTICS
'''
def
__init__
(
self
,
epsilon
=
11
,
min_points
=
2
):
def
__init__
(
self
,
epsilon
=
11
,
min_points
=
5
):
self
.
epsilon
=
epsilon
self
.
min_points
=
min_points
...
...
@@ -59,7 +59,7 @@ class Clusterer:
if
features
is
None
or
len
(
features
)
==
0
:
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
)
labels
=
dbsc
.
labels_
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment