问题标签 [pystan]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
37 浏览

stan - save_warmup in Pystan

I've been using Stan for a bit through Pystan and is really nice. Just recently however I tried to reduce the size of the output (particularly, the generated_quantities bit) using the same syntax than in STAN, by declaring save_warmup=False. However, when digging a bit into PyStan code I noticed that this is currently hard coded and not able to edit using the control argument (the dictionary that handles extra parameters in Pystan). I'm tempted to modify the source code directly, but just wondering if is something PyStan devs are currently considering.

Cheers and thanks for an amazing work! (both PyStan and Stan!)

0 投票
0 回答
187 浏览

python - 尽管它列在 pip3 列表中,但 Visual Studio 代码中的 jupyter notebook 中没有名为“fbprophet”的模块

截屏


----> 1 中的 ModuleNotFoundError Traceback(最近一次调用最后一次)来自 fbprophet import Prophet

ModuleNotFoundError:没有名为“fbprophet”的模块

0 投票
1 回答
126 浏览

python - PyStan Model description

I am trying to build a simple statistical model to study both stochastic model and PyStan.
Here, this is my model description in PyStan which does not work well. Please help me.

  • Model is to predict Val by person's Age. Its formulation is that Val is generated by NormDist.
  • Data size is N, and max value of the Age is N_age.
  • the effect of a_age[i] depends on the effect of a_age[i-1]. In this script, a_age[N] stands for it.
  • a_age[] is normalized.

This script goes wrong. Other models work well without problems. So, I expect miss exists in this model description.

0 投票
0 回答
118 浏览

apache-spark - Livy 会话已损坏

我们正在使用Apache Livy服务器与 Spark 集群进行通信。我们注意到一些语句在执行时出错,之后 livy session 变得不可用。例如,我们将fbprophet用于时间序列模型。fbprophetpystan产生一些控制台输出。一旦此输出记录在会话中,该语句就会出错。尽管作业继续在集群上执行。之后没有语句运行正确。使用 fbprophet 代码运行语句后的输出

