Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
rli
pbdlib-python
Commits
a231f1f5
Commit
a231f1f5
authored
Jan 09, 2019
by
Emmanuel PIGNAT
Browse files
correcting bug in multivariate-t pdf
parent
66137835
Changes
1
Hide whitespace changes
Inline
Side-by-side
pbdlib/functions.py
View file @
a231f1f5
...
...
@@ -262,7 +262,7 @@ def multi_variate_t(x, nu, mu, sigma=None, log=True, gmm=False, lmbda=None):
:param log: bool
:return:
"""
from
scipy.special
import
gamma
from
scipy.special
import
gamma
,
gammaln
if
not
gmm
:
if
type
(
sigma
)
is
float
:
sigma
=
np
.
array
(
sigma
,
ndmin
=
2
)
...
...
@@ -288,9 +288,9 @@ def multi_variate_t(x, nu, mu, sigma=None, log=True, gmm=False, lmbda=None):
(
1
+
1
/
nu
*
dist
)
**
(
-
(
nu
+
p
)
/
2
)
return
lik
else
:
log_lik
=
np
.
log
(
gamma
((
nu
+
p
)
/
2
)
)
+
0.5
*
np
.
linalg
.
slogdet
(
lmbda_
)[
1
]
-
\
(
np
.
log
(
gamma
(
nu
/
2
))
+
(
p
/
2
)
*
np
.
log
(
nu
)
+
(
p
/
2
)
*
np
.
log
(
np
.
pi
))
+
\
((
-
(
nu
+
p
)
/
2
)
*
np
.
log
(
1
+
1
/
nu
*
dist
))
log_lik
=
gamma
ln
((
nu
+
p
)
/
2
)
+
0.5
*
np
.
linalg
.
slogdet
(
lmbda_
)[
1
]
-
\
gamma
ln
(
nu
/
2
)
-
p
/
2.
*
(
np
.
log
(
nu
)
+
np
.
log
(
np
.
pi
))
+
\
((
-
(
nu
+
p
)
/
2
)
*
np
.
log
(
1
+
dist
/
nu
))
return
log_lik
else
:
...
...
@@ -326,7 +326,7 @@ def multi_variate_normal(x, mu, sigma=None, log=True, gmm=False, lmbda=None):
if
sigma
is
not
None
:
log_lik
-=
0.5
*
(
x
.
shape
[
1
]
*
np
.
log
(
2
*
np
.
pi
)
+
np
.
linalg
.
slogdet
(
sigma
)[
1
])
else
:
log_lik
+
=
0.5
*
np
.
linalg
.
slogdet
(
2
*
np
.
pi
*
lmbda
)[
1
]
log_lik
-
=
0.5
*
(
x
.
shape
[
1
]
*
np
.
log
(
2
*
np
.
pi
)
-
np
.
linalg
.
slogdet
(
lmbda
)[
1
]
)
return
log_lik
if
log
else
np
.
exp
(
log_lik
)
...
...
Emmanuel PIGNAT
@epignat
mentioned in commit
12e1b345
·
Jan 10, 2019
mentioned in commit
12e1b345
mentioned in commit 12e1b345da304530b38526d58023c2de53411520
Toggle commit list
Emmanuel PIGNAT
@epignat
mentioned in commit
e3c16bfb
·
Jan 10, 2019
mentioned in commit
e3c16bfb
mentioned in commit e3c16bfba39444f4d8cdceccadbd03983db0871d
Toggle commit list
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment