Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Troubled Cell Detection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Laura Christine Kühle
Troubled Cell Detection
Commits
a34d6f4f
Commit
a34d6f4f
authored
Feb 15, 2022
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Added saving of model evaluation data.
parent
dc854096
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ANN_Training.py
+10
-1
10 additions, 1 deletion
ANN_Training.py
with
10 additions
and
1 deletion
ANN_Training.py
+
10
−
1
View file @
a34d6f4f
...
@@ -6,11 +6,14 @@ Code-Style: E226, W503
...
@@ -6,11 +6,14 @@ Code-Style: E226, W503
Docstring-Style: D200, D400
Docstring-Style: D200, D400
TODO: Test new ANN set-up with Soraya
TODO: Test new ANN set-up with Soraya
TODO: Remove object set-up (for more flexibility) -> Done (decided against it to keep easy test set-up)
TODO: Remove object set-up (for more flexibility) -> Done
(decided against it to keep easy test set-up)
TODO: Add documentation
TODO: Add documentation
TODO: Allow multiple approximations in one config -> Done
TODO: Allow multiple approximations in one config -> Done
TODO: Split workflow into multiple modules -> Done
TODO: Split workflow into multiple modules -> Done
TODO: Remove unnecessary instance variables -> Done
TODO: Remove unnecessary instance variables -> Done
TODO: Add option to change
'
num_iterations
'
for model testing -> Done
TODO: Save model evaluation data -> Done
TODO: Add README for ANN training
TODO: Add README for ANN training
TODO: Fix random seed
TODO: Fix random seed
TODO: Discuss whether to outsource scripts into separate directory
TODO: Discuss whether to outsource scripts into separate directory
...
@@ -24,6 +27,7 @@ import matplotlib
...
@@ -24,6 +27,7 @@ import matplotlib
from
matplotlib
import
pyplot
as
plt
from
matplotlib
import
pyplot
as
plt
import
os
import
os
import
torch
import
torch
import
json
from
torch.utils.data
import
TensorDataset
,
DataLoader
,
random_split
from
torch.utils.data
import
TensorDataset
,
DataLoader
,
random_split
from
sklearn.model_selection
import
KFold
from
sklearn.model_selection
import
KFold
from
sklearn.metrics
import
accuracy_score
,
precision_recall_fscore_support
,
roc_auc_score
from
sklearn.metrics
import
accuracy_score
,
precision_recall_fscore_support
,
roc_auc_score
...
@@ -196,6 +200,11 @@ def evaluate_models(models, directory, num_iterations=100, colors=None,
...
@@ -196,6 +200,11 @@ def evaluate_models(models, directory, num_iterations=100, colors=None,
print
(
'
Finished training models with 5-fold cross validation!
'
)
print
(
'
Finished training models with 5-fold cross validation!
'
)
print
(
f
'
Training time:
{
toc_train
-
tic_train
:
0.4
f
}
s
\n
'
)
print
(
f
'
Training time:
{
toc_train
-
tic_train
:
0.4
f
}
s
\n
'
)
with
open
(
directory
+
'
/
'
+
'
_
'
.
join
(
models
.
keys
())
+
'
.json
'
,
'
w
'
)
as
json_file
:
json_file
.
write
(
json
.
dumps
(
classification_stats
))
with
open
(
directory
+
'
/
'
+
'
_
'
.
join
(
models
.
keys
())
+
'
.json
'
)
as
json_file
:
classification_stats
=
json
.
load
(
json_file
)
print
(
'
Plotting evaluation of trained models.
'
)
print
(
'
Plotting evaluation of trained models.
'
)
plot_boxplot
(
classification_stats
,
colors
)
plot_boxplot
(
classification_stats
,
colors
)
classification_stats
=
{
measure
:
{
model
+
'
(
'
+
dataset
+
'
)
'
:
np
.
array
(
classification_stats
=
{
measure
:
{
model
+
'
(
'
+
dataset
+
'
)
'
:
np
.
array
(
...
...
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