安装
R 中的安装
Prophet 是一个 CRAN 包,因此您可以使用 install.packages
。
1
2
# R
install.packages('prophet')
安装后,您可以开始使用!
实验性后端 - cmdstanr
您还可以选择一个实验性的替代 stan 后端,称为 cmdstanr
。安装 prophet
后,请按照这些说明使用 cmdstanr
代替 rstan
作为后端
1
2
3
4
5
6
7
8
9
10
11
# R
# We recommend running this is a fresh R session or restarting your current session
install.packages(c("cmdstanr", "posterior"), repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
# If you haven't installed cmdstan before, run:
cmdstanr::install_cmdstan()
# Otherwise, you can point cmdstanr to your cmdstan path:
cmdstanr::set_cmdstan_path(path = <your existing cmdstan>)
# Set the R_STAN_BACKEND environment variable
Sys.setenv(R_STAN_BACKEND = "CMDSTANR")
Windows
在 Windows 上,R 需要一个编译器,因此您需要按照 rstan
提供的说明进行操作。关键步骤是在尝试安装该包之前安装 Rtools。
如果您有自定义的 Stan 编译器设置,请从源代码安装,而不是从 CRAN 二进制文件安装。
Python 中的安装
Prophet 在 PyPI 上,因此您可以使用 pip
安装它。
1
python -m pip install prophet
- 从 v0.6 开始,不再支持 Python 2。
- 从 v1.0 开始,PyPI 上的包名称为“prophet”;在 v1.0 之前,它是“fbprophet”。
- 从 v1.1 开始,支持的最低 Python 版本为 3.7。
安装后,您可以开始使用!
Anaconda
Prophet 也可以通过 conda-forge 安装。
1
conda install -c conda-forge prophet