فهرست منبع

Initial commit

Sean J. Taylor 8 سال پیش
کامیت
e51b42b336
100فایلهای تغییر یافته به همراه5163 افزوده شده و 0 حذف شده
  1. 14 0
      .gitignore
  2. 30 0
      LICENSE
  3. 33 0
      PATENTS
  4. 35 0
      R/DESCRIPTION
  5. 3 0
      R/LICENSE
  6. 10 0
      R/NAMESPACE
  7. 1025 0
      R/R/prophet.R
  8. 19 0
      R/man/compile_stan_model.Rd
  9. 17 0
      R/man/df_for_plotting.Rd
  10. 17 0
      R/man/fit.prophet.Rd
  11. 22 0
      R/man/fourier_series.Rd
  12. 18 0
      R/man/get_changepoint_indexes.Rd
  13. 18 0
      R/man/get_changepoint_matrix.Rd
  14. 18 0
      R/man/get_changepoint_times.Rd
  15. 19 0
      R/man/get_prophet_stan_model.Rd
  16. 22 0
      R/man/linear_growth_init.Rd
  17. 22 0
      R/man/logistic_growth_init.Rd
  18. 20 0
      R/man/make_all_seasonality_features.Rd
  19. 26 0
      R/man/make_future_dataframe.Rd
  20. 20 0
      R/man/make_holiday_features.Rd
  21. 24 0
      R/man/make_seasonality_features.Rd
  22. 26 0
      R/man/piecewise_linear.Rd
  23. 28 0
      R/man/piecewise_logistic.Rd
  24. 36 0
      R/man/plot.prophet.Rd
  25. 34 0
      R/man/predict.prophet.Rd
  26. 17 0
      R/man/predict_seasonal_components.Rd
  27. 17 0
      R/man/predict_trend.Rd
  28. 17 0
      R/man/predict_uncertainty.Rd
  29. 79 0
      R/man/prophet.Rd
  30. 24 0
      R/man/prophet_plot_components.Rd
  31. 24 0
      R/man/sample_model.Rd
  32. 22 0
      R/man/sample_predictive_trend.Rd
  33. 18 0
      R/man/set_changepoints.Rd
  34. 22 0
      R/man/setup_dataframe.Rd
  35. 15 0
      R/man/validate_inputs.Rd
  36. 1 0
      R/src/Makevars
  37. 1 0
      R/src/Makevars.win
  38. 26 0
      R/src/install.libs.R
  39. 5 0
      R/tests/testthat.R
  40. 469 0
      R/tests/testthat/data.csv
  41. 189 0
      R/tests/testthat/test_prophet.R
  42. 57 0
      R/vignettes/quick_start.Rmd
  43. 48 0
      README.md
  44. 9 0
      docs/.gitignore
  45. 3 0
      docs/Gemfile
  46. 145 0
      docs/Gemfile.lock
  47. 385 0
      docs/LICENSE
  48. 9 0
      docs/Makefile
  49. 80 0
      docs/README.md
  50. 95 0
      docs/_config.yml
  51. 8 0
      docs/_data/authors.yml
  52. 16 0
      docs/_data/features.yml
  53. 7 0
      docs/_data/nav.yml
  54. 19 0
      docs/_data/nav_docs.yml
  55. 0 0
      docs/_data/powered_by.yml
  56. 0 0
      docs/_data/powered_by_highlight.yml
  57. 17 0
      docs/_data/promo.yml
  58. 14 0
      docs/_docs/contributing.md
  59. 63 0
      docs/_docs/forecasting_growth.md
  60. 276 0
      docs/_docs/holiday_effects.md
  61. 40 0
      docs/_docs/installation.md
  62. 45 0
      docs/_docs/non-daily_data.md
  63. 99 0
      docs/_docs/outliers.md
  64. 284 0
      docs/_docs/quick_start.md
  65. 79 0
      docs/_docs/trend_changepoints.md
  66. 54 0
      docs/_docs/uncertainty_intervals.md
  67. 28 0
      docs/_includes/blog_pagination.html
  68. 5 0
      docs/_includes/content/gridblocks.html
  69. 37 0
      docs/_includes/content/items/gridblock.html
  70. 25 0
      docs/_includes/doc.html
  71. 0 0
      docs/_includes/doc_paging.html
  72. 33 0
      docs/_includes/footer.html
  73. 19 0
      docs/_includes/head.html
  74. 19 0
      docs/_includes/header.html
  75. 0 0
      docs/_includes/hero.html
  76. 22 0
      docs/_includes/home_header.html
  77. 3 0
      docs/_includes/katex_import.html
  78. 210 0
      docs/_includes/katex_render.html
  79. 31 0
      docs/_includes/nav.html
  80. 65 0
      docs/_includes/nav/collection_nav.html
  81. 19 0
      docs/_includes/nav/collection_nav_group.html
  82. 1 0
      docs/_includes/nav/collection_nav_group_item.html
  83. 30 0
      docs/_includes/nav/header_nav.html
  84. 15 0
      docs/_includes/nav_search.html
  85. 3 0
      docs/_includes/plugins/all_share.html
  86. 2 0
      docs/_includes/plugins/ascii_cinema.html
  87. 6 0
      docs/_includes/plugins/button.html
  88. 4 0
      docs/_includes/plugins/github_star.html
  89. 4 0
      docs/_includes/plugins/github_watch.html
  90. 5 0
      docs/_includes/plugins/google_share.html
  91. 6 0
      docs/_includes/plugins/iframe.html
  92. 18 0
      docs/_includes/plugins/like_button.html
  93. 5 0
      docs/_includes/plugins/plugin_row.html
  94. 34 0
      docs/_includes/plugins/post_social_plugins.html
  95. 88 0
      docs/_includes/plugins/slideshow.html
  96. 5 0
      docs/_includes/plugins/twitter_follow.html
  97. 4 0
      docs/_includes/plugins/twitter_share.html
  98. 35 0
      docs/_includes/post.html
  99. 28 0
      docs/_includes/powered_by.html
  100. 0 0
      docs/_includes/social_plugins.html

+ 14 - 0
.gitignore

