***
Wartungsfenster jeden ersten Mittwoch vormittag im Monat
***
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jackknife
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
E138 Institute of Solid State Physics
E138-01 Computational Materials Science
Software
jackknife
Commits
799290ca
Commit
799290ca
authored
5 years ago
by
Patrick Kappl
Browse files
Options
Downloads
Patches
Plain Diff
Make the number of samples an input parameter
parent
44f71dd4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
jackknife.py
+3
-4
3 additions, 4 deletions
jackknife.py
main.py
+3
-3
3 additions, 3 deletions
main.py
with
6 additions
and
7 deletions
jackknife.py
+
3
−
4
View file @
799290ca
import
numpy
as
np
def
do_jackknife_estimation
(
input_sample_generator
,
transformation_function
):
def
do_jackknife_estimation
(
input_sample_generator
,
n_samples
,
transformation_function
):
"""
Do a jackknife estimation for the transformed sample.
Estimate and return the sample mean, variance and standard deviation
...
...
@@ -13,9 +14,7 @@ def do_jackknife_estimation(input_sample_generator, transformation_function):
"""
gen
=
input_sample_generator
f
=
transformation_function
samples
=
gen
()
n_samples
=
sum
(
1
for
i
in
samples
)
samples
=
gen
()
input_mean
=
sum
(
i
for
i
in
samples
)
/
n_samples
transformed_mean
=
f
(
input_mean
)
...
...
This diff is collapsed.
Click to expand it.
main.py
+
3
−
3
View file @
799290ca
...
...
@@ -27,7 +27,7 @@ y_generator = jackknife.get_sample_generator(y_list)
#%%
# Do a Jackknife estimation with the x-values and f() and print the
# results
output
=
jackknife
.
do_jackknife_estimation
(
x_generator
,
f
)
output
=
jackknife
.
do_jackknife_estimation
(
x_generator
,
n
,
f
)
x_mean
=
sum
(
i
for
i
in
x_list
)
/
n
print
(
"
{}{}
"
.
format
(
"
f(mean(x)) =
"
,
f
(
x_mean
)))
print
(
"
{}{}
"
.
format
(
"
mean(y
'
) =
"
,
output
[
0
]))
...
...
@@ -38,7 +38,7 @@ print("{}{}".format("standard deviation(y') = ", output[2]))
# Do a Jackknife estimation with the y-values and the identity function
# and print the results. This means that statistics are done on a
# transformed sample set y, that is not bias corrected.
output
=
jackknife
.
do_jackknife_estimation
(
y_generator
,
lambda
x
:
x
)
output
=
jackknife
.
do_jackknife_estimation
(
y_generator
,
n
,
lambda
x
:
x
)
print
(
"
{}{}
"
.
format
(
"
mean(y) =
"
,
output
[
0
]))
print
(
"
{}{}
"
.
format
(
"
variance(y) =
"
,
output
[
1
]))
print
(
"
{}{}
"
.
format
(
"
standard deviation(y) =
"
,
output
[
2
]))
...
...
@@ -79,7 +79,7 @@ y_generator = jackknife.get_sample_generator(y_list)
#%%
output
=
jackknife
.
do_jackknife_estimation
(
x_generator
,
f2
)
output
=
jackknife
.
do_jackknife_estimation
(
x_generator
,
n2
,
f2
)
x_mean
=
sum
(
i
for
i
in
m_2_and_4
)
/
n2
print
(
"
{}{}
"
.
format
(
"
f2(mean(x)) =
"
,
f2
(
x_mean
)))
print
(
"
{}{}
"
.
format
(
"
mean(y
'
) =
"
,
output
[
0
]))
...
...
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