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
43bcfcc3
Commit
43bcfcc3
authored
2 years ago
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Outsourced run command for SM rule 'test_model' into script.
parent
5effb4e8
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
scripts/test_model.py
+38
-0
38 additions, 0 deletions
scripts/test_model.py
workflows/ANN_training.smk
+6
-17
6 additions, 17 deletions
workflows/ANN_training.smk
with
44 additions
and
17 deletions
scripts/test_model.py
0 → 100644
+
38
−
0
View file @
43bcfcc3
# -*- coding: utf-8 -*-
"""
Script to test ANN models.
@author: Laura C. Kühle
"""
import
sys
from
tcd.ANN_Training
import
ModelTrainer
,
evaluate_models
def
main
()
->
None
:
"""
Test ANN models.
"""
models
=
{}
with
open
(
str
(
snakemake
.
log
[
0
]),
'
w
'
,
encoding
=
'
utf-8
'
)
as
logfile
:
sys
.
stdout
=
logfile
sys
.
stderr
=
logfile
# Initialize models to be evaluated
for
model
in
snakemake
.
params
[
'
models
'
]:
trainer
=
ModelTrainer
(
{
'
model_name
'
:
model
,
'
dir
'
:
snakemake
.
params
[
'
directory
'
],
'
model_dir
'
:
snakemake
.
params
[
'
directory
'
],
'
random_seed
'
:
snakemake
.
params
[
'
random_seed
'
],
**
snakemake
.
params
[
'
models
'
][
model
]})
models
[
model
]
=
trainer
# Evaluate models
evaluate_models
(
models
=
models
,
directory
=
snakemake
.
params
[
'
directory
'
],
num_iterations
=
snakemake
.
params
[
'
num_iterations
'
],
compare_normalization
=
snakemake
.
params
[
'
compare_normalization
'
])
if
__name__
==
'
__main__
'
:
if
"
snakemake
"
in
locals
():
main
()
else
:
print
(
'
Not Defined.
'
)
This diff is collapsed.
Click to expand it.
workflows/ANN_training.smk
+
6
−
17
View file @
43bcfcc3
import sys
from scripts.tcd import ANN_Training
from scripts.tcd.ANN_Training import *
from scripts.tcd.Plotting import plot_evaluation_results
configfile: 'config.yaml'
...
...
@@ -44,23 +42,14 @@ rule test_model:
params:
num_iterations = config['num_iterations'],
compare_normalization = config['compare_normalization'],
random_seed = config['random_seed']
random_seed = config['random_seed'],
directory = DIR,
models = config['models']
log:
DIR+'/log/test_model.log'
run:
models = {}
with open(str(log), 'w') as logfile:
sys.stdout = logfile
sys.stderr = logfile
for model in MODELS:
trainer= ANN_Training.ModelTrainer(
{'model_name': model, 'dir': DIR, 'model_dir': DIR,
'random_seed': params.random_seed,
**MODELS[model]})
models[model] = trainer
evaluate_models(models=models, directory=DIR,
num_iterations=params.num_iterations,
compare_normalization=params.compare_normalization)
script:
'../scripts/test_model.py'
rule train_model:
input:
...
...
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