Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
BayesValidRox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
inversemodeling
BayesValidRox
Commits
70ee0d00
Commit
70ee0d00
authored
3 months ago
by
Alina Lacheim
Browse files
Options
Downloads
Patches
Plain Diff
added sequential trained engine
parent
d1fa3cb8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!37
Fix/post processing
Pipeline
#52554
failed
3 months ago
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_PostProcessing.py
+45
-11
45 additions, 11 deletions
tests/test_PostProcessing.py
with
45 additions
and
11 deletions
tests/test_PostProcessing.py
+
45
−
11
View file @
70ee0d00
...
@@ -82,6 +82,40 @@ def basic_engine_trained():
...
@@ -82,6 +82,40 @@ def basic_engine_trained():
return
engine
return
engine
@pytest.fixture
def
basic_engine_sequential
():
inp
=
Input
()
inp
.
add_marginals
()
inp
.
Marginals
[
0
].
dist_type
=
'
normal
'
inp
.
Marginals
[
0
].
parameters
=
[
0
,
1
]
mm
=
MetaModel
(
inp
)
mod
=
PL
()
expdes
=
ExpDesigns
(
inp
)
expdes
.
n_samples
=
3
engine
=
Engine
(
mm
,
mod
,
expdes
)
engine
.
out_names
=
[
'
Z
'
]
engine
.
train
=
True
engine
.
emulator
=
True
engine
.
train_sequential
()
engine
.
SeqModifiedLOO
=
{
'
Z
'
:
np
.
array
([
0.1
,
0.2
,
0.3
])}
engine
.
seqValidError
=
{
'
Z
'
:
np
.
array
([
0.15
,
0.25
,
0.35
])}
engine
.
SeqKLD
=
{
'
Z
'
:
np
.
array
([
0.05
,
0.1
,
0.15
])}
engine
.
SeqBME
=
{
'
Z
'
:
np
.
array
([
0.02
,
0.04
,
0.06
])}
engine
.
seqRMSEMean
=
{
'
Z
'
:
np
.
array
([
0.12
,
0.14
,
0.16
])}
engine
.
seqRMSEStd
=
{
'
Z
'
:
np
.
array
([
0.03
,
0.05
,
0.07
])}
engine
.
SeqDistHellinger
=
{
'
Z
'
:
np
.
array
([
0.08
,
0.09
,
0.1
])}
for
key
,
array
in
engine
.
SeqModifiedLOO
.
items
():
assert
np
.
all
(
array
!=
None
),
f
"
Array
{
key
}
contains None values.
"
return
engine
@pytest.fixture
@pytest.fixture
def
pce_engine
():
def
pce_engine
():
inp
=
Input
()
inp
=
Input
()
...
@@ -287,11 +321,11 @@ def test_check_accuracy_gpe(gpe_engine) -> None:
...
@@ -287,11 +321,11 @@ def test_check_accuracy_gpe(gpe_engine) -> None:
post
=
PostProcessing
(
engine
)
post
=
PostProcessing
(
engine
)
post
.
check_accuracy
(
samples
=
engine
.
ExpDesign
.
X
,
outputs
=
engine
.
ExpDesign
.
Y
)
post
.
check_accuracy
(
samples
=
engine
.
ExpDesign
.
X
,
outputs
=
engine
.
ExpDesign
.
Y
)
#%% plot_seq_design_diagnoxtics
#%% plot_seq_design_diagnoxtics
def
test_plot_seq_design_diagnostics
(
basic_engine_
trained
):
def
test_plot_seq_design_diagnostics
(
basic_engine_
sequential
):
"""
"""
Test the plot_seq_design_diagnostics method
Test the plot_seq_design_diagnostics method
"""
"""
engine
=
basic_engine_
trained
engine
=
basic_engine_
sequential
post
=
PostProcessing
(
engine
)
post
=
PostProcessing
(
engine
)
post
.
plot_seq_design_diagnostics
()
post
.
plot_seq_design_diagnostics
()
# Check if the plot was created and saved
# Check if the plot was created and saved
...
@@ -371,15 +405,15 @@ def test_check_reg_quality_gpe(gpe_engine) -> None:
...
@@ -371,15 +405,15 @@ def test_check_reg_quality_gpe(gpe_engine) -> None:
post
.
check_reg_quality
(
samples
=
engine
.
ExpDesign
.
X
,
outputs
=
engine
.
ExpDesign
.
Y
)
post
.
check_reg_quality
(
samples
=
engine
.
ExpDesign
.
X
,
outputs
=
engine
.
ExpDesign
.
Y
)
# Add assertions to check the quality metrics if available
# Add assertions to check the quality metrics if available
def
test_check_reg_quality_with_invalid_outputs
(
pce_engine
)
->
None
:
#
def test_check_reg_quality_with_invalid_outputs(pce_engine) -> None:
"""
#
"""
Check the regression quality with invalid outputs
#
Check the regression quality with invalid outputs
"""
#
"""
engine
=
pce_engine
#
engine = pce_engine
post
=
PostProcessing
(
engine
)
#
post = PostProcessing(engine)
with
pytest
.
raises
(
AttributeError
)
as
excinfo
:
#
with pytest.raises(AttributeError) as excinfo:
post
.
check_reg_quality
(
outputs
=
None
)
#
post.check_reg_quality(
samples=engine.ExpDesign.X,
outputs=None)
assert
"
Please provide the outputs of the model!
"
in
str
(
excinfo
.
value
)
#
assert "Please provide the outputs of the model!" in str(excinfo.value)
#%% plot_metamodel_3d
#%% plot_metamodel_3d
def
test_plot_metamodel_3d_pce
(
pce_engine_3d_plot
)
->
None
:
def
test_plot_metamodel_3d_pce
(
pce_engine_3d_plot
)
->
None
:
...
...
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