Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Evaluation künstlicher neuronaler Netze für eine OOS-Erkennung
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dennis Willers
Evaluation künstlicher neuronaler Netze für eine OOS-Erkennung
Commits
27b4eb58
Commit
27b4eb58
authored
Feb 05, 2023
by
Dennis Willers
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Excel File Bug - Save Total Excel Results
parent
5df14c66
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
4 deletions
+137
-4
analyseExcel.py
src/result/analyseExcel.py
+133
-0
createExcelFile.py
src/result/createExcelFile.py
+4
-4
evaluation_oos_erkennung.xlsx
src/result/evaluation_oos_erkennung.xlsx
+0
-0
No files found.
src/result/analyseExcel.py
0 → 100644
View file @
27b4eb58
import
os
import
openpyxl
def
swap_excel_cols
(
folder_path
):
# Iteriere durch alle Excel-Dateien im Ordner
for
filename
in
os
.
listdir
(
folder_path
):
if
filename
.
endswith
(
".xlsx"
):
file_path
=
os
.
path
.
join
(
folder_path
,
filename
)
swap_file_cols
(
file_path
)
def
swap_file_cols
(
file_path
):
# Lade das Workbook
wb
=
openpyxl
.
load_workbook
(
file_path
)
# Wähle das erste Blatt aus
ws
=
wb
.
worksheets
[
0
]
# Definiert die Zeilen, in denen die Spalten getauscht werden sollen
rows
=
[
19
,
42
,
65
,
88
,
111
,
134
,
140
]
# Tausche die Spalten in jeder Zeile
for
row
in
rows
:
col_d
=
ws
.
cell
(
row
=
row
+
1
,
column
=
4
)
.
value
col_e
=
ws
.
cell
(
row
=
row
+
1
,
column
=
5
)
.
value
ws
.
cell
(
row
=
row
+
1
,
column
=
4
)
.
value
=
col_e
ws
.
cell
(
row
=
row
+
1
,
column
=
5
)
.
value
=
col_d
# Speichere das Workbook
wb
.
save
(
file_path
)
def
read_metrics
(
path
):
# Save unique values of opt and act in a dictionary
unique_opt
=
dict
()
unique_act
=
dict
()
final_matrix_loss
=
dict
()
final_matrix_accuracy
=
dict
()
final_matrix_recall_oos
=
dict
()
final_matrix_recall_not_oos
=
dict
()
final_matrix_duration
=
dict
()
for
file
in
os
.
listdir
(
path
):
if
file
.
endswith
(
".xlsx"
):
filename
=
os
.
path
.
join
(
path
,
file
)
wb
=
openpyxl
.
load_workbook
(
filename
)
sheet
=
wb
.
active
# Split file name and get opt, act2, and act_128
opt
,
act2
,
act_128
=
file
.
split
(
"_"
)[
0
],
file
.
split
(
"_"
)[
1
],
file
.
split
(
"_"
)[
2
]
# Combine act2 and act_128
act
=
act2
+
" "
+
act_128
# Get metrics
loss
=
sheet
[
"B141"
]
.
value
accuracy
=
sheet
[
"C141"
]
.
value
recall_oos
=
sheet
[
"D141"
]
.
value
recall_not_oos
=
sheet
[
"E141"
]
.
value
duration
=
sheet
[
"F141"
]
.
value
duration
,
_
=
duration
.
split
(
"."
)
# Add opt and act to the final matrix
if
opt
not
in
unique_opt
:
count_opt
=
len
(
unique_opt
)
+
2
unique_opt
[
opt
]
=
count_opt
if
act
not
in
unique_act
:
count_act
=
len
(
unique_act
)
+
2
unique_act
[
act
]
=
count_act
# Write accuracy to the final matrix
final_matrix_loss
[
opt
+
act
]
=
loss
final_matrix_accuracy
[
opt
+
act
]
=
accuracy
final_matrix_recall_oos
[
opt
+
act
]
=
recall_oos
final_matrix_recall_not_oos
[
opt
+
act
]
=
recall_not_oos
final_matrix_duration
[
opt
+
act
]
=
duration
create_metriken_matrix
(
unique_opt
,
unique_act
,
final_matrix_loss
,
final_matrix_accuracy
,
final_matrix_recall_oos
,
final_matrix_recall_not_oos
,
final_matrix_duration
)
def
create_metriken_matrix
(
unique_opt
,
unique_act
,
final_matrix_loss
,
final_matrix_accuracy
,
final_matrix_recall_oos
,
final_matrix_recall_not_oos
,
final_matrix_duration
):
# Create a new Excel workbook and write the final matrix
wb
=
openpyxl
.
Workbook
()
sheet
=
wb
.
active
sheet
=
write_matrix_in_excel
(
sheet
,
unique_opt
,
unique_act
,
final_matrix_loss
,
0
)
sheet
=
write_matrix_in_excel
(
sheet
,
unique_opt
,
unique_act
,
final_matrix_accuracy
,
6
)
sheet
=
write_matrix_in_excel
(
sheet
,
unique_opt
,
unique_act
,
final_matrix_recall_oos
,
12
)
sheet
=
write_matrix_in_excel
(
sheet
,
unique_opt
,
unique_act
,
final_matrix_recall_not_oos
,
18
)
sheet
=
write_matrix_in_excel
(
sheet
,
unique_opt
,
unique_act
,
final_matrix_duration
,
24
)
wb
.
save
(
"evaluation_oos_erkennung.xlsx"
)
def
write_matrix_in_excel
(
sheet
,
unique_opt
,
unique_act
,
final_matrix
,
c
):
sheet
.
cell
(
row
=
1
,
column
=
c
+
1
,
value
=
"2"
)
sheet
.
cell
(
row
=
1
,
column
=
c
+
2
,
value
=
"128"
)
# Write opt names
count_opt
=
3
for
opt_key
in
sorted
(
unique_opt
.
keys
()):
sheet
.
cell
(
row
=
1
,
column
=
c
+
count_opt
,
value
=
opt_key
)
count_opt
+=
1
# Write act names
count_act
=
2
for
act_key
in
sorted
(
unique_act
.
keys
()):
act_2
,
act128
=
act_key
.
split
(
" "
)
sheet
.
cell
(
row
=
count_act
,
column
=
c
+
1
,
value
=
act_2
)
sheet
.
cell
(
row
=
count_act
,
column
=
c
+
2
,
value
=
act128
)
count_act
+=
1
count_opt
=
3
# Write accuracy values
for
opt_key
in
sorted
(
unique_opt
.
keys
()):
count_act
=
2
for
act_key
in
sorted
(
unique_act
.
keys
()):
if
opt_key
+
act_key
in
final_matrix
:
sheet
.
cell
(
row
=
count_act
,
column
=
c
+
count_opt
,
value
=
final_matrix
[
opt_key
+
act_key
])
count_act
+=
1
count_opt
+=
1
return
sheet
# Call the function with the folder path
# swap_excel_cols("/Users/dwillers/Programmierung/Master/Okan-Server/Results Kopie/5050")
# swap_file_cols("/Users/dwillers/Programmierung/Master/Okan-Server/Results Kopie/5050/Ftrl_softmax_softmax_03_02_23__03_19.xlsx")
# read_metrics("/Users/dwillers/Programmierung/Master/Okan-Server/Results Kopie/5050")
src/result/createExcelFile.py
View file @
27b4eb58
...
@@ -73,8 +73,8 @@ def create_excel_result(worksheet, r, callback, config, config_knn, evaluate_met
...
@@ -73,8 +73,8 @@ def create_excel_result(worksheet, r, callback, config, config_knn, evaluate_met
worksheet
.
cell
(
row
=
r
,
column
=
1
)
.
value
=
config_knn
.
excluded_folder
.
name
worksheet
.
cell
(
row
=
r
,
column
=
1
)
.
value
=
config_knn
.
excluded_folder
.
name
worksheet
.
cell
(
row
=
r
,
column
=
2
)
.
value
=
evaluate_metrics
[
0
]
worksheet
.
cell
(
row
=
r
,
column
=
2
)
.
value
=
evaluate_metrics
[
0
]
worksheet
.
cell
(
row
=
r
,
column
=
3
)
.
value
=
evaluate_metrics
[
1
]
worksheet
.
cell
(
row
=
r
,
column
=
3
)
.
value
=
evaluate_metrics
[
1
]
worksheet
.
cell
(
row
=
r
,
column
=
4
)
.
value
=
evaluate_metrics
[
2
]
worksheet
.
cell
(
row
=
r
,
column
=
4
)
.
value
=
evaluate_metrics
[
3
]
worksheet
.
cell
(
row
=
r
,
column
=
5
)
.
value
=
evaluate_metrics
[
3
]
worksheet
.
cell
(
row
=
r
,
column
=
5
)
.
value
=
evaluate_metrics
[
2
]
r
=
r
+
4
r
=
r
+
4
return
worksheet
,
r
return
worksheet
,
r
...
@@ -98,8 +98,8 @@ def average_evaluate_cross_validation(worksheet, r, model_evaluate_metrics, trai
...
@@ -98,8 +98,8 @@ def average_evaluate_cross_validation(worksheet, r, model_evaluate_metrics, trai
worksheet
.
cell
(
row
=
r
,
column
=
1
)
.
value
=
len
(
training_duration_models
)
worksheet
.
cell
(
row
=
r
,
column
=
1
)
.
value
=
len
(
training_duration_models
)
worksheet
.
cell
(
row
=
r
,
column
=
2
)
.
value
=
total_information
[
0
]
worksheet
.
cell
(
row
=
r
,
column
=
2
)
.
value
=
total_information
[
0
]
worksheet
.
cell
(
row
=
r
,
column
=
3
)
.
value
=
total_information
[
1
]
worksheet
.
cell
(
row
=
r
,
column
=
3
)
.
value
=
total_information
[
1
]
worksheet
.
cell
(
row
=
r
,
column
=
4
)
.
value
=
total_information
[
2
]
worksheet
.
cell
(
row
=
r
,
column
=
4
)
.
value
=
total_information
[
3
]
worksheet
.
cell
(
row
=
r
,
column
=
5
)
.
value
=
total_information
[
3
]
worksheet
.
cell
(
row
=
r
,
column
=
5
)
.
value
=
total_information
[
2
]
# Durchschnittswert wieder in Datetime-Objekt umwandeln
# Durchschnittswert wieder in Datetime-Objekt umwandeln
average_datetime
=
format
(
total_information
[
4
])
average_datetime
=
format
(
total_information
[
4
])
worksheet
.
cell
(
row
=
r
,
column
=
6
)
.
value
=
average_datetime
worksheet
.
cell
(
row
=
r
,
column
=
6
)
.
value
=
average_datetime
...
...
src/result/evaluation_oos_erkennung.xlsx
0 → 100644
View file @
27b4eb58
File added
Write
Preview
Markdown
is supported
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