Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Batmen Tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sepia-pub
mael
Batmen Tools
Commits
fdf447cb
Commit
fdf447cb
authored
2 years ago
by
Maël Madon
Browse files
Options
Downloads
Patches
Plain Diff
adding an notebook for example distances
parent
5e6bb738
No related branches found
No related tags found
No related merge requests found
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
distance_batsim_output.py
+5
-5
5 additions, 5 deletions
distance_batsim_output.py
test/input/3jobs.csv
+3
-3
3 additions, 3 deletions
test/input/3jobs.csv
test/input/3jobs_w_sessions.csv
+3
-3
3 additions, 3 deletions
test/input/3jobs_w_sessions.csv
test_distance.ipynb
+418
-0
418 additions, 0 deletions
test_distance.ipynb
with
429 additions
and
11 deletions
distance_batsim_output.py
+
5
−
5
View file @
fdf447cb
...
...
@@ -57,13 +57,13 @@ def euclidean_distance(s1, s2):
"""
Returns the Euclidean distance between two series s1 and s2
"""
dist
=
np
.
sqrt
(
np
.
sum
([(
x
-
y
)
*
(
x
-
y
)
for
x
,
y
in
zip
(
s1
,
s2
)]))
return
dist
return
float
(
dist
)
def
lateness_distance
(
s1
,
s2
):
"""
Returns the
'
lateness
'
of s2 compared to s1
"""
return
np
.
sum
([
y
-
x
for
x
,
y
in
zip
(
s1
,
s2
)])
return
float
(
np
.
sum
([
y
-
x
for
x
,
y
in
zip
(
s1
,
s2
)])
)
def
normalized_euclidian_distance
(
s1
,
s2
):
"""
Return the euclidien distance normalized by the l2 norm of the vectors,
...
...
@@ -73,12 +73,12 @@ def normalized_euclidian_distance(s1, s2):
if
n1
==
0
or
n2
==
0
:
return
None
eucl_dist
=
euclidean_distance
(
s1
,
s2
)
return
eucl_dist
**
2
/
(
n1
*
n2
)
return
float
(
eucl_dist
**
2
/
(
n1
*
n2
)
)
def
l2_norm
(
s
):
"""
Return the l2 norm of the series s
"""
return
np
.
sqrt
(
np
.
sum
([
x
*
x
for
x
in
s
]))
return
float
(
np
.
sqrt
(
np
.
sum
([
x
*
x
for
x
in
s
]))
)
def
distances
(
file1
,
file2
,
euclidean
=
True
,
lateness
=
False
,
norm_eucl
=
False
,
...
...
@@ -111,7 +111,7 @@ def distances(file1, file2, euclidean=True, lateness=False, norm_eucl=False,
def
pretty_print
(
dist
):
"""
Nice printing of the dictionnary dist
"""
if
typ
e
(
dist
)
is
dict
:
if
isinstanc
e
(
dist
,
dict
)
:
pretty
=
json
.
dumps
(
dist
,
indent
=
4
)
print
(
pretty
)
else
:
...
...
This diff is collapsed.
Click to expand it.
test/input/3jobs.csv
+
3
−
3
View file @
fdf447cb
job_id,workload_name,profile,submission_time,requested_number_of_resources,requested_time,success,final_state,starting_time,execution_time,finish_time,waiting_time,turnaround_time,stretch,allocated_resources,consumed_energy,metadata
1216,user11,362,30,1,86400.000000,1,COMPLETED_SUCCESSFULLY,30,362.000000,80,0.000000,362.000000,1.000000,2,62671.250000,
247,user5,57102,0,8,432000.000000,1,COMPLETED_SUCCESSFULLY,0,57102.000000,0,0.000000,57102.000000,1.000000,0,12391134.000000,
1242,user11,9620,40,1,86400.000000,1,COMPLETED_SUCCESSFULLY,40,9620.000000,60,0.000000,9620.000000,1.000000,2,1665462.500000,
\ No newline at end of file
1216,user11,362,30,1,86400.000000,1,COMPLETED_SUCCESSFULLY,30,50,80,0.000000,362.000000,1.000000,2,62671.250000,
247,user5,57102,0,8,432000.000000,1,COMPLETED_SUCCESSFULLY,0,0,0,0.000000,57102.000000,1.000000,0,12391134.000000,
1242,user11,9620,40,1,86400.000000,1,COMPLETED_SUCCESSFULLY,40,20,60,0.000000,9620.000000,1.000000,1,1665462.500000,
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/input/3jobs_w_sessions.csv
+
3
−
3
View file @
fdf447cb
job_id,workload_name,profile,submission_time,requested_number_of_resources,requested_time,success,final_state,starting_time,execution_time,finish_time,waiting_time,turnaround_time,stretch,allocated_resources,consumed_energy,metadata
1216:s1,user11,362,30,1,86400.000000,1,COMPLETED_SUCCESSFULLY,30,362.000000,60,0.000000,362.000000,1.000000,2,62671.250000,
247:s1,user5,57102,0,8,432000.000000,1,COMPLETED_SUCCESSFULLY,0,57102.000000,0,0.000000,57102.000000,1.000000,0,12391134.000000,
1242:s1,user11,9620,40,1,86400.000000,1,COMPLETED_SUCCESSFULLY,40,9620.000000,80,0.000000,9620.000000,1.000000,2,1665462.500000,
\ No newline at end of file
1216:s1,user11,362,30,1,86400.000000,1,COMPLETED_SUCCESSFULLY,30,30,60,0.000000,362.000000,1.000000,2,62671.250000,
247:s1,user5,57102,0,8,432000.000000,1,COMPLETED_SUCCESSFULLY,0,0,0,0.000000,57102.000000,1.000000,0,12391134.000000,
1242:s1,user11,9620,40,1,86400.000000,1,COMPLETED_SUCCESSFULLY,40,40,80,0.000000,9620.000000,1.000000,1,1665462.500000,
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test_distance.ipynb
0 → 100644
+
418
−
0
View file @
fdf447cb
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment