Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bolsonaro
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
Container registry
Model registry
Operate
Environments
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
Luc Giffon
bolsonaro
Commits
bbad0e52
Commit
bbad0e52
authored
5 years ago
by
Luc Giffon
Browse files
Options
Downloads
Patches
Plain Diff
results_to_csv script
parent
eb638666
No related branches found
No related tags found
1 merge request
!23
Resolve "integration-sota"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
code/vizualisation/results_to_csv.py
+102
-0
102 additions, 0 deletions
code/vizualisation/results_to_csv.py
with
102 additions
and
0 deletions
code/vizualisation/results_to_csv.py
0 → 100644
+
102
−
0
View file @
bbad0e52
from
pathlib
import
Path
import
os
import
pandas
as
pd
from
pprint
import
pprint
import
pickle
from
collections
import
defaultdict
from
dotenv
import
load_dotenv
,
find_dotenv
dct_experiment_id_subset
=
dict
((
str
(
idx
),
"
train+dev/train+dev
"
)
for
idx
in
range
(
1
,
9
))
dct_experiment_id_subset
.
update
(
dict
((
str
(
idx
),
"
train/dev
"
)
for
idx
in
range
(
9
,
17
)))
dct_experiment_id_technique
=
{
"
1
"
:
'
None
'
,
"
2
"
:
'
Random
'
,
"
3
"
:
'
OMP
'
,
"
4
"
:
'
OMP Distillation
'
,
"
5
"
:
'
Kmeans
'
,
"
6
"
:
'
Zhang Similarities
'
,
"
7
"
:
'
Zhang Predictions
'
,
"
8
"
:
'
Ensemble
'
,
"
9
"
:
'
None
'
,
"
10
"
:
'
Random
'
,
"
11
"
:
'
OMP
'
,
"
12
"
:
'
OMP Distillation
'
,
"
13
"
:
'
Kmeans
'
,
"
14
"
:
'
Zhang Similarities
'
,
"
15
"
:
'
Zhang Predictions
'
,
"
16
"
:
'
Ensemble
'
}
dct_dataset_fancy
=
{
"
boston
"
:
"
Boston
"
,
"
breast_cancer
"
:
"
Breast Cancer
"
,
"
california_housing
"
:
"
California Housing
"
,
"
diabetes
"
:
"
Diabetes
"
,
"
diamonds
"
:
"
Diamonds
"
,
"
digits
"
:
"
Digits
"
,
"
iris
"
:
"
Iris
"
,
"
kin8nm
"
:
"
Kin8nm
"
,
"
kr-vs-kp
"
:
"
KR-VS-KP
"
,
"
olivetti_faces
"
:
"
Olivetti Faces
"
,
"
spambase
"
:
"
Spambase
"
,
"
steel-plates
"
:
"
Steel Plates
"
,
"
wine
"
:
"
Wine
"
,
"
gamma
"
:
"
Gamma
"
,
"
lfw_pairs
"
:
"
LFW Pairs
"
}
skip_attributes
=
[
"
datetime
"
,
"
model_weights
"
]
if
__name__
==
"
__main__
"
:
load_dotenv
(
find_dotenv
(
'
.env
'
))
dir_name
=
"
results/bolsonaro_models_25-03-20
"
dir_path
=
Path
(
os
.
environ
[
"
project_dir
"
])
/
dir_name
output_dir_file
=
dir_path
/
"
results.csv
"
dct_results
=
defaultdict
(
lambda
:
[])
for
root
,
dirs
,
files
in
os
.
walk
(
dir_path
,
topdown
=
False
):
for
file_str
in
files
:
path_dir
=
Path
(
root
)
path_file
=
path_dir
/
file_str
obj_results
=
pickle
.
load
(
open
(
path_file
,
'
rb
'
))
path_dir_split
=
str
(
path_dir
).
split
(
"
/
"
)
bool_wo_weights
=
"
no_weights
"
in
str
(
path_file
)
if
bool_wo_weights
:
forest_size
=
int
(
path_dir_split
[
-
1
].
split
(
"
_
"
)[
0
])
else
:
forest_size
=
int
(
path_dir_split
[
-
1
])
seed
=
int
(
path_dir_split
[
-
3
])
id_xp
=
str
(
path_dir_split
[
-
5
])
dataset
=
str
(
path_dir_split
[
-
6
])
dct_results
[
"
forest_size
"
].
append
(
forest_size
)
dct_results
[
"
seed
"
].
append
(
seed
)
dct_results
[
"
dataset
"
].
append
(
dct_dataset_fancy
[
dataset
])
dct_results
[
"
subset
"
].
append
(
dct_experiment_id_subset
[
id_xp
])
dct_results
[
"
strategy
"
].
append
(
dct_experiment_id_technique
[
id_xp
])
dct_results
[
"
wo_weights
"
].
append
(
bool_wo_weights
)
for
key_result
,
val_result
in
obj_results
.
items
():
if
key_result
in
skip_attributes
:
continue
if
val_result
==
""
:
val_result
=
None
dct_results
[
key_result
].
append
(
val_result
)
print
(
path_file
)
final_df
=
pd
.
DataFrame
.
from_dict
(
dct_results
)
final_df
.
to_csv
(
output_dir_file
)
print
(
final_df
)
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