Unrecognized token 'Iter': was expecting 'null', 'true', 'false' or NaN at [Source: Iter log prob ||dx|| ||grad|| alpha alpha0 # evals Notes ; line: 1, column: 9]

同样,在使用mlflow build-docker命令创建 docker 映像时,它还会生成有关映像创建过程的输出。再次生成此输出后,会话错误输出以下是 build-docker 的输出

Unexpected character ('/' (code 47)): maybe a (non-standard) comment? (not recognized as one since ``````Feature 'ALLOW_COMMENTS' not enabled for parser) at [Source: /tmp/tmpq6gz1q3t/; line: 1, column: 2]

主要问题是在这样的声明之后会话变得不可用。有人遇到过 Apache livy 的此类问题吗?

我能想到的一种解决方案是抑制 pystan 和 docker 进程的输出,但我无法弄清楚。我们如何抑制输出被登录到 livy 会话?

0 投票
0 回答
269 浏览

pandas - pd.read_excel 在某些文件上崩溃(挂起)

FOA 我以前从未遇到过 pandas 崩溃(冻结、无限循环)的情况。其次,不是文件,他们以前读得很好。

做了一些研究,我偶然发现了这个问题,原因可以追溯到 pd._libs.cp36。另一个类似

我查了自己的pd。库来查找各种 .py 文件,例如 algos.cp38-win .... 有几件事我想到了。首先,我升级到 python 3.8。环境称为work38 btw但尝试不同的环境没有用

唯一的另一件事是我安装了 fbprophet。要安装 fbprophet,我安装了 pystan。要安装 pystan,我必须按照他们的文档 conda install libpython m2w64-toolchain -c msys2运行这个命令。

有许多安装 pystan 的指南鼓励您按特定顺序安装(首先是 pystan,然后是 numpy cython pandas 等)。Idk 如果有这个原因。

无论如何,我的想法是上面的代码用一些 c 编译器搞砸了我的整个 anaconda 环境,现在 pandas 在所有环境中都被破坏了,即使我 pip uninstall & pip install --no-cache-dir pandas .

2个问题:第一个是,你知道这里发生了什么吗?你能给我解释一下吗?其次,知道如何修复它吗?或者我必须卸载 anaconda 并重新安装所有内容(然后当然是 pip install -r requirements.txt)

编辑:也许 C 编译器的东西是不相关的。我只是让 read_excel 运行了一段痛苦的时间,它返回了一个包含 65000 行和 250 列的数据框。我看到当我将 xlsx 转换为 csv(使用 CLI 脚本)时,csv 包含一堆空行和列。

TLDR:我有一个包含 250 行和 ~20 列的 xlsx 文件,但显然空单元格不是空的?

0 投票
1 回答
424 浏览

python - STAN RuntimeError:初始化失败

我正在尝试使用 STAN 估计多元正态分布的均值和协方差矩阵。我首先导入 pystan 并生成数据。我基本上尝试遵循 Python 的官方 YouTube教程

然后我指定我的模型。我的数据有形状(200,2)。因为我有一个多元分布,所以平均值必须是一个向量,协方差是一个矩阵。

然后我将数据放入字典中,如 YouTube 上的 STAN 教程所示

该模型编译没有问题。但是,当我尝试拟合模型时,会出现运行时错误。

导致

我不确定是什么导致了这个错误,因为我的代码只是对教程中的代码的一个轻微抽象。

0 投票
1 回答
993 浏览

runtime-error - Pystan,运行时错误 - 初始化失败

我正在尝试使用 Pystan 开发贝叶斯模型。我能够成功编译模型。但是当我对数据进行采样时,我遇到了运行时错误。参考下面的代码:

我检查了所有数据点(没有丢失数据或没有相同数字的列)及其数据类型(都是浮点 64)。我还使用 MinMaxScaler 缩放了数据

下面是我得到的错误。

我对 Pystan 比较陌生。我很感激我在这里得到的任何指导。

0 投票
1 回答
725 浏览

python - 有没有办法安装“pystan”和“fbprophet”。安装时出现错误

我尝试通过 pip 和 conda 安装,两种方式都失败了。任何人都知道如何克服这个问题。

Pystan安装错误

0 投票
0 回答
316 浏览

python - Python 打开的文件太多 - fbprohet

我正在做一个项目,我用 fbprophet 计算多个模型。Fbprohet 有一个问题,即没有默认的方式来抑制 pystan 的消息。所以在github上提到了一个解决方法来使用它作为装饰器:

我使用该命令计算模型:

我为每个模型做大约 250 次,并且有大约 600 个单个模型。因此Prophet()将被调用大约 150.000 次:

  • 股票报价单大约600

大约 1024 次迭代后,脚本停止运行并显示该错误代码:

因此,当我正确理解装饰器时,它会打开空文件来替换 pystan 警告。在我看来,装饰器关闭了函数中的空文件def __exit__(self, *_):。但这似乎无法正常工作。

有人看到错误或有其他解决方案吗?

如果不是,我会增加我的 ubuntu 服务器上的最大打开文件数,但我希望你有一个更 Pythonic 的方式。

BR洛伦兹

0 投票
1 回答
76 浏览

python - PyStan 在运行基本概率模型时因 Segfault 失败

我越来越熟悉 PyStan。我已经运行了几个模型,包括贝叶斯线性回归模型,没有问题。但是,当我尝试运行以下代码时,会出现 seg fault 错误:

有趣的是,这只发生老化迭代完成之后。我的模型代码在这里。我目前正在编造一些数据并试图推断参数beta_tru_1alpha. 型号代码来自Stan User's Guide

我在 Linux Pop OS 20.10 上使用 PyStan v. 2.19.1.1 和 python 3.7.6。我已经在多台机器上运行了这段代码,包括一个没有运气的 Ubuntu 容器。任何帮助表示赞赏。