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
e7437efb
Commit
e7437efb
authored
Jun 02, 2020
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor cleanup Role Detection Clusterer
parent
cb80a8d9
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 @
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: Eps
ilon used in DBSCAN
:param epsilon: Eps
used in OPTICS
:param min_points: Min
_points used in DBSCAN
: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
.
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_
...
...
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