@@ -0,0 +1,14 @@
+# Compiled python modules.
+*.pyc
+
+# Setuptools distribution folder.
+python/dist/
+
+# Python egg metadata, regenerated from source files by setuptools.
+python/*.egg-info
+build/
+
+# Notebook checkpoints
+.ipynb_checkpoints
+
+*.*~

+ 30 - 0
LICENSE

@@ -0,0 +1,30 @@
+BSD License
+
+For Prophet software
+
+Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+ * Neither the name Facebook nor the names of its contributors may be used to
+   endorse or promote products derived from this software without specific
+   prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 33 - 0
PATENTS

@@ -0,0 +1,33 @@
+Additional Grant of Patent Rights Version 2
+
+"Software" means the Prophet software contributed by Facebook, Inc.
+
+Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software
+("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable
+(subject to the termination provision below) license under any Necessary
+Claims, to make, have made, use, sell, offer to sell, import, and otherwise
+transfer the Software. For avoidance of doubt, no license is granted under
+Facebook’s rights in any patent claims that are infringed by (i) modifications
+to the Software made by you or any third party or (ii) the Software in
+combination with any software or other technology.
+
+The license granted hereunder will terminate, automatically and without notice,
+if you (or any of your subsidiaries, corporate affiliates or agents) initiate
+directly or indirectly, or take a direct financial interest in, any Patent
+Assertion: (i) against Facebook or any of its subsidiaries or corporate
+affiliates, (ii) against any party if such Patent Assertion arises in whole or
+in part from any software, technology, product or service of Facebook or any of
+its subsidiaries or corporate affiliates, or (iii) against any party relating
+to the Software. Notwithstanding the foregoing, if Facebook or any of its
+subsidiaries or corporate affiliates files a lawsuit alleging patent
+infringement against you in the first instance, and you respond by filing a
+patent infringement counterclaim in that lawsuit against that party that is
+unrelated to the Software, the license granted hereunder will not terminate
+under section (i) of this paragraph due to such counterclaim.
+
+A "Necessary Claim" is a claim of a patent owned by Facebook that is
+necessarily infringed by the Software standing alone.
+
+A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
+or contributory infringement or inducement to infringe any patent, including a
+cross-claim or counterclaim.

+ 35 - 0
R/DESCRIPTION

@@ -0,0 +1,35 @@
+Package: prophet
+Title: Automatic Forecasting Procedure
+Version: 0.1
+Date: 2017-01-26
+Authors@R: c(
+  person("Sean", "Taylor", email = "sjt@fb.com", role = c("cre", "aut")),
+  person("Ben", "Letham", email = "bletham@fb.com", role = "aut")
+  )
+Description: Implements a procedure for forecasting time series data based on
+  an additive model where non-linear trends are fit with yearly and weekly
+  seasonality, plus holidays.  It works best with daily periodicity data with
+  at least one year of historical data.  Prophet is robust to missing data,
+  shifts in the trend, and large outliers.
+Depends:
+    R (>= 3.2.3),
+    Rcpp (>= 0.12.0)
+Imports:
+    dplyr (>= 0.5.0),
+    extraDistr,
+    ggplot2,
+    grid,
+    rstan,
+    scales,
+    stats,
+    tidyr,
+    utils,
+    zoo
+Suggests:
+    knitr,
+    testthat,
+    readr
+License: BSD_3_clause + file LICENSE
+LazyData: true
+RoxygenNote: 5.0.1
+VignetteBuilder: knitr

+ 3 - 0
R/LICENSE

@@ -0,0 +1,3 @@
+YEAR: 2017-present
+COPYRIGHT HOLDER: Facebook, Inc.
+ORGANIZATION: Facebook

+ 10 - 0
R/NAMESPACE

@@ -0,0 +1,10 @@
+# Generated by roxygen2: do not edit by hand
+
+S3method(plot,prophet)
+S3method(predict,prophet)
+export(fit.prophet)
+export(make_future_dataframe)
+export(prophet)
+export(prophet_plot_components)
+import(Rcpp)
+importFrom(dplyr,"%>%")

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1025 - 0
R/R/prophet.R


+ 19 - 0
R/man/compile_stan_model.Rd

@@ -0,0 +1,19 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{compile_stan_model}
+\alias{compile_stan_model}
+\title{Compile Stan model}
+\usage{
+compile_stan_model(model)
+}
+\arguments{
+\item{model}{String 'linear' or 'logistic' to specify a linear or logistic
+trend.}
+}
+\value{
+Stan model.
+}
+\description{
+Compile Stan model
+}
+

+ 17 - 0
R/man/df_for_plotting.Rd

@@ -0,0 +1,17 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{df_for_plotting}
+\alias{df_for_plotting}
+\title{Merge history and forecast for plotting.}
+\usage{
+df_for_plotting(m, fcst)
+}
+\arguments{
+\item{m}{Prophet object.}
+
+\item{fcst}{Data frame returned by prophet predict.}
+}
+\description{
+Merge history and forecast for plotting.
+}
+

+ 17 - 0
R/man/fit.prophet.Rd

@@ -0,0 +1,17 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{fit.prophet}
+\alias{fit.prophet}
+\title{Fit the prophet model.}
+\usage{
+fit.prophet(m, df)
+}
+\arguments{
+\item{m}{Prophet object.}
+
+\item{df}{Data frame.}
+}
+\description{
+Fit the prophet model.
+}
+

+ 22 - 0
R/man/fourier_series.Rd

@@ -0,0 +1,22 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{fourier_series}
+\alias{fourier_series}
+\title{Provides fourier series components with the specified frequency.}
+\usage{
+fourier_series(dates, period, series.order)
+}
+\arguments{
+\item{dates}{Vector of dates.}
+
+\item{period}{Number of days of the period.}
+
+\item{series.order}{Number of components.}
+}
+\value{
+Matrix with seasonality features.
+}
+\description{
+Provides fourier series components with the specified frequency.
+}
+

+ 18 - 0
R/man/get_changepoint_indexes.Rd

@@ -0,0 +1,18 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{get_changepoint_indexes}
+\alias{get_changepoint_indexes}
+\title{Gets changepoint indexes in history dataframe.}
+\usage{
+get_changepoint_indexes(m)
+}
+\arguments{
+\item{m}{Prophet object.}
+}
+\value{
+array of indexes.
+}
+\description{
+Gets changepoint indexes in history dataframe.
+}
+

+ 18 - 0
R/man/get_changepoint_matrix.Rd

@@ -0,0 +1,18 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{get_changepoint_matrix}
+\alias{get_changepoint_matrix}
+\title{Gets changepoint matrix for history dataframe.}
+\usage{
+get_changepoint_matrix(m)
+}
+\arguments{
+\item{m}{Prophet object.}
+}
+\value{
+array of indexes.
+}
+\description{
+Gets changepoint matrix for history dataframe.
+}
+

+ 18 - 0
R/man/get_changepoint_times.Rd

@@ -0,0 +1,18 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{get_changepoint_times}
+\alias{get_changepoint_times}
+\title{Gets changepoint times, in scaled space.}
+\usage{
+get_changepoint_times(m)
+}
+\arguments{
+\item{m}{Prophet object.}
+}
+\value{
+array of times.
+}
+\description{
+Gets changepoint times, in scaled space.
+}
+

+ 19 - 0
R/man/get_prophet_stan_model.Rd

@@ -0,0 +1,19 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{get_prophet_stan_model}
+\alias{get_prophet_stan_model}
+\title{Load compiled Stan model}
+\usage{
+get_prophet_stan_model(model)
+}
+\arguments{
+\item{model}{String 'linear' or 'logistic' to specify a linear or logistic
+trend.}
+}
+\value{
+Stan model.
+}
+\description{
+Load compiled Stan model
+}
+

+ 22 - 0
R/man/linear_growth_init.Rd

@@ -0,0 +1,22 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{linear_growth_init}
+\alias{linear_growth_init}
+\title{Initialize linear growth}
+\usage{
+linear_growth_init(df)
+}
+\arguments{
+\item{df}{Data frame with columns ds (date), cap_scaled (scaled capacity),
+y_scaled (scaled time series), and t (scaled time).}
+}
+\value{
+A vector (k, m) with the rate (k) and offset (m) of the linear
+ growth function.
+}
+\description{
+Provides a strong initialization for linear growth by calculating the
+growth and offset parameters that pass the function through the first and
+last points in the time series.
+}
+

+ 22 - 0
R/man/logistic_growth_init.Rd

@@ -0,0 +1,22 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{logistic_growth_init}
+\alias{logistic_growth_init}
+\title{Initialize logistic growth}
+\usage{
+logistic_growth_init(df)
+}
+\arguments{
+\item{df}{Data frame with columns ds (date), cap_scaled (scaled capacity),
+y_scaled (scaled time series), and t (scaled time).}
+}
+\value{
+A vector (k, m) with the rate (k) and offset (m) of the logistic
+ growth function.
+}
+\description{
+Provides a strong initialization for logistic growth by calculating the
+growth and offset parameters that pass the function through the first and
+last points in the time series.
+}
+

+ 20 - 0
R/man/make_all_seasonality_features.Rd

@@ -0,0 +1,20 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{make_all_seasonality_features}
+\alias{make_all_seasonality_features}
+\title{Data frame seasonality features.}
+\usage{
+make_all_seasonality_features(m, df)
+}
+\arguments{
+\item{m}{Prophet object.}
+
+\item{df}{Dataframe with dates for computing seasonality features.}
+}
+\value{
+Dataframe with seasonality.
+}
+\description{
+Data frame seasonality features.
+}
+

+ 26 - 0
R/man/make_future_dataframe.Rd

@@ -0,0 +1,26 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{make_future_dataframe}
+\alias{make_future_dataframe}
+\title{Make dataframe with future dates for forecasting.}
+\usage{
+make_future_dataframe(m, periods, freq = "d", include_history = TRUE)
+}
+\arguments{
+\item{m}{Prophet model object.}
+
+\item{periods}{Int number of periods to forecast forward.}
+
+\item{freq}{'day', 'week', 'month', 'quarter', or 'year'.}
+
+\item{include_history}{Boolean to include the historical dates in the data
+frame for predictions.}
+}
+\value{
+Dataframe that extends forward from the end of m$history for the
+ requested number of periods.
+}
+\description{
+Make dataframe with future dates for forecasting.
+}
+

+ 20 - 0
R/man/make_holiday_features.Rd

@@ -0,0 +1,20 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{make_holiday_features}
+\alias{make_holiday_features}
+\title{Construct a matrix of holiday features.}
+\usage{
+make_holiday_features(m, dates)
+}
+\arguments{
+\item{m}{Prophet object.}
+
+\item{dates}{Vector with dates used for computing seasonality.}
+}
+\value{
+A dataframe with a column for each holiday
+}
+\description{
+Construct a matrix of holiday features.
+}
+

+ 24 - 0
R/man/make_seasonality_features.Rd

@@ -0,0 +1,24 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{make_seasonality_features}
+\alias{make_seasonality_features}
+\title{Data frame with seasonality features.}
+\usage{
+make_seasonality_features(dates, period, series.order, prefix)
+}
+\arguments{
+\item{dates}{Vector of dates.}
+
+\item{period}{Number of days of the period.}
+
+\item{series.order}{Number of components.}
+
+\item{prefix}{Column name prefix}
+}
+\value{
+Dataframe with seasonality.
+}
+\description{
+Data frame with seasonality features.
+}
+

+ 26 - 0
R/man/piecewise_linear.Rd

@@ -0,0 +1,26 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{piecewise_linear}
+\alias{piecewise_linear}
+\title{Evaluate the piecewise linear function.}
+\usage{
+piecewise_linear(t, deltas, k, m, changepoint.ts)
+}
+\arguments{
+\item{t}{Vector of times on which the function is evaluated.}
+
+\item{deltas}{Vector of rate changes at each changepoint.}
+
+\item{k}{Float initial rate.}
+
+\item{m}{Float initial offset.}
+
+\item{changepoint.ts}{Vector of changepoint times.}
+}
+\value{
+Vector y(t).
+}
+\description{
+Evaluate the piecewise linear function.
+}
+

+ 28 - 0
R/man/piecewise_logistic.Rd

@@ -0,0 +1,28 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{piecewise_logistic}
+\alias{piecewise_logistic}
+\title{Evaluate the piecewise logistic function.}
+\usage{
+piecewise_logistic(t, cap, deltas, k, m, changepoint.ts)
+}
+\arguments{
+\item{t}{Vector of times on which the function is evaluated.}
+
+\item{cap}{Vector of capacities at each t.}
+
+\item{deltas}{Vector of rate changes at each changepoint.}
+
+\item{k}{Float initial rate.}
+
+\item{m}{Float initial offset.}
+
+\item{changepoint.ts}{Vector of changepoint times.}
+}
+\value{
+Vector y(t).
+}
+\description{
+Evaluate the piecewise logistic function.
+}
+

+ 36 - 0
R/man/plot.prophet.Rd

@@ -0,0 +1,36 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{plot.prophet}
+\alias{plot.prophet}
+\title{Plot the prophet forecast.}
+\usage{
+\method{plot}{prophet}(x, fcst, uncertainty = TRUE, ...)
+}
+\arguments{
+\item{x}{Prophet object.}
+
+\item{fcst}{Data frame returned by predict(m, df).}
+
+\item{uncertainty}{Boolean indicating if the uncertainty interval for yhat
+should be plotted. Must be present in fcst as yhat_lower and yhat_upper.}
+
+\item{...}{additional arguments}
+}
+\value{
+A ggplot2 plot.
+}
+\description{
+Plot the prophet forecast.
+}
+\examples{
+\dontrun{
+history <- data.frame(ds = seq(as.Date('2015-01-01'), as.Date('2016-01-01'), by = 'd'),
+                      y = sin(1:366/200) + rnorm(366)/10)
+m <- prophet(history)
+future <- make_future_dataframe(m, periods = 365)
+forecast <- predict(m, future)
+plot(m, forecast)
+}
+
+}
+

+ 34 - 0
R/man/predict.prophet.Rd

@@ -0,0 +1,34 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{predict.prophet}
+\alias{predict.prophet}
+\title{Predict using the prophet model.}
+\usage{
+\method{predict}{prophet}(object, df = NULL, ...)
+}
+\arguments{
+\item{object}{Prophet object.}
+
+\item{df}{Dataframe with dates for predictions, and capacity if logistic
+growth. If not provided, predictions are made on the history.}
+
+\item{...}{additional arguments}
+}
+\value{
+A data_frame with a forecast
+}
+\description{
+Predict using the prophet model.
+}
+\examples{
+\dontrun{
+history <- data.frame(ds = seq(as.Date('2015-01-01'), as.Date('2016-01-01'), by = 'd'),
+                      y = sin(1:366/200) + rnorm(366)/10)
+m <- prophet(history)
+future <- make_future_dataframe(m, periods = 365)
+forecast <- predict(m, future)
+plot(m, forecast)
+}
+
+}
+

+ 17 - 0
R/man/predict_seasonal_components.Rd

@@ -0,0 +1,17 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{predict_seasonal_components}
+\alias{predict_seasonal_components}
+\title{Seasonality broken down into components}
+\usage{
+predict_seasonal_components(m, df)
+}
+\arguments{
+\item{m}{Prophet object.}
+
+\item{df}{Data frame.}
+}
+\description{
+Seasonality broken down into components
+}
+

+ 17 - 0
R/man/predict_trend.Rd

@@ -0,0 +1,17 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{predict_trend}
+\alias{predict_trend}
+\title{Predict trend using the prophet model.}
+\usage{
+predict_trend(model, df)
+}
+\arguments{
+\item{model}{Prophet object.}
+
+\item{df}{Data frame.}
+}
+\description{
+Predict trend using the prophet model.
+}
+

+ 17 - 0
R/man/predict_uncertainty.Rd

@@ -0,0 +1,17 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{predict_uncertainty}
+\alias{predict_uncertainty}
+\title{Prophet uncertainty intervals.}
+\usage{
+predict_uncertainty(m, df)
+}
+\arguments{
+\item{m}{Prophet object.}
+
+\item{df}{Data frame.}
+}
+\description{
+Prophet uncertainty intervals.
+}
+

+ 79 - 0
R/man/prophet.Rd

@@ -0,0 +1,79 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{prophet}
+\alias{prophet}
+\title{Prophet forecast.}
+\usage{
+prophet(df = df, growth = "linear", changepoints = NULL,
+  n.changepoints = 25, yearly.seasonality = TRUE,
+  weekly.seasonality = TRUE, holidays = NULL,
+  seasonality.prior.scale = 10, changepoint.prior.scale = 0.05,
+  holidays.prior.scale = 10, mcmc.samples = 0, interval.width = 0.8,
+  uncertainty.samples = 1000, fit = TRUE)
+}
+\arguments{
+\item{df}{Data frame with columns ds (date type) and y, the time series.
+If growth is logistic, then df must also have a column cap that specifies
+the capacity at each ds.}
+
+\item{growth}{String 'linear' or 'logistic' to specify a linear or logistic
+trend.}
+
+\item{changepoints}{Vector of dates at which to include potential
+changepoints. Each date must be present in df$ds. If not specified,
+potential changepoints are selected automatically.}
+
+\item{n.changepoints}{Number of potential changepoints to include. Not used
+if input `changepoints` is supplied. If `changepoints` is not supplied,
+then n.changepoints potential changepoints are selected uniformly from the
+first 80 percent of df$ds.}
+
+\item{yearly.seasonality}{Boolean, fit yearly seasonality.}
+
+\item{weekly.seasonality}{Boolean, fit weekly seasonality.}
+
+\item{holidays}{data frame with columns holiday (character) and ds (date
+type)and optionally columns lower_window and upper_window which specify a
+range of days around the date to be included as holidays.}
+
+\item{seasonality.prior.scale}{Parameter modulating the strength of the
+seasonality model. Larger values allow the model to fit larger seasonal
+fluctuations, smaller values dampen the seasonality.}
+
+\item{changepoint.prior.scale}{Parameter modulating the flexibility of the
+automatic changepoint selection. Large values will allow many changepoints,
+small values will allow few changepoints.}
+
+\item{holidays.prior.scale}{Parameter modulating the strength of the holiday
+components model.}
+
+\item{mcmc.samples}{Integer, if great than 0, will do full Bayesian
+inference with the specified number of MCMC samples. If 0, will do MAP
+estimation.}
+
+\item{interval.width}{Numeric, width of the uncertainty intervals provided
+for the forecast. If mcmc.samples=0, this will be only the uncertainty
+in the trend using the MAP estimate of the extrapolated generative model.
+If mcmc.samples>0, this will be integrated over all model parameters,
+which will include uncertainty in seasonality.}
+
+\item{uncertainty.samples}{Number of simulated draws used to estimate
+uncertainty intervals.}
+
+\item{fit}{Boolean, if FALSE the model is initialized but not fit.}
+}
+\value{
+A prophet model.
+}
+\description{
+Prophet forecast.
+}
+\examples{
+\dontrun{
+history <- data.frame(ds = seq(as.Date('2015-01-01'), as.Date('2016-01-01'), by = 'd'),
+                      y = sin(1:366/200) + rnorm(366)/10)
+m <- prophet(history)
+}
+
+}
+

+ 24 - 0
R/man/prophet_plot_components.Rd

@@ -0,0 +1,24 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{prophet_plot_components}
+\alias{prophet_plot_components}
+\title{Plot the components of a prophet forecast.
+Prints a ggplot2 with panels for trend, weekly and yearly seasonalities if
+present, and holidays if present.}
+\usage{
+prophet_plot_components(m, fcst, uncertainty = TRUE)
+}
+\arguments{
+\item{m}{Prophet object.}
+
+\item{fcst}{Data frame returned by predict(m, df).}
+
+\item{uncertainty}{Boolean indicating if the uncertainty interval should be
+plotted for the trend, from fcst columns trend_lower and trend_upper.}
+}
+\description{
+Plot the components of a prophet forecast.
+Prints a ggplot2 with panels for trend, weekly and yearly seasonalities if
+present, and holidays if present.
+}
+

+ 24 - 0
R/man/sample_model.Rd

@@ -0,0 +1,24 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{sample_model}
+\alias{sample_model}
+\title{Simulate observations from the extrapolated generative model.}
+\usage{
+sample_model(m, df, seasonal.features, iteration)
+}
+\arguments{
+\item{m}{Prophet object.}
+
+\item{df}{Dataframe that was fit by Prophet.}
+
+\item{seasonal.features}{Data frame of seasonal features}
+
+\item{iteration}{Int sampling iteration ot use parameters from.}
+}
+\value{
+List of trend, seasonality, and yhat, each a vector like df$t.
+}
+\description{
+Simulate observations from the extrapolated generative model.
+}
+

+ 22 - 0
R/man/sample_predictive_trend.Rd

@@ -0,0 +1,22 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{sample_predictive_trend}
+\alias{sample_predictive_trend}
+\title{Simulate the trend using the extrapolated generative model.}
+\usage{
+sample_predictive_trend(model, df, iteration)
+}
+\arguments{
+\item{model}{Prophet object.}
+
+\item{df}{Dataframe that was fit by Prophet.}
+
+\item{iteration}{Int sampling iteration ot use parameters from.}
+}
+\value{
+Vector of simulated trend over df$t.
+}
+\description{
+Simulate the trend using the extrapolated generative model.
+}
+

+ 18 - 0
R/man/set_changepoints.Rd

@@ -0,0 +1,18 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{set_changepoints}
+\alias{set_changepoints}
+\title{Set changepoints}
+\usage{
+set_changepoints(m)
+}
+\arguments{
+\item{m}{Prophet object.}
+}
+\value{
+m with changepoints set.
+}
+\description{
+Sets m$changepoints to the dates of changepoints.
+}
+

+ 22 - 0
R/man/setup_dataframe.Rd

@@ -0,0 +1,22 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{setup_dataframe}
+\alias{setup_dataframe}
+\title{Prepare dataframe for fitting or predicting.}
+\usage{
+setup_dataframe(m, df, initialize_scales = FALSE)
+}
+\arguments{
+\item{m}{Prophet object.}
+
+\item{df}{Data frame with columns ds, y, and cap if logistic growth.}
+
+\item{initialize_scales}{Boolean set scaling factors in m from df.}
+}
+\value{
+list with items 'df' and 'm'.
+}
+\description{
+Adds a time index and scales y.
+}
+

+ 15 - 0
R/man/validate_inputs.Rd

@@ -0,0 +1,15 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/prophet.R
+\name{validate_inputs}
+\alias{validate_inputs}
+\title{Validates the inputs to Prophet.}
+\usage{
+validate_inputs(m)
+}
+\arguments{
+\item{m}{Prophet object.}
+}
+\description{
+Validates the inputs to Prophet.
+}
+

+ 1 - 0
R/src/Makevars

@@ -0,0 +1 @@
+

+ 1 - 0
R/src/Makevars.win

@@ -0,0 +1 @@
+

+ 26 - 0
R/src/install.libs.R

@@ -0,0 +1,26 @@
+
+
+packageStartupMessage('Compiling models (this will take a minute...)')
+
+dest <- file.path(R_PACKAGE_DIR, paste0('libs', R_ARCH))
+dir.create(dest, recursive = TRUE, showWarnings = FALSE)
+
+packageStartupMessage(paste('Writing models to:', dest))
+packageStartupMessage(paste('Compiling using binary:', R.home('bin')))
+
+logistic.growth.src <- file.path(R_PACKAGE_SOURCE, 'inst', 'stan', 'prophet_logistic_growth.stan')
+logistic.growth.binary <- file.path(dest, 'prophet_logistic_growth.RData')
+logistic.growth.stanc <- rstan::stanc(logistic.growth.src)
+logistic.growth.stanm <- rstan::stan_model(stanc_ret = logistic.growth.stanc,
+                                           model_name = 'logistic_growth')
+save('logistic.growth.stanm', file = logistic.growth.binary)
+
+linear.growth.src <- file.path(R_PACKAGE_SOURCE, 'inst', 'stan', 'prophet_linear_growth.stan')
+linear.growth.binary <- file.path(dest, 'prophet_linear_growth.RData')
+linear.growth.stanc <- rstan::stanc(linear.growth.src)
+linear.growth.stanm <- rstan::stan_model(stanc_ret = linear.growth.stanc,
+                                         model_name = 'linear_growth')
+save('linear.growth.stanm', file = linear.growth.binary)
+
+packageStartupMessage('------ Models successfully compiled!')
+packageStartupMessage('You can ignore any compiler warnings above.')

+ 5 - 0
R/tests/testthat.R

@@ -0,0 +1,5 @@
+Sys.setenv("R_TESTS" = "")
+library(testthat)
+library(prophet)
+
+test_check("prophet")

+ 469 - 0
R/tests/testthat/data.csv

@@ -0,0 +1,469 @@
+ds,y
+2012-05-18,38.23
+2012-05-21,34.03
+2012-05-22,31.0
+2012-05-23,32.0
+2012-05-24,33.03
+2012-05-25,31.91
+2012-05-29,28.84
+2012-05-30,28.19
+2012-05-31,29.6
+2012-06-01,27.72
+2012-06-04,26.9
+2012-06-05,25.87
+2012-06-06,26.81
+2012-06-07,26.31
+2012-06-08,27.1
+2012-06-11,27.01
+2012-06-12,27.4
+2012-06-13,27.27
+2012-06-14,28.29
+2012-06-15,30.01
+2012-06-18,31.41
+2012-06-19,31.91
+2012-06-20,31.6
+2012-06-21,31.84
+2012-06-22,33.05
+2012-06-25,32.06
+2012-06-26,33.1
+2012-06-27,32.23
+2012-06-28,31.36
+2012-06-29,31.1
+2012-07-02,30.77
+2012-07-03,31.2
+2012-07-05,31.47
+2012-07-06,31.73
+2012-07-09,32.17
+2012-07-10,31.47
+2012-07-11,30.97
+2012-07-12,30.81
+2012-07-13,30.72
+2012-07-16,28.25
+2012-07-17,28.09
+2012-07-18,29.11
+2012-07-19,29.0
+2012-07-20,28.76
+2012-07-23,28.75
+2012-07-24,28.45
+2012-07-25,29.34
+2012-07-26,26.85
+2012-07-27,23.71
+2012-07-30,23.15
+2012-07-31,21.71
+2012-08-01,20.88
+2012-08-02,20.04
+2012-08-03,21.09
+2012-08-06,21.92
+2012-08-07,20.72
+2012-08-08,20.72
+2012-08-09,21.01
+2012-08-10,21.81
+2012-08-13,21.6
+2012-08-14,20.38
+2012-08-15,21.2
+2012-08-16,19.87
+2012-08-17,19.05
+2012-08-20,20.01
+2012-08-21,19.16
+2012-08-22,19.44
+2012-08-23,19.44
+2012-08-24,19.41
+2012-08-27,19.15
+2012-08-28,19.34
+2012-08-29,19.1
+2012-08-30,19.09
+2012-08-31,18.06
+2012-09-04,17.73
+2012-09-05,18.58
+2012-09-06,18.96
+2012-09-07,18.98
+2012-09-10,18.81
+2012-09-11,19.43
+2012-09-12,20.93
+2012-09-13,20.71
+2012-09-14,22.0
+2012-09-17,21.52
+2012-09-18,21.87
+2012-09-19,23.29
+2012-09-20,22.59
+2012-09-21,22.86
+2012-09-24,20.79
+2012-09-25,20.28
+2012-09-26,20.62
+2012-09-27,20.32
+2012-09-28,21.66
+2012-10-01,21.99
+2012-10-02,22.27
+2012-10-03,21.83
+2012-10-04,21.95
+2012-10-05,20.91
+2012-10-08,20.4
+2012-10-09,20.23
+2012-10-10,19.64
+2012-10-11,19.75
+2012-10-12,19.52
+2012-10-15,19.52
+2012-10-16,19.48
+2012-10-17,19.88
+2012-10-18,18.98
+2012-10-19,19.0
+2012-10-22,19.32
+2012-10-23,19.5
+2012-10-24,23.23
+2012-10-25,22.56
+2012-10-26,21.94
+2012-10-31,21.11
+2012-11-01,21.21
+2012-11-02,21.18
+2012-11-05,21.25
+2012-11-06,21.17
+2012-11-07,20.47
+2012-11-08,19.99
+2012-11-09,19.21
+2012-11-12,20.07
+2012-11-13,19.86
+2012-11-14,22.36
+2012-11-15,22.17
+2012-11-16,23.56
+2012-11-19,22.92
+2012-11-20,23.1
+2012-11-21,24.32
+2012-11-23,24.0
+2012-11-26,25.94
+2012-11-27,26.15
+2012-11-28,26.36
+2012-11-29,27.32
+2012-11-30,28.0
+2012-12-03,27.04
+2012-12-04,27.46
+2012-12-05,27.71
+2012-12-06,26.97
+2012-12-07,27.49
+2012-12-10,27.84
+2012-12-11,27.98
+2012-12-12,27.58
+2012-12-13,28.24
+2012-12-14,26.81
+2012-12-17,26.75
+2012-12-18,27.71
+2012-12-19,27.41
+2012-12-20,27.36
+2012-12-21,26.26
+2012-12-24,26.93
+2012-12-26,26.51
+2012-12-27,26.05
+2012-12-28,25.91
+2012-12-31,26.62
+2013-01-02,28.0
+2013-01-03,27.77
+2013-01-04,28.76
+2013-01-07,29.42
+2013-01-08,29.06
+2013-01-09,30.59
+2013-01-10,31.3
+2013-01-11,31.72
+2013-01-14,30.95
+2013-01-15,30.1
+2013-01-16,29.85
+2013-01-17,30.14
+2013-01-18,29.66
+2013-01-22,30.73
+2013-01-23,30.82
+2013-01-24,31.08
+2013-01-25,31.54
+2013-01-28,32.47
+2013-01-29,30.79
+2013-01-30,31.24
+2013-01-31,30.98
+2013-02-01,29.73
+2013-02-04,28.11
+2013-02-05,28.64
+2013-02-06,29.05
+2013-02-07,28.65
+2013-02-08,28.55
+2013-02-11,28.26
+2013-02-12,27.37
+2013-02-13,27.91
+2013-02-14,28.5
+2013-02-15,28.32
+2013-02-19,28.93
+2013-02-20,28.46
+2013-02-21,27.28
+2013-02-22,27.13
+2013-02-25,27.27
+2013-02-26,27.39
+2013-02-27,26.87
+2013-02-28,27.25
+2013-03-01,27.78
+2013-03-04,27.72
+2013-03-05,27.52
+2013-03-06,27.45
+2013-03-07,28.58
+2013-03-08,27.96
+2013-03-11,28.14
+2013-03-12,27.83
+2013-03-13,27.08
+2013-03-14,27.04
+2013-03-15,26.65
+2013-03-18,26.49
+2013-03-19,26.55
+2013-03-20,25.86
+2013-03-21,25.74
+2013-03-22,25.73
+2013-03-25,25.13
+2013-03-26,25.21
+2013-03-27,26.09
+2013-03-28,25.58
+2013-04-01,25.53
+2013-04-02,25.42
+2013-04-03,26.25
+2013-04-04,27.07
+2013-04-05,27.39
+2013-04-08,26.85
+2013-04-09,26.59
+2013-04-10,27.57
+2013-04-11,28.02
+2013-04-12,27.4
+2013-04-15,26.52
+2013-04-16,26.92
+2013-04-17,26.63
+2013-04-18,25.69
+2013-04-19,25.73
+2013-04-22,25.97
+2013-04-23,25.98
+2013-04-24,26.11
+2013-04-25,26.14
+2013-04-26,26.85
+2013-04-29,26.98
+2013-04-30,27.77
+2013-05-01,27.43
+2013-05-02,28.97
+2013-05-03,28.31
+2013-05-06,27.57
+2013-05-07,26.89
+2013-05-08,27.12
+2013-05-09,27.04
+2013-05-10,26.68
+2013-05-13,26.82
+2013-05-14,27.07
+2013-05-15,26.6
+2013-05-16,26.13
+2013-05-17,26.25
+2013-05-20,25.76
+2013-05-21,25.66
+2013-05-22,25.16
+2013-05-23,25.06
+2013-05-24,24.31
+2013-05-28,24.1
+2013-05-29,23.32
+2013-05-30,24.55
+2013-05-31,24.35
+2013-06-03,23.85
+2013-06-04,23.52
+2013-06-05,22.9
+2013-06-06,22.97
+2013-06-07,23.29
+2013-06-10,24.33
+2013-06-11,24.03
+2013-06-12,23.77
+2013-06-13,23.73
+2013-06-14,23.63
+2013-06-17,24.02
+2013-06-18,24.21
+2013-06-19,24.31
+2013-06-20,23.9
+2013-06-21,24.53
+2013-06-24,23.94
+2013-06-25,24.25
+2013-06-26,24.16
+2013-06-27,24.66
+2013-06-28,24.88
+2013-07-01,24.81
+2013-07-02,24.41
+2013-07-03,24.52
+2013-07-05,24.37
+2013-07-08,24.71
+2013-07-09,25.48
+2013-07-10,25.8
+2013-07-11,25.81
+2013-07-12,25.91
+2013-07-15,26.28
+2013-07-16,26.32
+2013-07-17,26.65
+2013-07-18,26.18
+2013-07-19,25.88
+2013-07-22,26.05
+2013-07-23,26.13
+2013-07-24,26.51
+2013-07-25,34.36
+2013-07-26,34.01
+2013-07-29,35.43
+2013-07-30,37.63
+2013-07-31,36.8
+2013-08-01,37.49
+2013-08-02,38.05
+2013-08-05,39.19
+2013-08-06,38.55
+2013-08-07,38.87
+2013-08-08,38.54
+2013-08-09,38.5
+2013-08-12,38.22
+2013-08-13,37.02
+2013-08-14,36.65
+2013-08-15,36.56
+2013-08-16,37.08
+2013-08-19,37.81
+2013-08-20,38.41
+2013-08-21,38.32
+2013-08-22,38.55
+2013-08-23,40.55
+2013-08-26,41.34
+2013-08-27,39.64
+2013-08-28,40.55
+2013-08-29,41.28
+2013-08-30,41.29
+2013-09-03,41.87
+2013-09-04,41.78
+2013-09-05,42.66
+2013-09-06,43.95
+2013-09-09,44.04
+2013-09-10,43.6
+2013-09-11,45.04
+2013-09-12,44.75
+2013-09-13,44.31
+2013-09-16,42.51
+2013-09-17,45.07
+2013-09-18,45.23
+2013-09-19,45.98
+2013-09-20,47.49
+2013-09-23,47.19
+2013-09-24,48.45
+2013-09-25,49.46
+2013-09-26,50.39
+2013-09-27,51.24
+2013-09-30,50.23
+2013-10-01,50.42
+2013-10-02,50.28
+2013-10-03,49.18
+2013-10-04,51.04
+2013-10-07,50.52
+2013-10-08,47.14
+2013-10-09,46.77
+2013-10-10,49.05
+2013-10-11,49.11
+2013-10-14,49.51
+2013-10-15,49.5
+2013-10-16,51.14
+2013-10-17,52.21
+2013-10-18,54.22
+2013-10-21,53.85
+2013-10-22,52.68
+2013-10-23,51.9
+2013-10-24,52.45
+2013-10-25,51.95
+2013-10-28,50.23
+2013-10-29,49.4
+2013-10-30,49.01
+2013-10-31,50.21
+2013-11-01,49.75
+2013-11-04,48.22
+2013-11-05,50.11
+2013-11-06,49.12
+2013-11-07,47.56
+2013-11-08,47.53
+2013-11-11,46.2
+2013-11-12,46.61
+2013-11-13,48.71
+2013-11-14,48.99
+2013-11-15,49.01
+2013-11-18,45.83
+2013-11-19,46.36
+2013-11-20,46.43
+2013-11-21,46.7
+2013-11-22,46.23
+2013-11-25,44.82
+2013-11-26,45.89
+2013-11-27,46.49
+2013-11-29,47.01
+2013-12-02,47.06
+2013-12-03,46.73
+2013-12-04,48.62
+2013-12-05,48.34
+2013-12-06,47.94
+2013-12-09,48.84
+2013-12-10,50.25
+2013-12-11,49.38
+2013-12-12,51.83
+2013-12-13,53.32
+2013-12-16,53.81
+2013-12-17,54.86
+2013-12-18,55.57
+2013-12-19,55.05
+2013-12-20,55.12
+2013-12-23,57.77
+2013-12-24,57.96
+2013-12-26,57.73
+2013-12-27,55.44
+2013-12-30,53.71
+2013-12-31,54.65
+2014-01-02,54.71
+2014-01-03,54.56
+2014-01-06,57.2
+2014-01-07,57.92
+2014-01-08,58.23
+2014-01-09,57.22
+2014-01-10,57.94
+2014-01-13,55.91
+2014-01-14,57.74
+2014-01-15,57.6
+2014-01-16,57.19
+2014-01-17,56.3
+2014-01-21,58.51
+2014-01-22,57.51
+2014-01-23,56.63
+2014-01-24,54.45
+2014-01-27,53.55
+2014-01-28,55.14
+2014-01-29,53.53
+2014-01-30,61.08
+2014-01-31,62.57
+2014-02-03,61.48
+2014-02-04,62.75
+2014-02-05,62.19
+2014-02-06,62.16
+2014-02-07,64.32
+2014-02-10,63.55
+2014-02-11,64.85
+2014-02-12,64.45
+2014-02-13,67.33
+2014-02-14,67.09
+2014-02-18,67.3
+2014-02-19,68.06
+2014-02-20,69.63
+2014-02-21,68.59
+2014-02-24,70.78
+2014-02-25,69.85
+2014-02-26,69.26
+2014-02-27,68.94
+2014-02-28,68.46
+2014-03-03,67.41
+2014-03-04,68.8
+2014-03-05,71.57
+2014-03-06,70.84
+2014-03-07,69.8
+2014-03-10,72.03
+2014-03-11,70.1
+2014-03-12,70.88
+2014-03-13,68.83
+2014-03-14,67.72
+2014-03-17,68.74
+2014-03-18,69.19
+2014-03-19,68.24
+2014-03-20,66.97
+2014-03-21,67.24
+2014-03-24,64.1
+2014-03-25,64.89
+2014-03-26,60.39
+2014-03-27,60.97
+2014-03-28,60.01
+2014-03-31,60.24

+ 189 - 0
R/tests/testthat/test_prophet.R

@@ -0,0 +1,189 @@
+library(prophet)
+context("Prophet tests")
+
+DATA <- read.csv('data.csv')
+DATA$ds <- as.Date(DATA$ds)
+N <- nrow(DATA)
+train <- DATA[1:floor(N / 2), ]
+future <- DATA[(ceiling(N/2) + 1):N, ]
+
+test_that("load_models", {
+  expect_error(prophet:::get_prophet_stan_model('linear'), NA)
+  expect_error(prophet:::get_prophet_stan_model('logistic'), NA)
+})
+
+test_that("fit_predict", {
+  skip_if_not(Sys.getenv('R_ARCH') != '/i386')
+  m <- prophet(train)
+  expect_error(predict(m, future), NA)
+})
+
+test_that("fit_predict_no_seasons", {
+  skip_if_not(Sys.getenv('R_ARCH') != '/i386')
+  m <- prophet(train, weekly.seasonality = FALSE, yearly.seasonality = FALSE)
+  expect_error(predict(m, future), NA)
+})
+
+test_that("fit_predict_no_changepoints", {
+  skip_if_not(Sys.getenv('R_ARCH') != '/i386')
+  m <- prophet(train, n.changepoints = 0)
+  expect_error(predict(m, future), NA)
+})
+
+test_that("setup_dataframe", {
+  history <- train
+  m <- prophet(history, fit = FALSE)
+  
+  out <- prophet:::setup_dataframe(m, history, initialize_scales = TRUE)
+  history <- out$df
+
+  expect_true('t' %in% colnames(history))
+  expect_equal(min(history$t), 0)
+  expect_equal(max(history$t), 1)
+
+  expect_true('y_scaled' %in% colnames(history))
+  expect_equal(max(history$y_scaled), 1)
+})
+
+test_that("get_changepoints", {
+  history <- train
+  m <- prophet(history, fit = FALSE)
+
+  out <- prophet:::setup_dataframe(m, history, initialize_scales = TRUE)
+  history <- out$df
+  m <- out$m
+  m$history <- history
+
+  m <- prophet:::set_changepoints(m)
+
+  cp <- prophet:::get_changepoint_indexes(m)
+  expect_equal(length(cp), m$n.changepoints)
+  expect_true(min(cp) > 0)
+  expect_true(max(cp) < N)
+
+  mat <- prophet:::get_changepoint_matrix(m)
+  expect_equal(nrow(mat), floor(N / 2))
+  expect_equal(ncol(mat), m$n.changepoints)
+})
+
+test_that("get_zero_changepoints", {
+  history <- train
+  m <- prophet(history, n.changepoints = 0, fit = FALSE)
+  
+  out <- prophet:::setup_dataframe(m, history, initialize_scales = TRUE)
+  m <- out$m
+  history <- out$df
+  m$history <- history
+
+  m <- prophet:::set_changepoints(m)
+  cp <- prophet:::get_changepoint_indexes(m)
+  expect_equal(length(cp), 1)
+  expect_equal(cp[1], 1)
+
+  mat <- prophet:::get_changepoint_matrix(m)
+  expect_equal(nrow(mat), floor(N / 2))
+  expect_equal(ncol(mat), 1)
+})
+
+test_that("fourier_series_weekly", {
+  mat <- prophet:::fourier_series(DATA$ds, 7, 3)
+  true.values <- c(0.7818315, 0.6234898, 0.9749279, -0.2225209, 0.4338837,
+                   -0.9009689)
+  expect_equal(true.values, mat[1, ], tolerance = 1e-6)
+})
+
+test_that("fourier_series_yearly", {
+  mat <- prophet:::fourier_series(DATA$ds, 365.25, 3)
+  true.values <- c(0.7006152, -0.7135393, -0.9998330, 0.01827656, 0.7262249,
+                   0.6874572)
+  expect_equal(true.values, mat[1, ], tolerance = 1e-6)
+})
+
+test_that("growth_init", {
+  history <- DATA
+  history$cap <- max(history$y)
+  m <- prophet(history, growth = 'logistic', fit = FALSE)
+
+  out <- prophet:::setup_dataframe(m, history, initialize_scales = TRUE)
+  m <- out$m
+  history <- out$df
+
+  params <- prophet:::linear_growth_init(history)
+  expect_equal(params[1], 0.3055671, tolerance = 1e-6)
+  expect_equal(params[2], 0.5307511, tolerance = 1e-6)
+
+  params <- prophet:::logistic_growth_init(history)
+  
+  expect_equal(params[1], 1.507925, tolerance = 1e-6)
+  expect_equal(params[2], -0.08167497, tolerance = 1e-6)
+})
+
+test_that("piecewise_linear", {
+  t <- seq(0, 10)
+  m <- 0
+  k <- 1.0
+  deltas <- c(0.5)
+  changepoint.ts <- c(5)
+
+  y <- prophet:::piecewise_linear(t, deltas, k, m, changepoint.ts)
+  y.true <- c(0, 1, 2, 3, 4, 5, 6.5, 8, 9.5, 11, 12.5)
+  expect_equal(y, y.true)
+
+  t <- t[8:length(t)]
+  y.true <- y.true[8:length(y.true)]
+  y <- prophet:::piecewise_linear(t, deltas, k, m, changepoint.ts)
+  expect_equal(y, y.true)
+})
+
+test_that("piecewise_logistic", {
+  t <- seq(0, 10)
+  cap <- rep(10, 11)
+  m <- 0
+  k <- 1.0
+  deltas <- c(0.5)
+  changepoint.ts <- c(5)
+
+  y <- prophet:::piecewise_logistic(t, cap, deltas, k, m, changepoint.ts)
+  y.true <- c(5.000000, 7.310586, 8.807971, 9.525741, 9.820138, 9.933071,
+              9.984988, 9.996646, 9.999252, 9.999833, 9.999963)
+  expect_equal(y, y.true, tolerance = 1e-6)
+  
+  t <- t[8:length(t)]
+  y.true <- y.true[8:length(y.true)]
+  cap <- cap[8:length(cap)]
+  y <- prophet:::piecewise_logistic(t, cap, deltas, k, m, changepoint.ts)
+  expect_equal(y, y.true, tolerance = 1e-6)
+})
+
+test_that("holidays", {
+  holidays = data.frame(ds = zoo::as.Date(c('2016-12-25')),
+                        holiday = c('xmas'),
+                        lower_window = c(-1),
+                        upper_window = c(0))
+  df <- data.frame(
+    ds = seq(zoo::as.Date('2016-12-20'), zoo::as.Date('2016-12-31'), by='d'))
+  m <- prophet(train, holidays = holidays, fit = FALSE)
+  feats <- prophet:::make_holiday_features(m, df$ds)
+  expect_equal(nrow(feats), nrow(df))
+  expect_equal(ncol(feats), 2)
+  expect_equal(sum(colSums(feats) - c(1, 1)), 0)
+
+  holidays = data.frame(ds = zoo::as.Date(c('2016-12-25')),
+                        holiday = c('xmas'),
+                        lower_window = c(-1),
+                        upper_window = c(10))
+  m <- prophet(train, holidays = holidays, fit = FALSE)
+  feats <- prophet:::make_holiday_features(m, df$ds)
+  expect_equal(nrow(feats), nrow(df))
+  expect_equal(ncol(feats), 12)
+})
+
+test_that("fit_with_holidays", {
+  skip_if_not(Sys.getenv('R_ARCH') != '/i386')
+  holidays <- data.frame(ds = zoo::as.Date(c('2012-06-06', '2013-06-06')),
+                         holiday = c('seans-bday', 'seans-bday'),
+                         lower_window = c(0, 0),
+                         upper_window = c(1, 1))
+  m <- prophet(DATA, holidays = holidays, uncertainty.samples = 0)
+  expect_error(predict(m), NA)
+})

+ 57 - 0
R/vignettes/quick_start.Rmd

@@ -0,0 +1,57 @@
+---
+title: "Quick Start Guide to Using Prophet"
+author: "Sean J. Taylor and Ben Letham"
+date: "`r Sys.Date()`"
+output: rmarkdown::html_vignette
+vignette: >
+  %\VignetteIndexEntry{Quick Start Guide to Using Prophet}
+  %\VignetteEngine{knitr::rmarkdown}
+  \usepackage[utf8]{inputenc}
+---
+
+```{r, echo = FALSE, message = FALSE}
+knitr::opts_chunk$set(collapse = T, comment = "#>")
+options(tibble.print_min = 4L, tibble.print_max = 4L)
+library(prophet)
+library(dplyr)
+```
+
+
+Prophet uses the normal model fitting API.  We provide a `prophet` function that performs fitting and returns a model object.  You can then call `predict` and `plot` on this model object.
+
+First we read in the data and create the outcome variable.
+
+```{r, results= "hide"}
+library(readr)
+df <- read_csv('../tests/testthat/data.csv')
+```
+
+We call the `prophet` function to fit the model.  The first argument is the historical dataframe.  Additional arguments control how Prophet fits the data.
+
+```{r}
+m <- prophet(df)
+```
+We need to construct a dataframe for prediction.  The `make_future_dataframe` function takes the model object and a number of periods to forecast:
+
+```{r}
+future <- make_future_dataframe(m, periods = 365)
+head(future)
+```
+As with most modeling procedures in R, we use the generic `predict` function to get our forecast:
+
+```{r}
+forecast <- predict(m, future)
+head(forecast)
+```
+
+You can use the generic `plot` function to plot the forecast, but you must also pass the model in to be plotted:
+
+```{r}
+plot(m, forecast)
+```
+
+Just as in Python, you can plot the components of the forecast.  In R, you use the `prophet_plot_components` function instead of an instance method:
+
+```{r}
+prophet_plot_components(m, forecast)
+```

+ 48 - 0
README.md

@@ -0,0 +1,48 @@
+# Prophet: Automatic Forecasting Procedure
+
+Prophet is a procedure for forecasting time series data.  It is based on an additive model where non-linear trends are fit with yearly and weekly seasonality, plus holidays. It works best with daily periodicity data with at least one year of historical data. Prophet is robust to missing data, shifts in the trend, and large outliers.
+
+Prophet is [open source software](https://code.facebook.com/projects/) released by Facebook's [Core Data Science team](https://research.fb.com/category/data-science/).  It is available for download on [CRAN](https://cran.r-project.org/package=prophet) and [PyPI](https://pypi.python.org/pypi/fbprophet/).
+
+## Important links
+
+
+- Homepage: https://facebookincubator.github.io/prophet/
+- HTML documentation: https://facebookincubator.github.io/prophet/docs/quick_start.html
+- Issue tracker: https://github.com/facebookincubator/prophet/issues
+- Source code repository: https://github.com/facebookincubator/prophet
+- Prophet R package: https://cran.r-project.org/package=prophet
+- Prophet Python package: https://pypi.python.org/pypi/fbprophet/
+
+## Installation in R
+
+Prophet is a [CRAN package](https://cran.r-project.org/package=prophet) so you can use `install.packages`:
+
+```
+# R
+> install.packages('prophet')
+```
+
+After installation, you can [get started!](quick_start.html#r-api)
+
+### Windows
+
+On Windows, R requires a compiler so you'll need to [follow the instructions](https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Windows) provided by `rstan`.  The key step is installing [Rtools](http://cran.r-project.org/bin/windows/Rtools/) before attempting to install the package.
+
+## Installation in Python
+
+Prophet is on PyPI, so you can use pip to install it:
+
+```
+# bash
+$ pip install fbprophet
+```
+
+The major dependency that Prophet has is `pystan`.   PyStan has its own [installation instructions](http://pystan.readthedocs.io/en/latest/installation_beginner.html).
+
+After installation, you can [get started!](quick_start.html#python-api)
+
+### Windows
+
+On Windows, PyStan requires a compiler so you'll need to [follow the instructions](http://pystan.readthedocs.io/en/latest/windows.html).  The key step is installing a recent [C++ compiler](http://landinghub.visualstudio.com/visual-cpp-build-tools).
+

+ 9 - 0
docs/.gitignore

@@ -0,0 +1,9 @@
+.DS_STORE
+_site/
+*.swo
+*.swp
+_site
+.sass-cache
+*.psd
+*~
+.jekyll-metadata

+ 3 - 0
docs/Gemfile

@@ -0,0 +1,3 @@
+source 'https://rubygems.org'
+
+gem 'github-pages', '~> 104', group: :jekyll_plugins

+ 145 - 0
docs/Gemfile.lock

@@ -0,0 +1,145 @@
+GEM
+  remote: https://rubygems.org/
+  specs:
+    activesupport (4.2.7)
+      i18n (~> 0.7)
+      json (~> 1.7, >= 1.7.7)
+      minitest (~> 5.1)
+      thread_safe (~> 0.3, >= 0.3.4)
+      tzinfo (~> 1.1)
+    addressable (2.4.0)
+    coffee-script (2.4.1)
+      coffee-script-source
+      execjs
+    coffee-script-source (1.12.2)
+    colorator (1.1.0)
+    ethon (0.10.1)
+      ffi (>= 1.3.0)
+    execjs (2.7.0)
+    faraday (0.10.1)
+      multipart-post (>= 1.2, < 3)
+    ffi (1.9.14)
+    forwardable-extended (2.6.0)
+    gemoji (2.1.0)
+    github-pages (104)
+      activesupport (= 4.2.7)
+      github-pages-health-check (= 1.2.0)
+      jekyll (= 3.3.0)
+      jekyll-avatar (= 0.4.2)
+      jekyll-coffeescript (= 1.0.1)
+      jekyll-feed (= 0.8.0)
+      jekyll-gist (= 1.4.0)
+      jekyll-github-metadata (= 2.2.0)
+      jekyll-mentions (= 1.2.0)
+      jekyll-paginate (= 1.1.0)
+      jekyll-redirect-from (= 0.11.0)
+      jekyll-sass-converter (= 1.3.0)
+      jekyll-seo-tag (= 2.1.0)
+      jekyll-sitemap (= 0.12.0)
+      jekyll-swiss (= 0.4.0)
+      jemoji (= 0.7.0)
+      kramdown (= 1.11.1)
+      liquid (= 3.0.6)
+      listen (= 3.0.6)
+      mercenary (~> 0.3)
+      minima (= 2.0.0)
+      rouge (= 1.11.1)
+      terminal-table (~> 1.4)
+    github-pages-health-check (1.2.0)
+      addressable (~> 2.3)
+      net-dns (~> 0.8)
+      octokit (~> 4.0)
+      public_suffix (~> 1.4)
+      typhoeus (~> 0.7)
+    html-pipeline (2.4.2)
+      activesupport (>= 2)
+      nokogiri (>= 1.4)
+    i18n (0.7.0)
+    jekyll (3.3.0)
+      addressable (~> 2.4)
+      colorator (~> 1.0)
+      jekyll-sass-converter (~> 1.0)
+      jekyll-watch (~> 1.1)
+      kramdown (~> 1.3)
+      liquid (~> 3.0)
+      mercenary (~> 0.3.3)
+      pathutil (~> 0.9)
+      rouge (~> 1.7)
+      safe_yaml (~> 1.0)
+    jekyll-avatar (0.4.2)
+      jekyll (~> 3.0)
+    jekyll-coffeescript (1.0.1)
+      coffee-script (~> 2.2)
+    jekyll-feed (0.8.0)
+      jekyll (~> 3.3)
+    jekyll-gist (1.4.0)
+      octokit (~> 4.2)
+    jekyll-github-metadata (2.2.0)
+      jekyll (~> 3.1)
+      octokit (~> 4.0, != 4.4.0)
+    jekyll-mentions (1.2.0)
+      activesupport (~> 4.0)
+      html-pipeline (~> 2.3)
+      jekyll (~> 3.0)
+    jekyll-paginate (1.1.0)
+    jekyll-redirect-from (0.11.0)
+      jekyll (>= 2.0)
+    jekyll-sass-converter (1.3.0)
+      sass (~> 3.2)
+    jekyll-seo-tag (2.1.0)
+      jekyll (~> 3.3)
+    jekyll-sitemap (0.12.0)
+      jekyll (~> 3.3)
+    jekyll-swiss (0.4.0)
+    jekyll-watch (1.5.0)
+      listen (~> 3.0, < 3.1)
+    jemoji (0.7.0)
+      activesupport (~> 4.0)
+      gemoji (~> 2.0)
+      html-pipeline (~> 2.2)
+      jekyll (>= 3.0)
+    json (1.8.3)
+    kramdown (1.11.1)
+    liquid (3.0.6)
+    listen (3.0.6)
+      rb-fsevent (>= 0.9.3)
+      rb-inotify (>= 0.9.7)
+    mercenary (0.3.6)
+    mini_portile2 (2.1.0)
+    minima (2.0.0)
+    minitest (5.10.1)
+    multipart-post (2.0.0)
+    net-dns (0.8.0)
+    nokogiri (1.7.0.1)
+      mini_portile2 (~> 2.1.0)
+    octokit (4.6.2)
+      sawyer (~> 0.8.0, >= 0.5.3)
+    pathutil (0.14.0)
+      forwardable-extended (~> 2.6)
+    public_suffix (1.5.3)
+    rb-fsevent (0.9.8)
+    rb-inotify (0.9.7)
+      ffi (>= 0.5.0)
+    rouge (1.11.1)
+    safe_yaml (1.0.4)
+    sass (3.4.23)
+    sawyer (0.8.1)
+      addressable (>= 2.3.5, < 2.6)
+      faraday (~> 0.8, < 1.0)
+    terminal-table (1.7.3)
+      unicode-display_width (~> 1.1.1)
+    thread_safe (0.3.5)
+    typhoeus (0.8.0)
+      ethon (>= 0.8.0)
+    tzinfo (1.2.2)
+      thread_safe (~> 0.1)
+    unicode-display_width (1.1.2)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  github-pages (~> 104)
+
+BUNDLED WITH
+   1.13.1

+ 385 - 0
docs/LICENSE

@@ -0,0 +1,385 @@
+Attribution 4.0 International
+
+=======================================================================
+
+Creative Commons Corporation ("Creative Commons") is not a law firm and
+does not provide legal services or legal advice. Distribution of
+Creative Commons public licenses does not create a lawyer-client or
+other relationship. Creative Commons makes its licenses and related
+information available on an "as-is" basis. Creative Commons gives no
+warranties regarding its licenses, any material licensed under their
+terms and conditions, or any related information. Creative Commons
+disclaims all liability for damages resulting from their use to the
+fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and
+conditions that creators and other rights holders may use to share
+original works of authorship and other material subject to copyright
+and certain other rights specified in the public license below. The
+following considerations are for informational purposes only, are not
+exhaustive, and do not form part of our licenses.
+
+     Considerations for licensors: Our public licenses are
+     intended for use by those authorized to give the public
+     permission to use material in ways otherwise restricted by
+     copyright and certain other rights. Our licenses are
+     irrevocable. Licensors should read and understand the terms
+     and conditions of the license they choose before applying it.
+     Licensors should also secure all rights necessary before
+     applying our licenses so that the public can reuse the
+     material as expected. Licensors should clearly mark any
+     material not subject to the license. This includes other CC-
+     licensed material, or material used under an exception or
+     limitation to copyright. More considerations for licensors:
+  wiki.creativecommons.org/Considerations_for_licensors
+
+     Considerations for the public: By using one of our public
+     licenses, a licensor grants the public permission to use the
+     licensed material under specified terms and conditions. If
+     the licensor's permission is not necessary for any reason--for
+     example, because of any applicable exception or limitation to
+     copyright--then that use is not regulated by the license. Our
+     licenses grant only permissions under copyright and certain
+     other rights that a licensor has authority to grant. Use of
+     the licensed material may still be restricted for other
+     reasons, including because others have copyright or other
+     rights in the material. A licensor may make special requests,
+     such as asking that all changes be marked or described.
+     Although not required by our licenses, you are encouraged to
+     respect those requests where reasonable. More_considerations
+     for the public:
+  wiki.creativecommons.org/Considerations_for_licensees
+
+=======================================================================
+
+Creative Commons Attribution 4.0 International Public License
+
+By exercising the Licensed Rights (defined below), You accept and agree
+to be bound by the terms and conditions of this Creative Commons
+Attribution 4.0 International Public License ("Public License"). To the
+extent this Public License may be interpreted as a contract, You are
+granted the Licensed Rights in consideration of Your acceptance of
+these terms and conditions, and the Licensor grants You such rights in
+consideration of benefits the Licensor receives from making the
+Licensed Material available under these terms and conditions.
+
+Section 1 -- Definitions.
+
+  a. Adapted Material means material subject to Copyright and Similar
+     Rights that is derived from or based upon the Licensed Material
+     and in which the Licensed Material is translated, altered,
+     arranged, transformed, or otherwise modified in a manner requiring
+     permission under the Copyright and Similar Rights held by the
+     Licensor. For purposes of this Public License, where the Licensed
+     Material is a musical work, performance, or sound recording,
+     Adapted Material is always produced where the Licensed Material is
+     synched in timed relation with a moving image.
+
+b. Adapter's License means the license You apply to Your Copyright
+   and Similar Rights in Your contributions to Adapted Material in
+   accordance with the terms and conditions of this Public License.
+
+c. Copyright and Similar Rights means copyright and/or similar rights
+   closely related to copyright including, without limitation,
+   performance, broadcast, sound recording, and Sui Generis Database
+   Rights, without regard to how the rights are labeled or
+   categorized. For purposes of this Public License, the rights
+   specified in Section 2(b)(1)-(2) are not Copyright and Similar
+   Rights.
+
+d. Effective Technological Measures means those measures that, in the
+   absence of proper authority, may not be circumvented under laws
+   fulfilling obligations under Article 11 of the WIPO Copyright
+   Treaty adopted on December 20, 1996, and/or similar international
+   agreements.
+
+e. Exceptions and Limitations means fair use, fair dealing, and/or
+   any other exception or limitation to Copyright and Similar Rights
+   that applies to Your use of the Licensed Material.
+
+f. Licensed Material means the artistic or literary work, database,
+   or other material to which the Licensor applied this Public
+   License.
+
+g. Licensed Rights means the rights granted to You subject to the
+   terms and conditions of this Public License, which are limited to
+   all Copyright and Similar Rights that apply to Your use of the
+   Licensed Material and that the Licensor has authority to license.
+
+h. Licensor means the individual(s) or entity(ies) granting rights
+   under this Public License.
+
+i. Share means to provide material to the public by any means or
+   process that requires permission under the Licensed Rights, such
+   as reproduction, public display, public performance, distribution,
+   dissemination, communication, or importation, and to make material
+   available to the public including in ways that members of the
+   public may access the material from a place and at a time
+   individually chosen by them.
+
+j. Sui Generis Database Rights means rights other than copyright
+   resulting from Directive 96/9/EC of the European Parliament and of
+   the Council of 11 March 1996 on the legal protection of databases,
+   as amended and/or succeeded, as well as other essentially
+   equivalent rights anywhere in the world.
+
+k. You means the individual or entity exercising the Licensed Rights
+   under this Public License. Your has a corresponding meaning.
+
+Section 2 -- Scope.
+
+a. License grant.
+
+     1. Subject to the terms and conditions of this Public License,
+        the Licensor hereby grants You a worldwide, royalty-free,
+        non-sublicensable, non-exclusive, irrevocable license to
+        exercise the Licensed Rights in the Licensed Material to:
+
+          a. reproduce and Share the Licensed Material, in whole or
+             in part; and
+
+          b. produce, reproduce, and Share Adapted Material.
+
+     2. Exceptions and Limitations. For the avoidance of doubt, where
+        Exceptions and Limitations apply to Your use, this Public
+        License does not apply, and You do not need to comply with
+        its terms and conditions.
+
+     3. Term. The term of this Public License is specified in Section
+        6(a).
+
+     4. Media and formats; technical modifications allowed. The
+        Licensor authorizes You to exercise the Licensed Rights in
+        all media and formats whether now known or hereafter created,
+        and to make technical modifications necessary to do so. The
+        Licensor waives and/or agrees not to assert any right or
+        authority to forbid You from making technical modifications
+        necessary to exercise the Licensed Rights, including
+        technical modifications necessary to circumvent Effective
+        Technological Measures. For purposes of this Public License,
+        simply making modifications authorized by this Section 2(a)
+        (4) never produces Adapted Material.
+
+     5. Downstream recipients.
+
+          a. Offer from the Licensor -- Licensed Material. Every
+             recipient of the Licensed Material automatically
+             receives an offer from the Licensor to exercise the
+             Licensed Rights under the terms and conditions of this
+             Public License.
+
+          b. No downstream restrictions. You may not offer or impose
+             any additional or different terms or conditions on, or
+             apply any Effective Technological Measures to, the
+             Licensed Material if doing so restricts exercise of the
+             Licensed Rights by any recipient of the Licensed
+             Material.
+
+     6. No endorsement. Nothing in this Public License constitutes or
+        may be construed as permission to assert or imply that You
+        are, or that Your use of the Licensed Material is, connected
+        with, or sponsored, endorsed, or granted official status by,
+        the Licensor or others designated to receive attribution as
+        provided in Section 3(a)(1)(A)(i).
+
+b. Other rights.
+
+     1. Moral rights, such as the right of integrity, are not
+        licensed under this Public License, nor are publicity,
+        privacy, and/or other similar personality rights; however, to
+        the extent possible, the Licensor waives and/or agrees not to
+        assert any such rights held by the Licensor to the limited
+        extent necessary to allow You to exercise the Licensed
+        Rights, but not otherwise.
+
+     2. Patent and trademark rights are not licensed under this
+        Public License.
+
+     3. To the extent possible, the Licensor waives any right to
+        collect royalties from You for the exercise of the Licensed
+        Rights, whether directly or through a collecting society
+        under any voluntary or waivable statutory or compulsory
+        licensing scheme. In all other cases the Licensor expressly
+        reserves any right to collect such royalties.
+
+Section 3 -- License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the
+following conditions.
+
+a. Attribution.
+
+     1. If You Share the Licensed Material (including in modified
+        form), You must:
+
+          a. retain the following if it is supplied by the Licensor
+             with the Licensed Material:
+
+               i. identification of the creator(s) of the Licensed
+                  Material and any others designated to receive
+                  attribution, in any reasonable manner requested by
+                  the Licensor (including by pseudonym if
+                  designated);
+
+              ii. a copyright notice;
+
+             iii. a notice that refers to this Public License;
+
+              iv. a notice that refers to the disclaimer of
+                  warranties;
+
+               v. a URI or hyperlink to the Licensed Material to the
+                  extent reasonably practicable;
+
+          b. indicate if You modified the Licensed Material and
+             retain an indication of any previous modifications; and
+
+          c. indicate the Licensed Material is licensed under this
+             Public License, and include the text of, or the URI or
+             hyperlink to, this Public License.
+
+     2. You may satisfy the conditions in Section 3(a)(1) in any
+        reasonable manner based on the medium, means, and context in
+        which You Share the Licensed Material. For example, it may be
+        reasonable to satisfy the conditions by providing a URI or
+        hyperlink to a resource that includes the required
+        information.
+
+     3. If requested by the Licensor, You must remove any of the
+        information required by Section 3(a)(1)(A) to the extent
+        reasonably practicable.
+
+     4. If You Share Adapted Material You produce, the Adapter's
+        License You apply must not prevent recipients of the Adapted
+        Material from complying with this Public License.
+
+Section 4 -- Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that
+apply to Your use of the Licensed Material:
+
+a. for the avoidance of doubt, Section 2(a)(1) grants You the right
+   to extract, reuse, reproduce, and Share all or a substantial
+   portion of the contents of the database;
+
+b. if You include all or a substantial portion of the database
+   contents in a database in which You have Sui Generis Database
+   Rights, then the database in which You have Sui Generis Database
+   Rights (but not its individual contents) is Adapted Material; and
+
+c. You must comply with the conditions in Section 3(a) if You Share
+   all or a substantial portion of the contents of the database.
+
+For the avoidance of doubt, this Section 4 supplements and does not
+replace Your obligations under this Public License where the Licensed
+Rights include other Copyright and Similar Rights.
+
+Section 5 -- Disclaimer of Warranties and Limitation of Liability.
+
+a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
+   EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
+   AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
+   ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
+   IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
+   WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
+   PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
+   ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
+   KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
+   ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
+
+b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
+   TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
+   NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
+   INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
+   COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
+   USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
+   ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
+   DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
+   IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
+
+c. The disclaimer of warranties and limitation of liability provided
+   above shall be interpreted in a manner that, to the extent
+   possible, most closely approximates an absolute disclaimer and
+   waiver of all liability.
+
+Section 6 -- Term and Termination.
+
+a. This Public License applies for the term of the Copyright and
+   Similar Rights licensed here. However, if You fail to comply with
+   this Public License, then Your rights under this Public License
+   terminate automatically.
+
+b. Where Your right to use the Licensed Material has terminated under
+   Section 6(a), it reinstates:
+
+     1. automatically as of the date the violation is cured, provided
+        it is cured within 30 days of Your discovery of the
+        violation; or
+
+     2. upon express reinstatement by the Licensor.
+
+   For the avoidance of doubt, this Section 6(b) does not affect any
+   right the Licensor may have to seek remedies for Your violations
+   of this Public License.
+
+c. For the avoidance of doubt, the Licensor may also offer the
+   Licensed Material under separate terms or conditions or stop
+   distributing the Licensed Material at any time; however, doing so
+   will not terminate this Public License.
+
+d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
+   License.
+
+Section 7 -- Other Terms and Conditions.
+
+a. The Licensor shall not be bound by any additional or different
+   terms or conditions communicated by You unless expressly agreed.
+
+b. Any arrangements, understandings, or agreements regarding the
+   Licensed Material not stated herein are separate from and
+   independent of the terms and conditions of this Public License.
+
+Section 8 -- Interpretation.
+
+a. For the avoidance of doubt, this Public License does not, and
+   shall not be interpreted to, reduce, limit, restrict, or impose
+   conditions on any use of the Licensed Material that could lawfully
+   be made without permission under this Public License.
+
+b. To the extent possible, if any provision of this Public License is
+   deemed unenforceable, it shall be automatically reformed to the
+   minimum extent necessary to make it enforceable. If the provision
+   cannot be reformed, it shall be severed from this Public License
+   without affecting the enforceability of the remaining terms and
+   conditions.
+
+c. No term or condition of this Public License will be waived and no
+   failure to comply consented to unless expressly agreed to by the
+   Licensor.
+
+d. Nothing in this Public License constitutes or may be interpreted
+   as a limitation upon, or waiver of, any privileges and immunities
+   that apply to the Licensor or You, including from the legal
+   processes of any jurisdiction or authority.
+
+=======================================================================
+
+Creative Commons is not a party to its public licenses.
+Notwithstanding, Creative Commons may elect to apply one of its public
+licenses to material it publishes and in those instances will be
+considered the "Licensor." Except for the limited purpose of indicating
+that material is shared under a Creative Commons public license or as
+otherwise permitted by the Creative Commons policies published at
+creativecommons.org/policies, Creative Commons does not authorize the
+use of the trademark "Creative Commons" or any other trademark or logo
+of Creative Commons without its prior written consent including,
+without limitation, in connection with any unauthorized modifications
+to any of its public licenses or any other arrangements,
+understandings, or agreements concerning use of licensed material. For
+the avoidance of doubt, this paragraph does not form part of the public
+licenses.
+
+Creative Commons may be contacted at creativecommons.org.
+

+ 9 - 0
docs/Makefile

@@ -0,0 +1,9 @@
+notebooks:
+	for f in ../notebooks/*.ipynb; \
+	do \
+	    NAME=$$(basename $$f .ipynb); \
+	    jupyter nbconvert --to markdown ../notebooks/$$NAME.ipynb --template=nbconvert_template.tpl; \
+	    mv -f "$$NAME".md _docs/; \
+	    rm -rf static/"$$NAME"_files; \
+	    mv "$$NAME"_files static/; \
+	done

+ 80 - 0
docs/README.md

@@ -0,0 +1,80 @@
+## User Documentation for YOUR PROJECT
+
+This directory will contain the user and feature documentation for YOUR PROJECT. The documentation will be hosted on GitHub pages.
+
+### Contributing
+
+See [CONTRIBUTING.md](./CONTRIBUTING.md) for details on how to add or modify content.
+
+### Run the Site Locally
+
+The requirements for running a GitHub pages site locally is described in [GitHub help](https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/#requirements). The steps below summarize these steps.
+
+> If you have run the site before, you can start with step 1 and then move on to step 5.
+
+1. Ensure that you are in the same directory where this `README.md` exists (e.g., it could be in `YOUR-PROJECT/docs` on `master`, in the root of a `gh-pages` branch, etc). The below RubyGems commands, etc. must be run from there.
+
+1. Make sure you have Ruby and [RubyGems](https://rubygems.org/) installed.
+
+   > Ruby >= 2.2 is required for the gems. On the latest versions of Mac OS X, Ruby 2.0 is the
+   > default. Use [Homebrew](http://brew.sh) and the `brew install ruby` command (or your
+   > preferred upgrade mechanism) to install a newer version of Ruby for your Mac OS X system.
+
+1. Make sure you have [Bundler](http://bundler.io/) installed.
+
+    ```
+    # may require sudo
+    gem install bundler
+    ```
+1. Install the project's dependencies
+
+    ```
+    # run this in the 'docs' directory
+    bundle install
+    ```
+
+    > If you get an error when installing `nokogiri`, you may be running into the problem described
+    > in [this nokogiri issue](https://github.com/sparklemotion/nokogiri/issues/1483). You can
+    > either `brew uninstall xz` (and then `brew install xz` after the bundle is installed) or
+    > `xcode-select --install` (although this may not work if you have already installed command
+    > line tools).
+
+1. Run Jekyll's server.
+
+    - On first runs or for structural changes to the documentation (e.g., new sidebar menu item), do a full build.
+
+    ```
+    bundle exec jekyll serve
+    ```
+
+    - For content changes only, you can use `--incremental` for faster builds.
+
+    ```
+    bundle exec jekyll serve --incremental
+    ```
+
+    > We use `bundle exec` instead of running straight `jekyll` because `bundle exec` will always use the version of Jekyll from our `Gemfile`. Just running `jekyll` will use the system version and may not necessarily be compatible.
+
+    - To run using an actual IP address, you can use `--host=0.0.0.0`
+
+    ```
+    bundle exec jekyll serve --host=0.0.0.0
+    ```
+
+    This will allow you to use the IP address associated with your machine in the URL. That way you could share it with other people.
+
+    e.g., on a Mac, you can your IP address with something like `ifconfig | grep "inet " | grep -v 127.0.0.1`.
+
+1. Either of commands in the previous step will serve up the site on your local device at http://127.0.0.1:4000/ or http://localhost:4000.
+
+### Updating the Bundle
+
+The site depends on Github Pages and the installed bundle is based on the `github-pages` gem.
+Occasionally that gem might get updated with new or changed functionality. If that is the case,
+you can run:
+
+```
+bundle update
+```
+
+to get the latest packages for the installation.

+ 95 - 0
docs/_config.yml

@@ -0,0 +1,95 @@
+# Site settings
+permalink: /blog/:year/:month/:day/:title.html
+title: Prophet
+tagline: Forecasting at scale.
+description: >
+  Prophet is a forecasting procedure implemented in  R and Python.  It is fast and provides completely automated forecasts that can be tuned by hand by data scientists and analysts.
+fbappid: "1615782811974223"
+gacode: "UA-44373548-26"
+logo: /static/logo.svg
+
+# baseurl determines the subpath of your site. For example if you're using an
+# organisation.github.io/reponame/ basic site URL, then baseurl would be set
+# as "/reponame" but either set to "" or remove it all together if you have
+# a top-level domain URL as it is now set to "" by default as discussed in:
+# http://jekyllrb.com/news/2016/10/06/jekyll-3-3-is-here/
+baseurl: "/prophet"
+
+# the base hostname & protocol for your site
+# If baseurl is set, then the absolute url for your site would be url/baseurl
+# This was also be set to the right thing automatically for local development
+# https://github.com/blog/2277-what-s-new-in-github-pages-with-jekyll-3-3
+# http://jekyllrb.com/news/2016/10/06/jekyll-3-3-is-here/
+url: "http://facebookincubator.github.io"
+
+# Note: There are new filters in Jekyll 3.3 to help with absolute and relative urls
+# absolute_url
+# relative_url
+# So you will see these used throughout the Jekyll code in this template.
+# no more need for | prepend: site.url | prepend: site.baseurl
+# http://jekyllrb.com/news/2016/10/06/jekyll-3-3-is-here/
+# https://github.com/blog/2277-what-s-new-in-github-pages-with-jekyll-3-3
+
+# The GitHub repo for your project
+ghrepo: "facebookincubator/prophet"
+
+# Use these color settings to determine your colour scheme for the site.
+color:
+  # primary should be a vivid color that reflects the project's brand
+  primary: "#3b5998"
+  # secondary should be a subtle light or dark color used on page backgrounds
+  secondary: "#f9f9f9"
+  # Use the following to specify whether the previous two colours are 'light'
+  # or 'dark' and therefore what colors can be overlaid on them
+  primary-overlay: "dark"
+  secondary-overlay: "light"
+
+#Uncomment this if you want to enable Algolia doc search with your own values
+#searchconfig:
+#  apikey: ""
+#  indexname: ""
+
+# Blog posts are built into Jekyll by default, with the `_posts` directory.
+# Here you can specify other types of documentation. The names here are `docs`
+# and `top-level`. This means their content will be in `_docs` and `_top-level`.
+# The permalink format is also given.
+# http://ben.balter.com/2015/02/20/jekyll-collections/
+collections:
+  docs:
+    output: true
+    permalink: /docs/:name/
+
+# DO NOT ADJUST BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE CHANGING
+
+markdown: kramdown
+kramdown:
+  input: GFM
+  syntax_highlighter: rouge
+
+  syntax_highlighter_opts:
+    css_class: 'rougeHighlight'
+    span:
+      line_numbers: false
+    block:
+      line_numbers: true
+      start_line: 1
+
+sass:
+  style: :compressed
+
+redcarpet:
+  extensions: [with_toc_data]
+
+# Gems
+gems:
+  - jekyll-feed
+  - jekyll-seo-tag
+  - jekyll-sitemap
+
+# Set default open graph image for all pages
+defaults:
+  -
+    scope:
+      path: ""
+    values:
+      image: /static/og_image.png

+ 8 - 0
docs/_data/authors.yml

@@ -0,0 +1,8 @@
+
+sjt:
+  full_name: Sean J. Taylor
+  fbid: 605889
+
+bletham:
+  full_name: Ben Letham
+  fbid: 605889

+ 16 - 0
docs/_data/features.yml

@@ -0,0 +1,16 @@
+- title: Accurate and fast.
+  text: |
+        Prophet is used in many applications across Facebook for producing reliable forecasts for planning and goal setting.  We've found it to perform better than any other approach in the majority of cases.  We fit models in [Stan](http://mc-stan.org) so that you get forecasts in just a few seconds.
+  align: left
+
+- title: Fully automatic.
+  text: |
+        Get a reasonable forecast on messy data with no manual effort.  Prophet is robust to outliers, missing data, and dramatic changes in your time series.
+  
+- title: Tunable forecasts.
+  text: |
+        The Prophet procedure includes many possibilities for users to tweak and adjust forecasts.  You can use human-interpretable parameters to improve your forecast by adding your domain knowledge.
+
+- title: Available in R or Python.
+  text: |
+        We've implemented the Prophet procedure in R and Python, but they share the same underlying [Stan](http://mc-stan) code for fitting. Use whatever language you're comfortable with to get forecasts.

+ 7 - 0
docs/_data/nav.yml

@@ -0,0 +1,7 @@
+- title: Docs
+  href: /docs/
+  category: docs
+
+- title: Facebook
+  href: http://www.facebook.com/
+  category: external

+ 19 - 0
docs/_data/nav_docs.yml

@@ -0,0 +1,19 @@
+- title: Documentation
+  items:
+  - id: installation
+  - id: quick_start
+  - id: forecasting_growth
+  - id: trend_changepoints
+  - id: holiday_effects
+  - id: uncertainty_intervals
+  - id: outliers
+  - id: non-daily_data
+  - id: contributing
+
+# n title:, 1 items: per title:, n id: per items:
+# - title: A
+#   items:
+#   - id: B
+#   - id: C
+# - title: D
+#   - id: E

+ 0 - 0
docs/_data/powered_by.yml


+ 0 - 0
docs/_data/powered_by_highlight.yml


+ 17 - 0
docs/_data/promo.yml

@@ -0,0 +1,17 @@
+# This file determines the list of promotional elements added to the header of \
+# your site's homepage. Full list of plugins are shown
+
+- type: plugin_row
+  children:
+  - type: button
+    href: docs/installation.html
+    text: Install Prophet
+  - type: button
+    href: docs/quick_start.html#r-api
+    text: Get started in R
+  - type: button
+    href: docs/quick_start.html#python-api
+    text: Get started in Python
+  - type: button
+    href: static/prophet_paper_20170113.pdf
+    text: Read the paper

+ 14 - 0
docs/_docs/contributing.md

@@ -0,0 +1,14 @@
+---
+layout: docs
+docid: "contributing"
+title: "How to Contribute"
+permalink: /docs/contributing.html
+---
+
+Prophet has an non-fixed release cycle but we will be making bugfixes in response to user feedback and adding features.  Its current state is Beta (v0.1), we expect no obvious bugs. Please let us know if you encounter a bug by [filing an issue](https://github.com/facebookincubator/prophet/issues).
+
+We appreciate all contributions. If you are planning to contribute back bug-fixes, please do so without any further discussion.
+
+If you plan to contribute new features or extensions to the core, please first open an issue and discuss the feature with us. Sending a pull request is fine, too, but if it is a large change we suggest you run it by us first.
+
+We require that any API changes or feature additions are made available for both Python and R in parallel.

+ 63 - 0
docs/_docs/forecasting_growth.md

@@ -0,0 +1,63 @@
+---
+layout: docs
+docid: "forecasting_growth"
+title: "Forecasting Growth"
+permalink: /docs/forecasting_growth.html
+---
+By default, Prophet uses a linear model for its forecast. When forecasting growth, there is usually some maximum achievable point: total market size, total population size, etc. This is called the carrying capacity, and the forecast should saturate at this point.
+
+Prophet allows you to make forecasts using a [logistic growth](https://en.wikipedia.org/wiki/Logistic_function) trend model, with a specified carrying capacity. We illustrate this with the log number of page visits to the [R (programming language)](https://en.wikipedia.org/wiki/R_%28programming_language%29) page on Wikipedia:
+
+```python
+# Python
+df = pd.read_csv('../examples/example_wp_R.csv')
+import numpy as np
+df['y'] = np.log(df['y'])
+```
+```R
+# R
+df <- read.csv('../examples/example_wp_R.csv')
+df$y <- log(df$y)
+```
+We must specify the carrying capacity in a column `cap`. Here we will assume a particular value, but this would usually be set using data or expertise about the market size.
+
+```python
+# Python
+df['cap'] = 8.5
+```
+```R
+# R
+df$cap <- 8.5
+```
+The important things to note are that `cap` must be specified for every row in the dataframe, and that it does not have to be constant. If the market size is growing, then `cap` can be an increasing sequence.
+
+We then fit the model as before, except pass in an additional argument to specify logistic growth:
+
+```python
+# Python
+m = Prophet(growth='logistic')
+m.fit(df)
+```
+```R
+# R
+m <- prophet(df, growth = 'logistic')
+```
+We make a dataframe for future predictions as before, except we must also specify the capacity in the future. Here we keep capacity constant at the same value as in the history, and forecast 3 years into the future:
+
+```python
+# Python
+future = m.make_future_dataframe(periods=1826)
+future['cap'] = 8.5
+fcst = m.predict(future)
+m.plot(fcst);
+```
+```R
+# R
+future <- make_future_dataframe(m, periods = 1826)
+future$cap <- 8.5
+fcst <- predict(m, future)
+plot(m, fcst);
+```
+ 
+![png](/prophet/static/forecasting_growth_files/forecasting_growth_13_0.png) 
+

+ 276 - 0
docs/_docs/holiday_effects.md

@@ -0,0 +1,276 @@
+---
+layout: docs
+docid: "holiday_effects"
+title: "Holiday Effects"
+permalink: /docs/holiday_effects.html
+---
+### Modeling Holidays
+If you have holidays that you'd like to model, you must create a dataframe for them. It has two columns (`holiday` and `ds`) and a row for each occurrence of the holiday. It must include all occurrences of the holiday, both in the past (back as far as the historical data go) and in the future (out as far as the forecast is being made). If they won't repeat in the future, Prophet will model them and then not include them in the forecast.
+
+You can also include columns `lower_window` and `upper_window` which extend the holiday out to `[lower_window, upper_window]` days around the date. For instance, if you wanted to included Christmas Eve in addition to Christmas you'd include `lower_window=-1,upper_window=0`. If you wanted to use Black Friday in addition to Thanksgiving, you'd include `lower_window=0,upper_window=1`.
+
+Here we create a dataframe that includes the dates of all of Peyton Manning's playoff appearances:
+
+```python
+# Python
+playoffs = pd.DataFrame({
+  'holiday': 'playoff',
+  'ds': pd.to_datetime(['2008-01-13', '2009-01-03', '2010-01-16',
+                        '2010-01-24', '2010-02-07', '2011-01-08',
+                        '2013-01-12', '2014-01-12', '2014-01-19',
+                        '2014-02-02', '2015-01-11', '2016-01-17',
+                        '2016-01-24', '2016-02-07']),
+  'lower_window': 0,
+  'upper_window': 1,
+})
+superbowls = pd.DataFrame({
+  'holiday': 'superbowl',
+  'ds': pd.to_datetime(['2010-02-07', '2014-02-02', '2016-02-07']),
+  'lower_window': 0,
+  'upper_window': 1,
+})
+holidays = pd.concat((playoffs, superbowls))
+```
+```R
+# R
+library(dplyr)
+playoffs <- data_frame(
+  holiday = 'playoff',
+  ds = as.Date(c('2008-01-13', '2009-01-03', '2010-01-16',
+                 '2010-01-24', '2010-02-07', '2011-01-08',
+                 '2013-01-12', '2014-01-12', '2014-01-19',
+                 '2014-02-02', '2015-01-11', '2016-01-17',
+                 '2016-01-24', '2016-02-07')),
+  lower_window = 0,
+  upper_window = 1
+)
+superbowls <- data_frame(
+  holiday = 'superbowl',
+  ds = as.Date(c('2010-02-07', '2014-02-02', '2016-02-07')),
+  lower_window = 0,
+  upper_window = 1
+)
+holidays <- bind_rows(playoffs, superbowls)
+```
+Above we have include the superbowl days as both playoff games and superbowl games. This means that the superbowl effect will be an additional additive bonus on top of the playoff effect.
+
+Once the table is created, holiday effects are included in the forecast by passing them in with the `holidays` argument. Here we do it with the Peyton Manning data from the Quickstart:
+
+```python
+# Python
+m = Prophet(holidays=holidays)
+forecast = m.fit(df).predict(future)
+```
+```R
+# R
+m <- prophet(df, holidays = holidays)
+forecast <- predict(m, future)
+```
+The holiday effect can be seen in the `forecast` dataframe:
+
+```R
+# R
+forecast %>% 
+  select(ds, playoff, superbowl) %>% 
+  filter(abs(playoff + superbowl) > 0) %>%
+  tail(10)
+```
+```python
+# Python
+forecast[(forecast['playoff'] + forecast['superbowl']).abs() > 0][
+        ['ds', 'playoff', 'superbowl']][-10:]
+```
+
+
+
+<div>
+<table border="1" class="dataframe">
+  <thead>
+    <tr style="text-align: right;">
+      <th></th>
+      <th>ds</th>
+      <th>playoff</th>
+      <th>superbowl</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <th>2190</th>
+      <td>2014-02-02</td>
+      <td>1.220308</td>
+      <td>1.204992</td>
+    </tr>
+    <tr>
+      <th>2191</th>
+      <td>2014-02-03</td>
+      <td>1.900465</td>
+      <td>1.444581</td>
+    </tr>
+    <tr>
+      <th>2532</th>
+      <td>2015-01-11</td>
+      <td>1.220308</td>
+      <td>0.000000</td>
+    </tr>
+    <tr>
+      <th>2533</th>
+      <td>2015-01-12</td>
+      <td>1.900465</td>
+      <td>0.000000</td>
+    </tr>
+    <tr>
+      <th>2901</th>
+      <td>2016-01-17</td>
+      <td>1.220308</td>
+      <td>0.000000</td>
+    </tr>
+    <tr>
+      <th>2902</th>
+      <td>2016-01-18</td>
+      <td>1.900465</td>
+      <td>0.000000</td>
+    </tr>
+    <tr>
+      <th>2908</th>
+      <td>2016-01-24</td>
+      <td>1.220308</td>
+      <td>0.000000</td>
+    </tr>
+    <tr>
+      <th>2909</th>
+      <td>2016-01-25</td>
+      <td>1.900465</td>
+      <td>0.000000</td>
+    </tr>
+    <tr>
+      <th>2922</th>
+      <td>2016-02-07</td>
+      <td>1.220308</td>
+      <td>1.204992</td>
+    </tr>
+    <tr>
+      <th>2923</th>
+      <td>2016-02-08</td>
+      <td>1.900465</td>
+      <td>1.444581</td>
+    </tr>
+  </tbody>
+</table>
+</div>
+
+
+
+The holiday effects will also show up in the components plot, where we see that there is a spike on the days around playoff appearances, with an especially large spike for the superbowl:
+
+```python
+# Python
+m.plot_components(forecast);
+```
+```R
+# R
+prophet_plot_components(m, forecast);
+```
+ 
+![png](/prophet/static/holiday_effects_files/holiday_effects_13_0.png) 
+
+
+### Prior scale for holidays and seasonality
+If you find that the holidays are overfitting, you can adjust their prior scale to smooth them using the parameter `holidays_prior_scale`, which by default is 10:
+
+```R
+# R
+m <- prophet(df, holidays = holidays, holidays.prior.scale = 1)
+forecast <- predict(m, future)
+forecast %>% 
+  select(ds, playoff, superbowl) %>% 
+  filter(abs(playoff + superbowl) > 0) %>%
+  tail(10)
+```
+```python
+# Python
+m = Prophet(holidays=holidays, holidays_prior_scale=1).fit(df)
+forecast = m.predict(future)
+forecast[(forecast['playoff'] + forecast['superbowl']).abs() > 0][
+    ['ds', 'playoff', 'superbowl']][-10:]
+```
+
+
+
+<div>
+<table border="1" class="dataframe">
+  <thead>
+    <tr style="text-align: right;">
+      <th></th>
+      <th>ds</th>
+      <th>playoff</th>
+      <th>superbowl</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <th>2190</th>
+      <td>2014-02-02</td>
+      <td>1.362312</td>
+      <td>0.693425</td>
+    </tr>
+    <tr>
+      <th>2191</th>
+      <td>2014-02-03</td>
+      <td>2.033471</td>
+      <td>0.542254</td>
+    </tr>
+    <tr>
+      <th>2532</th>
+      <td>2015-01-11</td>
+      <td>1.362312</td>
+      <td>0.000000</td>
+    </tr>
+    <tr>
+      <th>2533</th>
+      <td>2015-01-12</td>
+      <td>2.033471</td>
+      <td>0.000000</td>
+    </tr>
+    <tr>
+      <th>2901</th>
+      <td>2016-01-17</td>
+      <td>1.362312</td>
+      <td>0.000000</td>
+    </tr>
+    <tr>
+      <th>2902</th>
+      <td>2016-01-18</td>
+      <td>2.033471</td>
+      <td>0.000000</td>
+    </tr>
+    <tr>
+      <th>2908</th>
+      <td>2016-01-24</td>
+      <td>1.362312</td>
+      <td>0.000000</td>
+    </tr>
+    <tr>
+      <th>2909</th>
+      <td>2016-01-25</td>
+      <td>2.033471</td>
+      <td>0.000000</td>
+    </tr>
+    <tr>
+      <th>2922</th>
+      <td>2016-02-07</td>
+      <td>1.362312</td>
+      <td>0.693425</td>
+    </tr>
+    <tr>
+      <th>2923</th>
+      <td>2016-02-08</td>
+      <td>2.033471</td>
+      <td>0.542254</td>
+    </tr>
+  </tbody>
+</table>
+</div>
+
+
+
+The magnitude of the holiday effect has been reduced compared to before, especially for superbowls, which had the fewest observations. There is a parameter `seasonality_prior_scale` which similarly adjusts the extent to which the seasonality model will fit the data.

+ 40 - 0
docs/_docs/installation.md

@@ -0,0 +1,40 @@
+---
+layout: docs
+docid: "installation"
+title: "Installation"
+permalink: /docs/installation.html
+---
+
+Prophet has two implementations: [R](#installation-in-r) and [Python](#installation-in-python).  Note the slight name difference for the Python package.
+
+## Installation in R
+
+Prophet is a [CRAN package](https://cran.r-project.org/package=prophet) so you can use `install.packages`:
+
+```
+# R
+> install.packages('prophet')
+```
+
+After installation, you can [get started!](quick_start.html#r-api)
+
+### Windows
+
+On Windows, R requires a compiler so you'll need to [follow the instructions](https://github.com/stan-dev/rstan/wiki/Installing-RStan-on-Windows) provided by `rstan`.  The key step is installing [Rtools](http://cran.r-project.org/bin/windows/Rtools/) before attempting to install the package.
+
+## Installation in Python
+
+Prophet is on PyPI, so you can use pip to install it:
+
+```
+# bash
+$ pip install fbprophet
+```
+
+The major dependency that Prophet has is `pystan`.   PyStan has its own [installation instructions](http://pystan.readthedocs.io/en/latest/installation_beginner.html).
+
+After installation, you can [get started!](quick_start.html#python-api)
+
+### Windows
+
+On Windows, PyStan requires a compiler so you'll need to [follow the instructions](http://pystan.readthedocs.io/en/latest/windows.html).  The key step is installing a recent [C++ compiler](http://landinghub.visualstudio.com/visual-cpp-build-tools).

+ 45 - 0
docs/_docs/non-daily_data.md

@@ -0,0 +1,45 @@
+---
+layout: docs
+docid: "non-daily_data"
+title: "Non-Daily Data"
+permalink: /docs/non-daily_data.html
+---
+Prophet doesn't strictly require daily data, but you can get strange results if you ask for daily forecasts from non-daily data and fit seasonalities. Here we forecast US retail sales volume for the next 10 years:
+
+```R
+# R
+df <- read.csv('../examples/example_retail_sales.csv')
+m <- prophet(df)
+future <- make_future_dataframe(m, periods = 3652)
+fcst <- predict(m, future)
+plot(m, fcst);
+```
+```python
+# Python
+df = pd.read_csv('../examples/example_retail_sales.csv')
+m = Prophet().fit(df)
+future = m.make_future_dataframe(periods=3652)
+fcst = m.predict(future)
+m.plot(fcst);
+```
+ 
+![png](/prophet/static/non-daily_data_files/non-daily_data_4_0.png) 
+
+
+The forecast here seems very noisy. What's happening is that this particular data set only provides monthly data. When we fit the yearly seasonality, it only has data for the first of each month and the seasonality components for the remaining days are unidentifiable and overfit. When you are fitting Prophet to monthly data, only make monthly forecasts, which can be done by passing the frequency into make_future_dataframe:
+
+```R
+# R
+future <- make_future_dataframe(m, periods = 120, freq = 'm')
+fcst <- predict(m, future)
+plot(m, fcst)
+```
+```python
+# Python
+future = m.make_future_dataframe(periods=120, freq='M')
+fcst = m.predict(future)
+m.plot(fcst);
+```
+ 
+![png](/prophet/static/non-daily_data_files/non-daily_data_7_0.png) 
+

+ 99 - 0
docs/_docs/outliers.md

@@ -0,0 +1,99 @@
+---
+layout: docs
+docid: "outliers"
+title: "Outliers"
+permalink: /docs/outliers.html
+---
+There are two main ways that outliers can affect Prophet forecasts. Here we make a forecast on the logged Wikipedia visits to the R page from before, but with a block of bad data:
+
+```R
+# R
+df <- read.csv('../examples/example_wp_R_outliers1.csv')
+df$y <- log(df$y)
+m <- prophet(df)
+future <- make_future_dataframe(m, periods = 1096)
+forecast <- predict(m, future)
+plot(m, forecast);
+```
+```python
+# Python
+df = pd.read_csv('../examples/example_wp_R_outliers1.csv')
+df['y'] = np.log(df['y'])
+m = Prophet()
+m.fit(df)
+future = m.make_future_dataframe(periods=1096)
+forecast = m.predict(future)
+m.plot(forecast);
+```
+ 
+![png](/prophet/static/outliers_files/outliers_4_0.png) 
+
+
+The trend forecast seems reasonable, but the uncertainty intervals seem way too wide. Prophet is able to handle the outliers in the history, but only by fitting them with trend changes. The uncertainty model then expects future trend changes of similar magnitude.
+
+The best way to handle outliers is to remove them - Prophet has no problem with missing data. If you set their values to `NA` in the history but leave the dates in `future`, then Prophet will give you a prediction for their values.
+
+```R
+# R
+outliers <- (as.Date(df$ds) > as.Date('2010-01-01')
+             & as.Date(df$ds) < as.Date('2011-01-01'))
+df$y[outliers] = NA
+m <- prophet(df)
+forecast <- predict(m, future)
+plot(m, forecast);
+```
+```python
+# Python
+df.loc[(df['ds'] > '2010-01-01') & (df['ds'] < '2011-01-01'), 'y'] = None
+model = Prophet().fit(df)
+model.plot(model.predict(future));
+```
+ 
+![png](/prophet/static/outliers_files/outliers_7_0.png) 
+
+
+In the above example the outliers messed up the uncertainty estimation but did not impact the main forecast `yhat`. This isn't always the case, as in this example with added outliers:
+
+```R
+# R
+df <- read.csv('../examples/example_wp_R_outliers2.csv')
+df$y = log(df$y)
+m <- prophet(df)
+future <- make_future_dataframe(m, periods = 1096)
+forecast <- predict(m, future)
+plot(m, forecast);
+```
+```python
+# Python
+df = pd.read_csv('../examples/example_wp_R_outliers2.csv')
+df['y'] = np.log(df['y'])
+m = Prophet()
+m.fit(df)
+future = m.make_future_dataframe(periods=1096)
+forecast = m.predict(future)
+m.plot(forecast);
+```
+ 
+![png](/prophet/static/outliers_files/outliers_10_0.png) 
+
+
+Here a group of extreme outliers in June 2015 mess up the seasonality estimate, so their effect reverberates into the future forever. Again the right approach is to remove them:
+
+```R
+# R
+outliers <- (as.Date(df$ds) > as.Date('2015-06-01')
+             & as.Date(df$ds) < as.Date('2015-06-30'))
+df$y[outliers] = NA
+m <- prophet(df)
+forecast <- predict(m, future)
+plot(m, forecast);
+```
+```python
+# Python
+df.loc[(df['ds'] > '2015-06-01') & (df['ds'] < '2015-06-30'), 'y'] = None
+m = Prophet().fit(df)
+m.plot(m.predict(future));
+```
+ 
+![png](/prophet/static/outliers_files/outliers_13_0.png) 
+

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 284 - 0
docs/_docs/quick_start.md


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 79 - 0
docs/_docs/trend_changepoints.md


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 54 - 0
docs/_docs/uncertainty_intervals.md


+ 28 - 0
docs/_includes/blog_pagination.html

@@ -0,0 +1,28 @@
+<!-- Pagination links - copied from http://jekyllrb.com/docs/pagination/ -->
+{% if paginator.total_pages > 1 %}
+<br />
+<div class="pagination">
+  {% if paginator.previous_page %}
+    <a href="{{ paginator.previous_page_path | relative_url | replace: '//', '/' }}">&laquo; Prev</a>
+  {% else %}
+    <span>&laquo; Prev</span>
+  {% endif %}
+
+  {% for page in (1..paginator.total_pages) %}
+    {% if page == paginator.page %}
+      <em>{{ page }}</em>
+    {% elsif page == 1 %}
+      <a href="{{ '/blog' | relative_url }}">{{ page }}</a>
+    {% else %}
+      <a href="{{ site.paginate_path | relative_url | replace: '//', '/' | replace: ':num', page }}">{{ page }}</a>
+    {% endif %}
+  {% endfor %}
+
+  {% if paginator.next_page %}
+    <a href="{{ paginator.next_page_path | relative_url | replace: '//', '/' }}">Next &raquo;</a>
+  {% else %}
+    <span>Next &raquo;</span>
+  {% endif %}
+</div>
+<br />
+{% endif %}

+ 5 - 0
docs/_includes/content/gridblocks.html

@@ -0,0 +1,5 @@
+<div class="gridBlock">
+{% for item in {{include.data_source}} %}
+  {% include content/items/gridblock.html item=item layout=include.layout imagealign=include.imagealign align=include.align %}
+{% endfor %}
+</div>

+ 37 - 0
docs/_includes/content/items/gridblock.html

@@ -0,0 +1,37 @@
+{% if include.layout == "fourColumn" %}
+  {% assign layout = "fourByGridBlock" %}
+{% else %}
+  {% assign layout = "twoByGridBlock" %}
+{% endif %}
+
+{% if include.imagealign == "side" %}
+  {% assign imagealign = "imageAlignSide" %}
+{% else %}
+  {% if item.image %}
+    {% assign imagealign = "imageAlignTop" %}
+  {% else %}
+    {% assign imagealign = "" %}
+  {% endif %}
+{% endif %}
+
+{% if include.align == "right" %}
+  {% assign align = "alignRight" %}
+{% elsif include.align == "center" %}
+  {% assign align = "alignCenter" %}
+{% else %}
+  {% assign align = "alignLeft" %}
+{% endif %}
+
+<div class="blockElement {{ layout }} {{ imagealign }} {{ align }}">
+  {% if item.image %}
+  <div class="blockImage">
+    <img src="/static/{{ item.image }}" alt="{{ item.title }}" title="{{ item.title }}" />
+  </div>
+  {% endif %}
+  <div class="blockContent">
+    <h3>{{ item.title }}</h3>
+    {% if item.text %}
+    {{ item.text | markdownify }}
+    {% endif %}
+  </div>
+</div>

+ 25 - 0
docs/_includes/doc.html

@@ -0,0 +1,25 @@
+<div class="post">
+  <header class="post-header">
+    <h1 class="post-title">{% if include.truncate %}<a href="{{ page.url | absolute_url }}">{{ page.title }}</a>{% else %}{{ page.title }}{% endif %}</h1>
+  </header>
+
+  <article class="post-content">
+   {% if include.truncate %}
+      {% if page.content contains '<!--truncate-->' %}
+        {{ page.content | split:'<!--truncate-->' | first }}
+        <div class="read-more">
+          <a href="{{ page.url | absolute_url }}" >
+            ...Read More
+          </a>
+        </div>
+      {% else %}
+        {{ page.content }}
+      {% endif %}
+    {% else %}
+      {{ content }}
+
+      <p><a class="edit-page-link" href="https://github.com/{{ site.ghrepo }}/tree/gh-pages/{{ page.path }}" target="_blank">Edit on GitHub</a></p>
+    {% endif %}
+  </article>
+  {% include doc_paging.html %}
+</div>

+ 0 - 0
docs/_includes/doc_paging.html


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 33 - 0
docs/_includes/footer.html


+ 19 - 0
docs/_includes/head.html

@@ -0,0 +1,19 @@
+<head>
+  <meta charset="utf-8">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+
+  {% seo %}
+
+  <link rel="stylesheet" href="{{ '/css/main.css' | relative_url }}" media="screen">
+  <link rel="icon" href="{{ '/static/favicon.png' | relative_url }}" type="image/x-icon">
+  {% if site.searchconfig %}
+  <link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" />
+  {% endif %}
+
+  {% comment %}
+  For our RSS feed.xml
+  https://help.github.com/articles/atom-rss-feeds-for-github-pages/
+  {% endcomment %}
+  {% feed_meta %}
+</head>

+ 19 - 0
docs/_includes/header.html

@@ -0,0 +1,19 @@
+<div class="headerContainer">
+  <div id="header_wrap" class="wrapper headerWrapper">
+    <div class="inner">
+      <img class="projectLogo" height="200px" src="{{ '/static/logo.svg' | relative_url }}" alt="{{ site.title }}" title="{{ site.title }}" />
+      <h1 id="project_title">{{ site.title }}</h1>
+      <h2 id="project_tagline" class="fbossFontLight">{{ site.tagline }}</h2>
+
+      <section id="intro">
+        <p>{% if page.excerpt %}{{ page.excerpt | strip_html }}{% else %}{{ site.description }}{% endif %}</p>
+      </section>
+      <div id="promo" class="section promoSection">
+        {% for promo in site.data.promo %}
+          {% include plugins/{{promo.type}}.html button_href=promo.href button_text=promo.text %}
+          <div class="gridClear"></div>
+        {% endfor %}
+      </div>
+    </div>
+  </div>
+</div>

+ 0 - 0
docs/_includes/hero.html


+ 22 - 0
docs/_includes/home_header.html

@@ -0,0 +1,22 @@
+<div class="homeContainer">
+  <div class="homeSplashFade">
+    <div id="home_wrap" class="wrapper homeWrapper">
+      <div id="inner">
+        <h2 id="project_tagline">{{ site.tagline }}</h2>
+        <section id="intro">
+          <p>{% if page.excerpt %}{{ page.excerpt | strip_html }}{% else %}{{ site.description }}{% endif %}</p>
+        </section>
+        <div id="promo" class="section promoSection">
+          {% for promo in site.data.promo %}
+            <div class="promoRow">
+            {% include plugins/{{promo.type}}.html href=promo.href text=promo.text children=promo.children %}
+            </div>
+          {% endfor %}
+        </div>
+      </div>
+      <div class="projectLogo">
+        <img src="{{ '/static/logo.svg' | relative_url }}"  alt="{{ site.title }}">
+      </div>
+    </div>
+  </div>
+</div>

+ 3 - 0
docs/_includes/katex_import.html

@@ -0,0 +1,3 @@
+<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
+<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.2.0/katex.min.css">
+<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.2.0/katex.min.js"></script>

+ 210 - 0
docs/_includes/katex_render.html

@@ -0,0 +1,210 @@
+<script type="text/javascript">
+/* global katex */
+
+var findEndOfMath = function(delimiter, text, startIndex) {
+    // Adapted from
+    // https://github.com/Khan/perseus/blob/master/src/perseus-markdown.jsx
+    var index = startIndex;
+    var braceLevel = 0;
+
+    var delimLength = delimiter.length;
+
+    while (index < text.length) {
+        var character = text[index];
+
+        if (braceLevel <= 0 &&
+            text.slice(index, index + delimLength) === delimiter) {
+            return index;
+        } else if (character === "\\") {
+            index++;
+        } else if (character === "{") {
+            braceLevel++;
+        } else if (character === "}") {
+            braceLevel--;
+        }
+
+        index++;
+    }
+
+    return -1;
+};
+
+var splitAtDelimiters = function(startData, leftDelim, rightDelim, display) {
+    var finalData = [];
+
+    for (var i = 0; i < startData.length; i++) {
+        if (startData[i].type === "text") {
+            var text = startData[i].data;
+
+            var lookingForLeft = true;
+            var currIndex = 0;
+            var nextIndex;
+
+            nextIndex = text.indexOf(leftDelim);
+            if (nextIndex !== -1) {
+                currIndex = nextIndex;
+                finalData.push({
+                    type: "text",
+                    data: text.slice(0, currIndex)
+                });
+                lookingForLeft = false;
+            }
+
+            while (true) {
+                if (lookingForLeft) {
+                    nextIndex = text.indexOf(leftDelim, currIndex);
+                    if (nextIndex === -1) {
+                        break;
+                    }
+
+                    finalData.push({
+                        type: "text",
+                        data: text.slice(currIndex, nextIndex)
+                    });
+
+                    currIndex = nextIndex;
+                } else {
+                    nextIndex = findEndOfMath(
+                        rightDelim,
+                        text,
+                        currIndex + leftDelim.length);
+                    if (nextIndex === -1) {
+                        break;
+                    }
+
+                    finalData.push({
+                        type: "math",
+                        data: text.slice(
+                            currIndex + leftDelim.length,
+                            nextIndex),
+                        rawData: text.slice(
+                            currIndex,
+                            nextIndex + rightDelim.length),
+                        display: display
+                    });
+
+                    currIndex = nextIndex + rightDelim.length;
+                }
+
+                lookingForLeft = !lookingForLeft;
+            }
+
+            finalData.push({
+                type: "text",
+                data: text.slice(currIndex)
+            });
+        } else {
+            finalData.push(startData[i]);
+        }
+    }
+
+    return finalData;
+};
+
+var splitWithDelimiters = function(text, delimiters) {
+    var data = [{type: "text", data: text}];
+    for (var i = 0; i < delimiters.length; i++) {
+        var delimiter = delimiters[i];
+        data = splitAtDelimiters(
+            data, delimiter.left, delimiter.right,
+            delimiter.display || false);
+    }
+    return data;
+};
+
+var renderMathInText = function(text, delimiters) {
+    var data = splitWithDelimiters(text, delimiters);
+
+    var fragment = document.createDocumentFragment();
+
+    for (var i = 0; i < data.length; i++) {
+        if (data[i].type === "text") {
+            fragment.appendChild(document.createTextNode(data[i].data));
+        } else {
+            var span = document.createElement("span");
+            var math = data[i].data;
+            try {
+                katex.render(math, span, {
+                    displayMode: data[i].display
+                });
+            } catch (e) {
+                if (!(e instanceof katex.ParseError)) {
+                    throw e;
+                }
+                console.error(
+                    "KaTeX auto-render: Failed to parse `" + data[i].data +
+                    "` with ",
+                    e
+                );
+                fragment.appendChild(document.createTextNode(data[i].rawData));
+                continue;
+            }
+            fragment.appendChild(span);
+        }
+    }
+
+    return fragment;
+};
+
+var renderElem = function(elem, delimiters, ignoredTags) {
+    for (var i = 0; i < elem.childNodes.length; i++) {
+        var childNode = elem.childNodes[i];
+        if (childNode.nodeType === 3) {
+            // Text node
+            var frag = renderMathInText(childNode.textContent, delimiters);
+            i += frag.childNodes.length - 1;
+            elem.replaceChild(frag, childNode);
+        } else if (childNode.nodeType === 1) {
+            // Element node
+            var shouldRender = ignoredTags.indexOf(
+                childNode.nodeName.toLowerCase()) === -1;
+
+            if (shouldRender) {
+                renderElem(childNode, delimiters, ignoredTags);
+            }
+        }
+        // Otherwise, it's something else, and ignore it.
+    }
+};
+
+var defaultOptions = {
+    delimiters: [
+        {left: "$$", right: "$$", display: true},
+        {left: "\\[", right: "\\]", display: true},
+        {left: "\\(", right: "\\)", display: false}
+        // LaTeX uses this, but it ruins the display of normal `$` in text:
+        // {left: "$", right: "$", display: false}
+    ],
+
+    ignoredTags: [
+        "script", "noscript", "style", "textarea", "pre", "code"
+    ]
+};
+
+var extend = function(obj) {
+    // Adapted from underscore.js' `_.extend`. See LICENSE.txt for license.
+    var source, prop;
+    for (var i = 1, length = arguments.length; i < length; i++) {
+        source = arguments[i];
+        for (prop in source) {
+            if (Object.prototype.hasOwnProperty.call(source, prop)) {
+                obj[prop] = source[prop];
+            }
+        }
+    }
+    return obj;
+};
+
+var renderMathInElement = function(elem, options) {
+    if (!elem) {
+        throw new Error("No element provided to render");
+    }
+
+    options = extend({}, defaultOptions, options);
+
+    renderElem(elem, options.delimiters, options.ignoredTags);
+};
+
+renderMathInElement(document.body);
+
+</script>

+ 31 - 0
docs/_includes/nav.html

@@ -0,0 +1,31 @@
+<div id="fixed_header" class="fixedHeaderContainer{% if include.alwayson %} visible{% endif %}">
+  <div class="headerWrapper wrapper">
+    <header>
+      <a href="{{ '/' | absolute_url }}">
+        <img src="{{ '/static/wordmark.svg' | relative_url }}">
+      </a>
+
+      <div class="navigationWrapper navigationFull" id="flat_nav">
+        <nav class="navigation">
+          <ul>
+            {% for item in site.data.nav %}
+              <li class="navItem{% if page.collection == item.category or page.category == item.category %} navItemActive{% endif %}">
+                {% if item.category == "external" %}
+                  <a href="{{ item.href }}">{{ item.title }}</a>
+                {% else %}
+                  <a href="{{ item.href | relative_url }}">{{ item.title }}</a>
+                {% endif %}
+              </li>
+            {% endfor %}
+            {% if site.searchconfig %}
+              {% include nav_search.html inputselector="search_input" %}
+            {% endif %}
+          </ul>
+        </nav>
+      </div>
+      <div class="navigationWrapper navigationSlider" id="navigation_wrap">
+        {% include nav/header_nav.html %}
+      </div>
+    </header>
+  </div>
+</div>

