Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
YAPSUT
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
Michele Maris
YAPSUT
Commits
09287b3f
Commit
09287b3f
authored
1 year ago
by
Michele Maris
Browse files
Options
Downloads
Patches
Plain Diff
u
parent
1a60c8b5
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
src/yapsut/stats.py
+4
-2
4 additions, 2 deletions
src/yapsut/stats.py
with
4 additions
and
2 deletions
src/yapsut/stats.py
+
4
−
2
View file @
09287b3f
...
@@ -39,7 +39,7 @@ class CumulativeOfData :
...
@@ -39,7 +39,7 @@ class CumulativeOfData :
"""
"""
return
np
.
interp
(
x
,
self
.
_x
,
self
.
_eff
,
left
=
0.
,
right
=
1.
)
return
np
.
interp
(
x
,
self
.
_x
,
self
.
_eff
,
left
=
0.
,
right
=
1.
)
#
#
def
sampled_pdf
(
self
,
x
,
method
=
'
hist
'
)
:
def
sampled_pdf
(
self
,
x
,
method
=
'
hist
'
,
density
=
False
)
:
"""
returns the sample pdf for a list of x
"""
returns the sample pdf for a list of x
output: hh, xx
output: hh, xx
...
@@ -47,6 +47,8 @@ class CumulativeOfData :
...
@@ -47,6 +47,8 @@ class CumulativeOfData :
if method =
'
hist
'
the pdf is calculated using an histogram like function (default)
if method =
'
hist
'
the pdf is calculated using an histogram like function (default)
if method =
'
tan
'
the pdf is calculated using the local tangent to the cdf
if method =
'
tan
'
the pdf is calculated using the local tangent to the cdf
if method =
'
hist
'
and density = True, hh is normalized to the step size and represents an approximation of the local derivative
"""
"""
if
not
method
in
[
'
hist
'
,
'
tan
'
]
:
if
not
method
in
[
'
hist
'
,
'
tan
'
]
:
raise
Exception
(
"
Error: method must be either
'
hist
'
or
'
tan
'"
)
raise
Exception
(
"
Error: method must be either
'
hist
'
or
'
tan
'"
)
...
@@ -59,7 +61,7 @@ class CumulativeOfData :
...
@@ -59,7 +61,7 @@ class CumulativeOfData :
_x
=
np
.
sort
(
x
)
_x
=
np
.
sort
(
x
)
#
#
yy
=
self
.
cdf
(
_x
)
yy
=
self
.
cdf
(
_x
)
hh
=
(
yy
[
:
-
1
]
-
yy
[
1
:])
/
(
_x
[
:
-
1
]
-
_x
[
1
:])
hh
=
(
yy
[
1
:
]
-
yy
[:
-
1
])
/
(
_x
[
1
:
]
-
_x
[
:
-
1
])
if
density
else
yy
[
1
:]
-
yy
[:
-
1
]
return
hh
,
_x
return
hh
,
_x
elif
method
==
'
tan
'
:
elif
method
==
'
tan
'
:
h
=
(
self
.
_x
[
-
1
]
-
self
.
_x
[
0
])
*
eps
h
=
(
self
.
_x
[
-
1
]
-
self
.
_x
[
0
])
*
eps
...
...
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