Skip to content
Snippets Groups Projects
Commit 9b0bacf0 authored by Laura Christine Kühle's avatar Laura Christine Kühle
Browse files

Outsourced run command for SM rule 'plot_test_results' into script.

parent 43bcfcc3
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
"""Script to plot results of ANN model testing.
@author: Laura C. Kühle
"""
import sys
from tcd.Plotting import plot_evaluation_results
def main() -> None:
"""Plot results of ANN model tests."""
with open(str(snakemake.log[0]), 'w', encoding='utf-8') as logfile:
sys.stdout = logfile
sys.stderr = logfile
# Plot evaluation results
plot_evaluation_results(evaluation_file=snakemake.input['json_file'],
directory=snakemake.params['directory'],
colors=snakemake.params['colors'])
if __name__ == '__main__':
if "snakemake" in locals():
main()
else:
print('Not Defined.')
import sys
from scripts.tcd.Plotting import plot_evaluation_results
configfile: 'config.yaml'
DIR = config['data_dir']
MODELS = config['models']
rule all:
input:
expand(DIR+'/trained models/{model}.model.pt', model=MODELS),
......@@ -14,6 +12,7 @@ rule all:
+'.barplot.pdf'
default_target: True
rule plot_test_results:
input:
json_file = DIR+'/model evaluation/'+'_'.join(MODELS.keys()) + '.json'
......@@ -21,15 +20,12 @@ rule plot_test_results:
DIR+'/model evaluation/'+'_'.join(MODELS.keys())
+'.barplot.pdf'
params:
colors = config['classification_colors']
colors = config['classification_colors'],
directory = DIR
log:
DIR+'/log/plot_test_results.log'
run:
with open(str(log), 'w') as logfile:
sys.stdout = logfile
sys.stderr = logfile
plot_evaluation_results(evaluation_file=input.json_file,
directory=DIR, colors=params.colors)
script:
'../scripts/plot_test_results.py'
rule test_model:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment