Calculate fail for hierarchical models
- Dominant language
- C++
- Stars
- 607
- Forks
- 67
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 1
Description
While trying to use ```calculate``` to get prior distribution of an hierarchical model with correlated varying effect I get an error:
```r
modmat <- model.matrix(~ Sepal.Width, iris)
# index of species
jj <- as.numeric(iris$Species)
M <- ncol(modmat) # number of varying coefficients
N <- max(jj) # number of species
# prior on the standard deviation of the varying coefficient
tau <- exponential(0.5, dim = M)
# prior on the correlation between the varying coefficient
Omega <- lkj_correlation(3, M)
# optimization of the varying coefficient sampling through
# cholesky factorization and whitening
Omega_U <- chol(Omega)
Sigma_U <- sweep(Omega_U, 2, tau, "*")
z <- normal(0, 1, dim = c(N, M))
ab <- z %*% Sigma_U # equivalent to: ab ~ multi_normal(0, Sigma_U)
# the linear predictor
mu <- rowSums(ab[jj,] * modmat)
# the residual variance
sigma_e <- cauchy(0, 3, truncation = c(0, Inf))
#model
y <- as_data(iris$Sepal.Length)
distribution(y) <- normal(mu, sigma_e)
# get priors
calculate(y)
```
Returns an error:
```
Fehler in py_call_impl(callable, dots$args, dots$keywords) :
InvalidArgumentError: You must feed a value for placeholder tensor 'Placeholder_3' with dtype double and shape [1,2,2]
[[node Placeholder_3 (defined at /ops/array_ops.py:2143) ]]
Original stack trace for 'Placeholder_3':
File "/ops/array_ops.py", line 2143, in placeholder
return gen_array_ops.placeholder(dtype=dtype, shape=shape, name=name)
File "/ops/gen_array_ops.py", line 6262, in placeholder
"Placeholder", dtype=dtype, shape=shape, name=name)
File "/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/framework/ops.py", line 3616, in create_op
op_def=op_def)
File "/framework/ops.py", line 2005, in __init__
self._traceback = tf_stack.extract_stack()
```
This was done with the following package versions:
R version 3.6.2
greta_0.3.1.9011
Contributor guide
Assessment
This issue has not been assessed yet.