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
91c37f00
Commit
91c37f00
authored
Jan 19, 2022
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Integrated Main.py into Snakefile.
parent
c644b003
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Main.py
+0
-61
0 additions, 61 deletions
Main.py
Snakefile
+50
-1
50 additions, 1 deletion
Snakefile
config.yaml
+40
-0
40 additions, 0 deletions
config.yaml
with
90 additions
and
62 deletions
Main.py
deleted
100644 → 0
+
0
−
61
View file @
c644b003
# -*- coding: utf-8 -*-
"""
@author: Laura C. Kühle
Code-Style: E226, W503
Docstring-Style: D200, D400
"""
from
DG_Approximation
import
DGScheme
import
timeit
tic
=
timeit
.
default_timer
()
alpha
=
1
p
=
2
cfl
=
0.2
N
=
32
# 40 elements work well for Condition 3
finalTime
=
1
xL
=
-
1
xR
=
1
detector_config
=
{}
init_config
=
{}
limiter_config
=
{}
quadrature_config
=
{}
fold_len
=
16
whisker_len
=
3
detector_config
[
'
fold_len
'
]
=
fold_len
detector_config
[
'
whisker_len
'
]
=
whisker_len
init_config
[
'
factor
'
]
=
4
init_config
[
'
left_factor
'
]
=
3
limiter_config
[
'
mod_factor
'
]
=
0
limiter_config
[
'
erase_degree
'
]
=
0
quadrature_config
[
'
num_eval_points
'
]
=
12
# 12
# detector = 'Theoretical'
detector
=
'
ArtificialNeuralNetwork
'
update_scheme
=
'
SSPRK3
'
init_cond
=
'
Sine
'
limiter
=
'
ModifiedMinMod
'
quadrature
=
'
Gauss
'
dg_scheme
=
DGScheme
(
detector
,
detector_config
=
detector_config
,
init_cond
=
init_cond
,
init_config
=
init_config
,
limiter
=
limiter
,
limiter_config
=
limiter_config
,
quadrature
=
quadrature
,
quadrature_config
=
quadrature_config
,
update_scheme
=
update_scheme
,
wave_speed
=
alpha
,
polynomial_degree
=
p
,
cfl_number
=
cfl
,
num_grid_cells
=
N
,
final_time
=
finalTime
,
verbose
=
False
,
left_bound
=
xL
,
right_bound
=
xR
)
dg_scheme
.
approximate
()
dg_scheme
.
save_plots
()
toc
=
timeit
.
default_timer
()
print
(
'
Time:
'
,
toc
-
tic
)
# if __name__ == '__main__':
# pass
This diff is collapsed.
Click to expand it.
Snakefile
+
50
−
1
View file @
91c37f00
import sys
import sys
import timeit
import ANN_Data_Generator, Initial_Condition, ANN_Training
import ANN_Data_Generator, Initial_Condition, ANN_Training
from ANN_Training import evaluate_models
from ANN_Training import evaluate_models
from DG_Approximation import DGScheme
import numpy as np
import numpy as np
configfile: 'config.yaml'
configfile: 'config.yaml'
...
@@ -14,7 +16,54 @@ if config['random_seed'] is not None:
...
@@ -14,7 +16,54 @@ if config['random_seed'] is not None:
rule all:
rule all:
input:
input:
expand(DIR+'/trained models/model__{model}.pt', model=MODELS),
expand(DIR+'/trained models/model__{model}.pt', model=MODELS),
DIR+'/model evaluation/classification_accuracy/' + '_'.join(MODELS.keys()) + '.pdf'
DIR+'/model evaluation/classification_accuracy/' + '_'.join(MODELS.keys()) + '.pdf',
config['dg_parameter']['plot_dir'] + '/error/' + 'Sine__ArtificialNeuralNetwork__' +
'ModifiedMinMod0__SSPRK3__Gauss12__final_time_1__wave_speed_1__' +
'number_of_cells_32__polynomial_degree_2.pdf'
rule approximate_solution:
input:
config['dg_parameter']['detector_config']['model_state']
if config['dg_parameter']['detector'] == 'ArtificialNeuralNetwork' else ''
output:
error=config['dg_parameter']['plot_dir'] + '/error/' + 'Sine__ArtificialNeuralNetwork__' +
'ModifiedMinMod0__SSPRK3__Gauss12__final_time_1__wave_speed_1__' +
'number_of_cells_32__polynomial_degree_2.pdf'
params:
# plot_dir=config['plot_dir'],
# wave_speed=config['wave_speed'],
# polynomial_degree=config['polynomial_degree'],
# cfl_number=config['cfl_number'],
# num_grid_cells=config['num_grid_cells'],
# final_time=config['final_time'],
# left_bound=config['left_bound'],
# right_bound=config['right_bound'],
# verbose=config['verbose'],
# detector=config['detector'],
# detector_config=config['detector_config'],
# init_cond=config['init_cond'],
# init_config=config['init_config'],
# limiter=config['limiter'],
# limiter_config=config['limiter_config'],
# quadrature=config['quadrature'],
# quadrature_config=config['quadrature_config'],
# update_scheme=config['update_scheme']
dg_params=config['dg_parameter']
log:
DIR+'/log/approximate_solution.log'
run:
with open(str(log), 'w') as logfile:
tic = timeit.default_timer()
print(params.dg_params)
# dg_scheme = DGScheme(**params)
dg_scheme = DGScheme(**params.dg_params)
dg_scheme.approximate()
dg_scheme.save_plots()
toc = timeit.default_timer()
print('Time:',toc-tic)
rule test_model:
rule test_model:
input:
input:
...
...
This diff is collapsed.
Click to expand it.
config.yaml
+
40
−
0
View file @
91c37f00
data_directory
:
"
Snakemake-Test"
data_directory
:
"
Snakemake-Test"
random_seed
:
1234
random_seed
:
1234
# Parameter for Approximation with Troubled Cell Detection
dg_parameter
:
plot_dir
:
'
testing'
wave_speed
:
1
polynomial_degree
:
2
cfl_number
:
0.2
num_grid_cells
:
32
# 40 elements work well for Condition 3
final_time
:
1
left_bound
:
-1
right_bound
:
1
verbose
:
True
#detector: 'Theoretical'
detector
:
'
ArtificialNeuralNetwork'
detector_config
:
fold_len
:
16
whisker_len
:
3
model_state
:
'
Snakemake-Test/trained
models/model__Adam.pt'
init_cond
:
'
Sine'
init_config
:
factor
:
4
left_factor
:
3
limiter
:
'
ModifiedMinMod'
limiter_config
:
mod_factor
:
0
erase_degree
:
0
quadrature
:
'
Gauss'
quadrature_config
:
num_eval_points
:
12
update_scheme
:
'
SSPRK3'
# Parameter for Training Data Generation
# Parameter for Training Data Generation
sample_number
:
100
sample_number
:
100
...
@@ -25,6 +60,7 @@ functions:
...
@@ -25,6 +60,7 @@ functions:
# Parameter for Model Training and Evaluation
# Parameter for Model Training and Evaluation
compare_normalization
:
True
compare_normalization
:
True
classification_colors
:
classification_colors
:
Accuracy
:
'
#FF00FF'
# magenta
Accuracy
:
'
#FF00FF'
# magenta
Precision_Smooth
:
'
#FF0000'
# red
Precision_Smooth
:
'
#FF0000'
# red
...
@@ -34,6 +70,7 @@ classification_colors:
...
@@ -34,6 +70,7 @@ classification_colors:
F-Score_Smooth
:
'
#00FF00'
# green
F-Score_Smooth
:
'
#00FF00'
# green
F-Score_Troubled
:
'
#006400'
# dark green
F-Score_Troubled
:
'
#006400'
# dark green
AUROC
:
'
#FFFF00'
# yellow
AUROC
:
'
#FFFF00'
# yellow
models
:
models
:
Adam
:
Adam
:
num_epochs
:
1000
num_epochs
:
1000
...
@@ -52,3 +89,6 @@ models:
...
@@ -52,3 +89,6 @@ models:
loss_function
:
BCELoss
loss_function
:
BCELoss
optimizer
:
SGD
optimizer
:
SGD
# Loss Functions: BCELoss, BCEWithLogitsLoss,
# CrossEntropyLoss (not working), MSELoss (with reduction='sum')
# Optimizer: Adam, SGD
\ No newline at end of file
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