+ 65 - 0
docs/_includes/nav/collection_nav.html

@@ -0,0 +1,65 @@
+<div class="docsNavContainer">
+  <nav class="toc" id="doc_nav">
+    <div class="toggleNav" id="collection_nav">
+      <section class="navWrapper wrapper">
+        <div class="navBreadcrumb wrapper">
+          <div class="navToggle" id="collection_nav_toggler">
+            <i></i>
+          </div>
+          <h2>
+            <a href="{{ include.sectionpath }}">{{ include.sectiontitle }}</a>
+            {% if include.currentgroup %}
+            <i>›</i>
+            <span>{{ include.currentgroup }}</span>
+            {% endif %}
+          </h2>
+        </div>
+        <div class="navGroups">
+          {% if include.type == "blog" %}
+            {% assign grouptitle = "All Posts" %}
+            {% assign groupitems = include.navdata %}
+            {% include nav/collection_nav_group.html %}
+          {% else %}
+          {% for group in include.navdata %}
+            {% assign grouptitle = group.title %}
+            {% for item in group.items %}
+              {% if item.id == page.docid %}
+              {% assign currentgroup = group %}
+              {% endif %}
+            {% endfor %}
+            {% include nav/collection_nav_group.html %}
+          {% endfor %}
+          {% endif %}
+        </div>
+      </section>
+    </div>
+  </nav>
+</div>
+<script>
+  var docsevent = document.createEvent('Event');
+  docsevent.initEvent('docs_slide', true, true);
+  document.addEventListener('docs_slide', function (e) {
+    document.body.classList.toggle('docsSliderActive');
+  }, false);
+
+  var collectionNav = document.getElementById('collection_nav');
+  var collectionNavToggler = 
+    document.getElementById('collection_nav_toggler');
+  collectionNavToggler.addEventListener('click', function(e) {
+    collectionNav.classList.toggle('toggleNavActive');
+    document.dispatchEvent(docsevent);
+  });
+
+  var groups = document.getElementsByClassName('navGroup');
+  for(var i = 0; i < groups.length; i++) {
+    var thisGroup = groups[i];
+    thisGroup.onclick = function() {
+      for(var j = 0; j < groups.length; j++) {
+        var group = groups[j];
+        group.classList.remove('navGroupActive');
+      }
+      this.classList.add('navGroupActive');
+    }
+  }
+</script>
+

+ 19 - 0
docs/_includes/nav/collection_nav_group.html

@@ -0,0 +1,19 @@
+<div class="navGroup{% if currentgroup == group %} navGroupActive navGroupCurrent{% endif %}">
+  <h3><i>+</i><span>{{ grouptitle }}</span></h3>
+  <ul>
+    {% if include.data_collection %}
+      {% for item in group.items %}
+        {% for collectionitem in include.data_collection %}
+        {% if collectionitem.docid == item.id %}
+          {% assign groupitem = collectionitem %}
+          {% include nav/collection_nav_group_item.html %}
+        {% endif %}
+        {% endfor %}
+      {% endfor %}
+    {% else %}
+      {% for groupitem in groupitems %}
+      {% include nav/collection_nav_group_item.html %}
+      {% endfor %}
+    {% endif %}
+  </ul>
+</div>

+ 1 - 0
docs/_includes/nav/collection_nav_group_item.html

@@ -0,0 +1 @@
+<li class="navListItem"><a class="navItem" href="{{ groupitem.url | absolute_url }}">{{ groupitem.title }}</a></li>

+ 30 - 0
docs/_includes/nav/header_nav.html

@@ -0,0 +1,30 @@
+<div id="header_nav">
+  <div class="navSlideout">
+    <i class="menuExpand" id="header_nav_expander"><span></span><span></span><span></span></i>
+  </div>
+  <nav class="slidingNav">
+    <ul>
+      {% for item in site.data.nav %}
+      <li class="navItem">
+        <a href="{{ item.href }}"{% if item.category == "external" %} target="_blank"{% endif %}>{{ item.title }}</a>
+      </li>
+      {% endfor %}
+      {% if site.searchconfig %}
+      {% include nav_search.html inputselector="search_input_react" %}
+      {% endif %}
+    </ul>
+  </nav>
+</div>
+<script>
+  var event = document.createEvent('Event');
+  event.initEvent('slide', true, true);
+  document.addEventListener('slide', function (e) {
+    document.body.classList.toggle('sliderActive');
+  }, false);
+  var headerNav = document.getElementById('header_nav');
+  var headerNavExpander = document.getElementById('header_nav_expander');
+  headerNavExpander.addEventListener('click', function(e) {
+    headerNav.classList.toggle('navSlideoutActive');
+    document.dispatchEvent(event);
+  }, false);
+</script>

+ 15 - 0
docs/_includes/nav_search.html

@@ -0,0 +1,15 @@
+<li class="navSearchWrapper">
+  <input id="{{ include.inputselector }}" type="search" />
+</li>
+<script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
+<script>
+// For Algolia search
+(function() {
+  // Algolia
+  docsearch({
+    apiKey: '{{ site.searchconfig.apikey }}',
+    indexName: '{{ site.searchconfig.indexname }}',
+    inputSelector: '#{{ include.inputselector }}',
+  });
+}());
+</script>

+ 3 - 0
docs/_includes/plugins/all_share.html

@@ -0,0 +1,3 @@
+<div class="pluginBlock allShareBlock">
+  {% include plugins/like_button.html %}{% include plugins/twitter_share.html %}{% include plugins/google_share.html %}
+</div>

+ 2 - 0
docs/_includes/plugins/ascii_cinema.html

@@ -0,0 +1,2 @@
+<div class="ascii-cinema pluginBlock"></div>
+<script type="text/javascript" src="https://asciinema.org/a/{{ include.href }}.js" id="asciicast-{{ include.href }}" async data-autoplay="true" data-loop="true" data-speed="2" data-t="23"></script>

+ 6 - 0
docs/_includes/plugins/button.html

@@ -0,0 +1,6 @@
+<div class="pluginWrapper buttonWrapper">
+  <a
+    class="button"
+    href="{{ include.href }}"
+  >{{ include.text }}</a>
+</div>

