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
efbdaf86
Commit
efbdaf86
authored
May 24, 2022
by
Lennart Holzenkamp
Browse files
fixing file output and removing prints
parent
53d4e8a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
code/functions.py
View file @
efbdaf86
...
...
@@ -342,7 +342,6 @@ def distance_matrix(df, weights):
single_column_df
=
df
[
columns
[
i
]]
matrix
=
matrix
+
calc_distance
(
single_column_df
,
i
,
n
,
weights
)
print
(
'weight-sum:'
+
str
(
sum
(
weights
)))
return
matrix
/
sum
(
weights
)
...
...
@@ -361,13 +360,12 @@ def calc_distance(df, weight_index, n, weights):
distance_func
=
lev
for
j
in
range
(
n
):
first_elem
=
npm
[
j
]
for
k
in
range
(
j
+
1
,
n
):
matrix
[
j
,
k
]
=
distance_func
(
first_elem
,
npm
[
k
])
first_elem
=
npm
[
j
]
for
k
in
range
(
j
+
1
,
n
):
matrix
[
j
,
k
]
=
distance_func
(
first_elem
,
npm
[
k
])
matrix
=
matrix
+
matrix
.
T
matrix
=
matrix
/
matrix
.
max
()
print
(
'current weight: '
+
str
(
weights
[
weight_index
]))
return
matrix
*
weights
[
weight_index
]
...
...
code/main.py
View file @
efbdaf86
...
...
@@ -14,7 +14,7 @@ from sklearn import cluster as skcluster
# PARAMETERS
p_ocel_file
=
'./data/ocel.jsonocel'
p_mode
=
'existence'
# all | existence
p_object_type
=
'
product
s'
# object-type-name, options depend on the data
p_object_type
=
'
item
s'
# object-type-name, options depend on the data
p_attr_weights
=
{
'producer'
:
2
}
# attributes that are not given in the data are not used
...
...
@@ -186,7 +186,7 @@ if not os.path.exists(directory):
appendix_len = len(str(cluster_count))
for ii in range(0, len(res)):
filename = directory + '
/
cluster_
' + str(ii+1).rjust(appendix_len) + '
.
' + p_ocel_file_type + '
ocel
'
pm4py.write_ocel(
ocel
, filename)
pm4py.write_ocel(
res[ii]
, filename)
print(str(ii+1).rjust(appendix_len) + '
/
' + str(cluster_count) + '"' + filename + '"
stored
.
')
duration = datetime.datetime.now() - start_ts
...
...
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