Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Stanislav Yuliyanov
oc-dfg-clustering
Commits
45926e5a
Commit
45926e5a
authored
May 24, 2022
by
Stanislav
Browse files
p_max_cluster_count wieder eingeführt
parent
8e367827
Changes
1
Hide whitespace changes
Inline
Side-by-side
code/main.py
View file @
45926e5a
...
...
@@ -22,7 +22,7 @@ p_attr_weights = {
}
# attributes that are not given in the data are not used
p_clusteval_mode
=
'silhouette'
p_clustering_mode
=
'kmeans'
# optional, default: kmeans
#
p_max_cluster_count =
25
# np.NaN # cluster-count (optional, default: np.NaN which leads to automatic k determination)
p_max_cluster_count
=
np
.
NaN
# np.NaN # cluster-count (optional, default: np.NaN which leads to automatic k determination)
p_ocel_file_type
=
'json'
# json|xml
p_graph_file_type
=
'svg'
# svg|png
# END PARAMETERS
...
...
@@ -38,7 +38,7 @@ print('p_attr_weights:')
print
(
p_attr_weights
)
print
(
'p_clusteval_mode: "'
+
str
(
p_clusteval_mode
)
+
'".'
)
print
(
'p_clustering_mode: "'
+
str
(
p_clustering_mode
)
+
'".'
)
#
print('p_max_cluster_count: "' + str(p_max_cluster_count) + '".')
print
(
'p_max_cluster_count: "'
+
str
(
p_max_cluster_count
)
+
'".'
)
print
(
'p_ocel_file_type: "'
+
str
(
p_ocel_file_type
)
+
'".'
)
print
(
'p_graph_file_type: "'
+
str
(
p_graph_file_type
)
+
'".'
)
print
(
'-------------------------------------------------------'
)
...
...
@@ -82,16 +82,20 @@ index_to_oid_map = res['index']
algo = algorithms[p_clustering_mode]
#
try:
#
max_cluster_count = int(p_max_cluster_count)
#
except:
#
max_cluster_count =
25
try:
max_cluster_count = int(p_max_cluster_count)
except:
max_cluster_count =
0
# assert max_cluster_count >= 2, '
cluster_count
needs
to
be
at
least
2
'
# assert max_cluster_count < len(index_to_oid_map), '
cluster_count
needs
to
be
less
than
the
count
of
distinct
objects
in
the
ocel
-
data
.
'
# max_cluster darf jetzt auch 0 sein, dann wird by default der Algorithmus entscheiden, wieviele cluster nötig zu berechnen sind.
assert max_cluster_count < len(index_to_oid_map), '
cluster_count
needs
to
be
less
than
the
count
of
distinct
objects
in
the
ocel
-
data
.
'
# cluster_count = cluster.determine_optimal_k(distance_matrix, algorithm=algo, k_max=max_cluster_count)
results = clusteval(evaluate = p_clusteval_mode).fit(distance_matrix)
if (max_cluster_count == 0):
results = clusteval(evaluate = p_clusteval_mode).fit(distance_matrix)
else:
results = clusteval(evaluate = p_clusteval_mode, max_clust=max_cluster_count).fit(distance_matrix)
cluster_count = results['
score
']['
clusters
'].iloc[np.where(results['
score
']['
score
'] == results['
score
']['
score
'].max())[0][0]]
algo.set_params(n_clusters=cluster_count)
...
...
Write
Preview
Supports
Markdown
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