+ 4 - 0
docs/_includes/plugins/github_star.html

@@ -0,0 +1,4 @@
+<div class="pluginWrapper ghStarWrapper">
+  <a aria-label="Star {{ site.ghrepo }} on GitHub" data-count-aria-label="# stargazers on GitHub" data-count-api="/repos/{{ site.ghrepo }}#stargazers_count" data-count-href="/{{ site.ghrepo }}/stargazers" data-style="mega" data-icon="octicon-star" href="https://github.com/{{ site.ghrepo }}" class="github-button">Star</a>
+</div>
+<script async defer id="github-bjs" src="https://buttons.github.io/buttons.js"></script>

+ 4 - 0
docs/_includes/plugins/github_watch.html

@@ -0,0 +1,4 @@
+<div class="pluginWrapper ghWatchWrapper">
+  <a aria-label="Watch {{ site.ghrepo }} on GitHub" data-count-aria-label="# watchers on GitHub" data-count-api="/repos/{{ site.ghrepo }}#subscribers_count" data-count-href="/{{ site.ghrepo }}/watchers" data-style="mega" data-icon="octicon-eye" href="https://github.com/{{ site.ghrepo }}" class="github-button">Watch</a>
+</div>
+<script async defer id="github-bjs" src="https://buttons.github.io/buttons.js"></script>

