Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PARADISE
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
SIG
Theses
Pierre Lotte
PARADISE
Commits
6a56aea4
Commit
6a56aea4
authored
10 months ago
by
Pierre LOTTE
Browse files
Options
Downloads
Patches
Plain Diff
Add timer
parent
21f6db2e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
main.py
+3
-0
3 additions, 0 deletions
main.py
split/base.py
+23
-14
23 additions, 14 deletions
split/base.py
trainers/base.py
+6
-0
6 additions, 0 deletions
trainers/base.py
with
32 additions
and
14 deletions
main.py
+
3
−
0
View file @
6a56aea4
...
@@ -148,6 +148,9 @@ if __name__ == "__main__":
...
@@ -148,6 +148,9 @@ if __name__ == "__main__":
with
open
(
"
algorithm_params.json
"
,
"
r
"
,
encoding
=
"
utf-8
"
)
as
f
:
with
open
(
"
algorithm_params.json
"
,
"
r
"
,
encoding
=
"
utf-8
"
)
as
f
:
algo_params
=
json
.
load
(
f
)
algo_params
=
json
.
load
(
f
)
with
open
(
f
"
{
INPUT_DIR
}
/
{
config_name
}
/time.csv
"
,
"
a
"
,
encoding
=
"
utf-8
"
)
as
f
:
f
.
write
(
"
Algorithm,dataset,duration
"
)
for
algo
in
args
.
algorithms
:
for
algo
in
args
.
algorithms
:
params
=
algo_params
[
algo
]
params
=
algo_params
[
algo
]
train
=
params
.
pop
(
"
training
"
)
train
=
params
.
pop
(
"
training
"
)
...
...
This diff is collapsed.
Click to expand it.
split/base.py
+
23
−
14
View file @
6a56aea4
...
@@ -9,6 +9,8 @@ import numpy as np
...
@@ -9,6 +9,8 @@ import numpy as np
import
pandas
as
pd
import
pandas
as
pd
import
seaborn
as
sns
import
seaborn
as
sns
from
time
import
time
from
sklearn.cluster
import
KMeans
,
HDBSCAN
from
sklearn.cluster
import
KMeans
,
HDBSCAN
from
sklearn.exceptions
import
ConvergenceWarning
from
sklearn.exceptions
import
ConvergenceWarning
from
sklearn.metrics
import
silhouette_score
from
sklearn.metrics
import
silhouette_score
...
@@ -79,19 +81,26 @@ class BaseSplitter:
...
@@ -79,19 +81,26 @@ class BaseSplitter:
"""
"""
Compute the vector of correlation coefficients for each of the variable of the dataset.
Compute the vector of correlation coefficients for each of the variable of the dataset.
"""
"""
x
=
None
with
open
(
f
"
{
self
.
data_path
}
/split_time.csv
"
,
"
a
"
,
encoding
=
"
utf-8
"
)
as
f
:
for
coeff
in
CORRELATION_CLASSES
:
f
.
write
(
"
Algorithm,duration
"
)
coeff_name
=
coeff
.
__name__
[:
-
11
]
x
=
None
correlation_matrix
=
coeff
().
compute
(
data
)
for
coeff
in
CORRELATION_CLASSES
:
correlation_matrix
.
to_csv
(
f
"
{
self
.
data_path
}
/dataset_correlation_
{
coeff_name
}
.csv
"
)
coeff_name
=
coeff
.
__name__
[:
-
11
]
sns
.
heatmap
(
correlation_matrix
,
annot
=
True
,
cmap
=
"
coolwarm
"
)
\
.
get_figure
()
\
start_time
=
time
()
.
savefig
(
f
"
{
self
.
data_path
}
/dataset_correlation_matrix_
{
coeff_name
}
.png
"
)
correlation_matrix
=
coeff
().
compute
(
data
)
plt
.
clf
()
duration
=
time
()
-
start_time
f
.
write
(
f
"
{
coeff_name
}
,
{
duration
}
"
)
if
x
is
not
None
:
x
=
np
.
concatenate
([
np
.
abs
(
correlation_matrix
),
x
],
axis
=
1
)
correlation_matrix
.
to_csv
(
f
"
{
self
.
data_path
}
/dataset_correlation_
{
coeff_name
}
.csv
"
)
else
:
sns
.
heatmap
(
correlation_matrix
,
annot
=
True
,
cmap
=
"
coolwarm
"
)
\
x
=
np
.
abs
(
correlation_matrix
)
.
get_figure
()
\
.
savefig
(
f
"
{
self
.
data_path
}
/dataset_correlation_matrix_
{
coeff_name
}
.png
"
)
plt
.
clf
()
if
x
is
not
None
:
x
=
np
.
concatenate
([
np
.
abs
(
correlation_matrix
),
x
],
axis
=
1
)
else
:
x
=
np
.
abs
(
correlation_matrix
)
return
x
return
x
This diff is collapsed.
Click to expand it.
trainers/base.py
+
6
−
0
View file @
6a56aea4
...
@@ -7,6 +7,7 @@ import pandas as pd
...
@@ -7,6 +7,7 @@ import pandas as pd
import
seaborn
as
sns
import
seaborn
as
sns
import
subprocess
import
subprocess
from
time
import
time
from
.correlations
import
CORRELATION_CLASSES
from
.correlations
import
CORRELATION_CLASSES
...
@@ -58,6 +59,11 @@ class BaseTrainer():
...
@@ -58,6 +59,11 @@ class BaseTrainer():
os
.
makedirs
(
f
"
{
path
}
/results_
{
self
.
algorithm
}
"
,
exist_ok
=
True
)
os
.
makedirs
(
f
"
{
path
}
/results_
{
self
.
algorithm
}
"
,
exist_ok
=
True
)
start_time
=
time
()
os
.
system
(
os
.
system
(
f
"
python3
{
pwd
}
/algorithms/
{
self
.
algorithm
}
/algorithm.py
'
{
json
.
dumps
(
args
)
}
'
1>/dev/null 2>/dev/null
"
f
"
python3
{
pwd
}
/algorithms/
{
self
.
algorithm
}
/algorithm.py
'
{
json
.
dumps
(
args
)
}
'
1>/dev/null 2>/dev/null
"
)
)
duration
=
time
()
-
start_time
with
open
(
f
"
{
path
}
/time.csv
"
,
"
a
"
,
encoding
=
"
utf-8
"
)
as
f
:
f
.
write
(
f
"
{
self
.
algorithm
}
,
{
file_name
}
,
{
duration
}
"
)
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