Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cpp_sisso
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nomad-lab
cpp_sisso
Commits
a2ee6e60
Commit
a2ee6e60
authored
4 years ago
by
Thomas Purcell
Browse files
Options
Downloads
Patches
Plain Diff
Move jackknife_cv_conv_est to seperate file
In case more functions are needed
parent
f2b44951
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#81254
passed
4 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/python/postprocess/check_cv_convergence.py
+44
-0
44 additions, 0 deletions
src/python/postprocess/check_cv_convergence.py
with
44 additions
and
0 deletions
src/python/postprocess/check_cv_convergence.py
0 → 100644
+
44
−
0
View file @
a2ee6e60
import
numpy
as
np
from
glob
import
glob
def
jackknife_cv_conv_est
(
dir_expr
):
"""
Get the jackknife variance of the CV test error
Args:
dir_expr (str): Regular expression for the directory list
Returns:
avg_error: The average rmse of the test error
variance: The jackknife estimate of the variance of the test RMSE
"""
train_model_list
=
sorted
(
glob
(
dir_expr
+
"
/models/train_*_model_0.dat
"
),
key
=
lambda
s
:
int
(
s
.
split
(
"
/
"
)[
-
1
].
split
(
"
_
"
)[
2
]),
)
test_model_list
=
sorted
(
glob
(
dir_expr
+
"
/models/test_*_model_0.dat
"
),
key
=
lambda
s
:
int
(
s
.
split
(
"
/
"
)[
-
1
].
split
(
"
_
"
)[
2
]),
)
n_dim
=
int
(
train_model_list
[
-
1
].
split
(
"
/
"
)[
-
1
].
split
(
"
_
"
)[
2
])
models
=
[
Model
(
train_file
,
test_file
)
for
train_file
,
test_file
in
zip
(
train_model_list
,
test_model_list
)
]
test_rmse
=
np
.
array
([
model
.
test_rmse
for
model
in
models
]).
reshape
(
n_dim
,
-
1
)
x_bar_i
=
[]
for
dim_error
in
test_rmse
:
x_bar_i
.
append
([])
for
ii
in
range
(
len
(
dim_error
)):
x_bar_i
[
-
1
].
append
(
np
.
delete
(
dim_error
,
ii
).
mean
())
x_bar_i
=
np
.
array
(
x_bar_i
)
avg_error
=
x_bar_i
.
mean
(
axis
=
1
)
variance
=
(
(
test_rmse
.
shape
[
1
]
-
1.0
)
/
test_rmse
.
shape
[
1
]
*
np
.
sum
((
x_bar_i
-
avg_error
.
reshape
(
n_dim
,
1
))
**
2.0
,
axis
=
1
)
)
return
avg_error
,
variance
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