Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Poppy Miller
sourceR
Commits
c798daef
Commit
c798daef
authored
Nov 30, 2016
by
Chris Jewell
Browse files
Fixed non-specification of base distribution rate and shape parameters in DirichletProcessNode.
parent
98dfd922
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/node.R
View file @
c798daef
...
...
@@ -347,7 +347,7 @@ DirichletNode <- R6::R6Class(
#' base distribution \code{base}. Base should be a distribution function (dnorm, dgamma, etc) whose parameters
#' are specified in \code{...}.}
#' }
DirichletProcessNode
<-
R6
::
R6Class
(
DirichletProcessNode
<-
R6
::
R6Class
(
# TODO: Make this accept a generic base distribution, not just Gamma
"DirichletProcessNode"
,
inherit
=
StochasticNode
,
public
=
list
(
...
...
@@ -355,10 +355,14 @@ DirichletProcessNode <- R6::R6Class(
s
=
NA
,
base
=
NA
,
conc
=
NA
,
initialize
=
function
(
theta
,
s
,
alpha
,
base
,
...
,
name
)
{
baseShape
=
NA
,
baseRate
=
NA
,
initialize
=
function
(
theta
,
s
,
alpha
,
base
,
shape
,
rate
,
name
)
{
super
$
initialize
(
name
=
name
)
self
$
conc
<-
alpha
self
$
base
<-
base
self
$
base
<-
dgamma
self
$
baseShape
<-
shape
self
$
baseRate
<-
rate
h
=
replicate
(
length
(
theta
),
uuid
::
UUIDgenerate
())
self
$
theta
<-
hashmap
::
hashmap
(
h
,
theta
)
self
$
s
<-
h
[
s
]
...
...
@@ -366,7 +370,7 @@ DirichletProcessNode <- R6::R6Class(
getData
=
function
()
self
$
theta
$
find
(
self
$
s
),
getDensity
=
function
(
i
)
sum
(
self
$
base
(
self
$
theta
[
self
$
s
[
i
]],
...
,
log
=
T
))
sum
(
self
$
base
(
self
$
theta
[
self
$
s
[
i
]],
shape
=
self
$
baseShape
,
rate
=
self
$
baseRate
,
log
=
T
))
)
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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