我如何在没有模型拟合的情况下看到各种stan/rstan操作的输出?
Stan具有许多不同的操作,可以与数组,矩阵和混合数据类型一起使用。例如,这是混合操作。但是,有时我不确定一个操作是否会完成我相信它的作用,并希望很快看到它产生的东西。
例如,假设我有一个向量,我可能想看看当我将其传递给diag_matrix()
函数时会发生什么。而
有什么方法可以实现这一目标,也许是在控制台上打印的?
R示例
x <- vector(5)
diag_matrix(x)
# diagonal matrix here, only once!
Stan示例
vector[K] x;
diag_matrix(x)
# diagonal matrix here, only once!
Stan has many different operations that can be used with arrays, matrices, and mixed data types. For example, here are the mixed operations. However, sometimes I am not sure whether an operation accomplishes what I believe it does and want to see what it produces very quickly.
For example, supposing I have a vector, I might want to see what happens when I pass it to the diag_matrix()
function. While the documentation states this returns "The diagonal matrix with diagonal x," it can be helpful sometimes to take a look at this output during model development. Ideally, this could be done in the Stan program or in R itself, with pseudocode below.
Is there some way of accomplishing this, perhaps printing to the console?
R Example
x <- vector(5)
diag_matrix(x)
# diagonal matrix here, only once!
Stan Example
vector[K] x;
diag_matrix(x)
# diagonal matrix here, only once!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论