+ 5 - 0
docs/_includes/plugins/google_share.html

@@ -0,0 +1,5 @@
+<div class="pluginBlock">
+  <div class="g-plusone" data-size="medium"></div>
+</div>
+
+<script src="https://apis.google.com/js/platform.js" async defer></script>

+ 6 - 0
docs/_includes/plugins/iframe.html

@@ -0,0 +1,6 @@
+<div class="iframeContent">
+  <iframe class="pluginIframe" src="{{ include.href }}" seamless></iframe>
+</div>
+<div class="iframePreview">
+  {% include plugins/button.html href=include.href text=include.text %}
+</div>

+ 18 - 0
docs/_includes/plugins/like_button.html

@@ -0,0 +1,18 @@
+<div class="fb-like pluginWrapper likeButtonWrapper" data-layout="button_count" data-action="like" data-show-faces="true" data-share="true"></div>
+<script>
+  window.fbAsyncInit = function() {
+  FB.init({
+    appId      : '{{ site.fbappid }}',
+    xfbml      : true,
+    version    : 'v2.3'
+  });
+  };
+
+  (function(d, s, id){
+   var js, fjs = d.getElementsByTagName(s)[0];
+   if (d.getElementById(id)) {return;}
+   js = d.createElement(s); js.id = id;
+   js.src = "//connect.facebook.net/en_US/sdk.js";
+   fjs.parentNode.insertBefore(js, fjs);
+   }(document, 'script', 'facebook-jssdk'));
+</script>

+ 5 - 0
docs/_includes/plugins/plugin_row.html

@@ -0,0 +1,5 @@
+<div class="pluginRowBlock">
+{% for child in include.children %}
+  {% include plugins/{{child.type}}.html href=child.href text=child.text %}
+{% endfor %}
+</div>

+ 34 - 0
docs/_includes/plugins/post_social_plugins.html

@@ -0,0 +1,34 @@
+<div class="postSocialPlugins">
+  <a
+    href="https://twitter.com/share"
+    class="twitter-share-button"
+    data-url="{{ page.url | replace:'index.html','' | absolute_url }}"
+    data-text="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}"
+    data-hashtags="flowtype">Tweet</a>
+  <div
+    class="fb-like"
+    data-href="{{ page.url | replace:'index.html','' | absolute_url }}"
+    data-layout="button_count"
+    data-action="like"
+    data-show-faces="false"
+    data-share="true"></div>
+</div>
+<script>
+  window.fbAsyncInit = function() {
+  FB.init({
+    appId      : '{{ site.fbappid }}',
+    xfbml      : true,
+    version    : 'v2.2'
+  });
+  };
+
+  (function(d, s, id){
+   var js, fjs = d.getElementsByTagName(s)[0];
+   if (d.getElementById(id)) {return;}
+   js = d.createElement(s); js.id = id;
+   js.src = "//connect.facebook.net/en_US/sdk.js";
+   fjs.parentNode.insertBefore(js, fjs);
+   }(document, 'script', 'facebook-jssdk'));
+</script>
+
+<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>

+ 88 - 0
docs/_includes/plugins/slideshow.html

@@ -0,0 +1,88 @@
+<div class="slideshowBlock pluginWrapper" id="slideshow"></div>
+<script>
+  var slideshowData = [
+    {% for image in site.data.slideshow %}
+    {
+      id         : "{{ image.id }}",
+      imagesrc   : "{{ image.src }}",
+      tooltip    : "{{ image.tooltip }}",
+      href       : "{{ image.link }}",
+    },
+    {% endfor %}
+  ];
+</script>
+<script src="http://fb.me/react-with-addons-0.13.1.min.js"></script>
+<script type="text/javascript">
+  var Slideshow = React.createClass({displayName: "Slideshow",
+    getInitialState: function() {
+      return {
+        currentSlide: 0,
+      };
+    },
+    getDefaultProps: function() {
+      return {
+        data: slideshowData,
+      };
+    },
+    handleSelect: function(id) {
+      var index = this.props.data.map(function (el, elIndex) {
+        return (
+          elIndex
+        );
+      });
+      var currentIndex = index.indexOf(id);
+      this.setState({
+        currentSlide: currentIndex,
+      });
+    },
+    render: function() {
+      return (
+        React.createElement("div", {className: "slideshow"},
+          React.createElement("div", {className: "slides"},
+            this.props.data.map(this.renderSlide)
+          ),
+          React.createElement("div", {className: "pagination"},
+            this.props.data.map(this.renderPager)
+          )
+        )
+      );
+    },
+    renderSlide: function(child, index) {
+      var classes = React.addons.classSet({
+        'slide': true,
+        'slideActive': this.state.currentSlide === index,
+      });
+      if (child.href) {
+        return (
+          React.createElement("div", {key: index, className: classes},
+            React.createElement("a", {href: child.href, alt: child.tooltip, title: child.tooltip},
+              React.createElement("img", {src: child.imagesrc, alt: child.tooltip, title: child.tooltip})
+            )
+          )
+        );
+      }
+      return (
+        React.createElement("div", {key: index, className: classes},
+          React.createElement("img", {src: child.imagesrc, alt: child.tooltip})
+        )
+      );
+    },
+    renderPager: function(child, index) {
+      var classes = React.addons.classSet({
+        'pager': true,
+        'pagerActive': this.state.currentSlide === index,
+      });
+      return (
+        React.createElement("span", {key: index, className: classes, onClick: this.handleSelect.bind(this, index)})
+      );
+    },
+  });
+
+  function render(slideshowData) {
+    React.render(
+      React.createElement(Slideshow, {data: slideshowData}),
+      document.getElementById('slideshow')
+    );
+  }
+  render(slideshowData);
+</script>

+ 5 - 0
docs/_includes/plugins/twitter_follow.html

@@ -0,0 +1,5 @@
+<div class="pluginBlock">
+  <a href="https://twitter.com/{{ include.href }}" class="twitter-follow-button pluginBlock" data-show-count="false">Follow @{{ include.href }}</a>
+</div>
+
+<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>

+ 4 - 0
docs/_includes/plugins/twitter_share.html

@@ -0,0 +1,4 @@
+<div class="pluginWrapper twitterSharePlugin">
+  <a href="https://twitter.com/share" class="twitter-share-button" data-hashtags="{{ site.title| replace: ' ', '' }}">Tweet</a>
+</div>
+<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>

+ 35 - 0
docs/_includes/post.html

@@ -0,0 +1,35 @@
+<div class="post">
+  {% assign author = site.data.authors[page.author] %}
+  <header class="post-header">
+    {% if author.fbid %}
+    <div class="authorPhoto">
+      <img src="http://graph.facebook.com/{{ author.fbid }}/picture/" alt="{{ author.fullname }}" title="{{ author.fullname }}" />
+    </div>
+    {% endif %}
+    {% if author.full_name %}
+    <p class="post-authorName">{{ author.full_name }}</p>
+    {% endif %}
+    <h1 class="post-title">{% if include.truncate %}<a href="{{ page.url | absolute_url }}">{{ page.title }}</a>{% else %}{{ page.title }}{% endif %}</h1>
+    <p class="post-meta">Posted {{ page.date | date: '%B %d, %Y' }}{% if page.meta %} • {{ page.meta }}{% endif %}</p>
+  </header>
+
+  <article class="post-content">
+  {% if include.truncate %}
+    {% if page.content contains '<!--truncate-->' %}
+      {{ page.content | split:'<!--truncate-->' | first | markdownify }}
+      <div class="read-more">
+        <a href="{{ page.url | absolute_url }}" >
+          Read More
+        </a>
+      </div>
+    {% else %}
+      {{ page.content | markdownify }}
+    {% endif %}
+  {% else %}
+    {{ content }}
+  {% endif %}
+  {% unless include.truncate %}
+    {% include plugins/all_share.html %}
+  {% endunless %}
+  </article>
+</div>

+ 28 - 0
docs/_includes/powered_by.html

@@ -0,0 +1,28 @@
+{% if site.data.powered_by.first.items or site.data.powered_by_highlight.first.items %}
+<div class="poweredByContainer">
+  <div class="wrapper mainWrapper poweredByWrapper">
+    {% if site.data.powered_by_highlight.first.title %}
+    <h2>{{ site.data.powered_by_highlight.first.title }}</h2>
+    {% else %}
+    <h2>{{ site.data.powered_by.first.title }}</h2>
+    {% endif %}
+    {% if site.data.powered_by_highlight.first.items %}
+    <div class="poweredByItems">
+      {% for item in site.data.powered_by_highlight.first.items %}
+      <div class="poweredByItem itemLarge">
+        <a href="{{ item.url }}" target="_blank"><img src="{{ item.img }}" alt="{{ item.name }}" /></a>
+      </div>
+      {% endfor %}
+    </div>
+    {% endif %}
+    <div class="poweredByItems">
+      {% for item in site.data.powered_by.first.items %}
+      <div class="poweredByItem itemSmall">
+        <a href="{{ item.url }}" target="_blank">{{ item.name }}</a>
+      </div>
+      {% endfor %}
+    </div>
+    <div class="poweredByMessage">Does your app use {{ site.title }}? Add it to this list with <a href="https://github.com/{{ site.ghrepo }}/edit/gh-pages/_data/powered_by.yml" target="_blank">a pull request!</a></div>
+  </div>
+</div>
+{% endif %}

+ 0 - 0
docs/_includes/social_plugins.html


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است