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
bc4462e8
Commit
bc4462e8
authored
Sep 16, 2020
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[RoleStage] Small changes in clustering
parent
7f326a3d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
repository.py
...ub/role-stage-discovery-microservice/app/db/repository.py
+3
-0
clusterer.py
...overy-microservice/app/processing/clustering/clusterer.py
+1
-1
run_clustering.py
...b/role-stage-discovery-microservice/app/run_clustering.py
+6
-2
No files found.
src/data-hub/role-stage-discovery-microservice/app/db/repository.py
View file @
bc4462e8
...
...
@@ -79,6 +79,9 @@ class Repository(MongoRepositoryBase):
entries
=
super
()
.
get_entries
(
self
.
_clusters_collection
,
selection
=
{
'layer_name'
:
layer_name
},
projection
=
{
'_id'
:
0
})
return
[
Cluster
(
cluster_dict
=
e
,
from_db
=
True
)
for
e
in
entries
]
def
delete_all_clusters
(
self
):
super
()
.
drop_collection
(
self
.
_clusters_collection
)
#endregion
#region TimeSlice
...
...
src/data-hub/role-stage-discovery-microservice/app/processing/clustering/clusterer.py
View file @
bc4462e8
...
...
@@ -35,7 +35,7 @@ class Clusterer:
'''Extracts the feature values from the dataset into a np array with same order as original dataset.'''
extracted_features
=
[]
for
data
in
dataset
:
entry
=
[
float
(
data
[
feature
])
for
feature
in
features
]
entry
=
[
float
(
data
[
feature
]
if
data
[
feature
]
is
not
""
else
0
)
for
feature
in
features
]
extracted_features
.
append
(
entry
)
return
np
.
asarray
(
extracted_features
)
...
...
src/data-hub/role-stage-discovery-microservice/app/run_clustering.py
View file @
bc4462e8
...
...
@@ -25,8 +25,11 @@ def run_generic_clustering():
print
(
"skipping"
)
continue
try
:
clusters
=
run_clustering_for_layer
(
layer
)
store_generic_clusters
(
clusters
)
except
Exception
as
e
:
print
(
str
(
e
))
def
run_clustering_for_layer
(
layer
:
Layer
)
->
List
[
Cluster
]:
...
...
@@ -46,4 +49,5 @@ def store_generic_clusters(clusters: List[Cluster]):
if
__name__
==
"__main__"
:
repo
.
delete_all_clusters
()
run_generic_clustering
()
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