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
b54b1fee
Commit
b54b1fee
authored
3 years ago
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Improved verbose output.
parent
6c71e398
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ANN_Data_Generator.py
+16
-2
16 additions, 2 deletions
ANN_Data_Generator.py
with
16 additions
and
2 deletions
ANN_Data_Generator.py
+
16
−
2
View file @
b54b1fee
...
...
@@ -5,7 +5,7 @@
TODO: Improve
'
_generate_cell_data
'
TODO: Extract normalization (Combine smooth and troubled before normalizing) -> Done
TODO: Adapt code to generate both normalized and non-normalized data -> Done
TODO: Improve verbose output
TODO: Improve verbose output
-> Done
TODO: Change order of methods -> Done
"""
...
...
@@ -15,6 +15,7 @@ import os
import
Initial_Condition
import
DG_Approximation
import
timeit
class
TrainingDataGenerator
(
object
):
...
...
@@ -46,11 +47,14 @@ class TrainingDataGenerator(object):
os
.
makedirs
(
self
.
_data_dir
)
def
build_training_data
(
self
,
num_samples
):
print
(
'
Calculating training data...
'
)
tic
=
timeit
.
default_timer
()
print
(
'
Calculating training data...
\n
'
)
data_dict
=
self
.
_calculate_data_set
(
num_samples
)
print
(
'
Finished calculating training data!
'
)
self
.
_save_data
(
data_dict
)
toc
=
timeit
.
default_timer
()
print
(
'
Total runtime:
'
,
toc
-
tic
)
return
data_dict
def
_calculate_data_set
(
self
,
num_samples
):
...
...
@@ -78,6 +82,11 @@ class TrainingDataGenerator(object):
'
normalized_input
'
:
norm_input_matrix
}
def
_generate_cell_data
(
self
,
num_samples
,
initial_conditions
,
is_smooth
):
troubled_indicator
=
'
without
'
if
is_smooth
else
'
with
'
print
(
'
Calculating data
'
+
troubled_indicator
+
'
troubled cells...
'
)
print
(
'
Samples to complete:
'
,
num_samples
)
tic
=
timeit
.
default_timer
()
num_function_samples
=
num_samples
//
len
(
initial_conditions
)
function_id
=
0
input_data
=
np
.
zeros
((
num_samples
,
5
))
...
...
@@ -121,6 +130,10 @@ class TrainingDataGenerator(object):
if
count
%
100
==
0
:
print
(
str
(
count
)
+
'
samples completed.
'
)
toc
=
timeit
.
default_timer
()
print
(
'
Finished calculating data
'
+
troubled_indicator
+
'
troubled cells!
'
)
print
(
'
Calculation time:
'
,
toc
-
tic
,
'
\n
'
)
# Shuffle input data
order
=
np
.
random
.
permutation
(
num_samples
)
input_data
=
input_data
[
order
]
...
...
@@ -162,6 +175,7 @@ class TrainingDataGenerator(object):
return
normalized_input_data
def
_save_data
(
self
,
data
):
print
(
'
Saving training data.
'
)
for
key
in
data
.
keys
():
name
=
self
.
_data_dir
+
'
/
'
+
key
+
'
_data.npy
'
np
.
save
(
name
,
data
[
key
])
...
...
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