Selaa lähdekoodia

Generate documentation sub-menus

Sean J. Taylor 6 vuotta sitten
vanhempi
commit
40afef26b4

+ 6 - 1
docs/_docs/contributing.md

@@ -3,6 +3,9 @@ layout: docs
 docid: "contributing"
 title: "Getting Help and Contributing"
 permalink: /docs/contributing.html
+subsections:
+  - id: documentation
+    title: Generating documentation
 ---
 
 Prophet has a non-fixed release cycle but we will be making bugfixes in response to user feedback and adding features.  Its current state is Beta (v0.3), we expect no obvious bugs. Please let us know if you encounter a bug by [filing an issue](https://github.com/facebook/prophet/issues). Github issues is also the right place to ask questions about using Prophet.
@@ -13,7 +16,9 @@ If you plan to contribute new features or extensions to the core, please first o
 
 The R and Python versions are kept feature identical, but new features can be implemented for each method in separate commits.
 
-## Documentation
+<a id="documentation"> </a>
+
+## Generating documentation
 
 Most of the `doc` pages are generated from [Jupyter notebooks](http://jupyter.org/) in the [notebooks](https://github.com/facebook/prophet/tree/master/notebooks) directory at the base of the source tree.  Please make changes there and then rebuild the docs:
 

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 14 - 0
docs/_docs/diagnostics.md


+ 9 - 0
docs/_docs/installation.md

@@ -3,10 +3,17 @@ layout: docs
 docid: "installation"
 title: "Installation"
 permalink: /docs/installation.html
+subsections:
+  - id: r
+    title: Using R
+  - id: python
+    title: Using Python
 ---
 
 Prophet has two implementations: [R](#installation-in-r) and [Python](#installation-in-python).  Note the slight name difference for the Python package.
 
+<a href="#r"></a>
+
 ## Installation in R
 
 Prophet is a [CRAN package](https://cran.r-project.org/package=prophet) so you can use `install.packages`:
@@ -24,6 +31,8 @@ On Windows, R requires a compiler so you'll need to [follow the instructions](ht
 
 If you have custom Stan compiler settings, install from source rather than the CRAN binary.
 
+<a href="#python"></a>
+
 ## Installation in Python
 
 Prophet is on PyPI, so you can use pip to install it:

+ 10 - 0
docs/_docs/multiplicative_seasonality.md

@@ -3,9 +3,11 @@ layout: docs
 docid: "multiplicative_seasonality"
 title: "Multiplicative Seasonality"
 permalink: /docs/multiplicative_seasonality.html
+subsections:
 ---
 By default Prophet fits additive seasonalities, meaning the effect of the seasonality is added to the trend to get the forecast. This time series of the number of air passengers is an example of when additive seasonality does not work:
 
+
 ```R
 # R
 df <- read.csv('../examples/example_air_passengers.csv')
@@ -29,8 +31,11 @@ fig = m.plot(forecast)
 
 This time series has a clear yearly cycle, but the seasonality in the forecast is too large at the start of the time series and too small at the end. In this time series, the seasonality is not a constant additive factor as assumed by Prophet, rather it grows with the trend. This is multiplicative seasonality.
 
+
+
 Prophet can model multiplicative seasonality by setting `seasonality_mode='multiplicative'` in the input arguments:
 
+
 ```R
 # R
 m <- prophet(df, seasonality.mode = 'multiplicative')
@@ -50,6 +55,7 @@ fig = m.plot(forecast)
 
 The components figure will now show the seasonality as a percent of the trend:
 
+
 ```R
 # R
 prophet_plot_components(m, forecast)
@@ -64,8 +70,11 @@ fig = m.plot_components(forecast)
 
 With `seasonality_mode='multiplicative'`, holiday effects will also be modeled as multiplicative. Any added seasonalities or extra regressors will by default use whatever `seasonality_mode` is set to, but can be overriden by specifying `mode='additive'` or `mode='multiplicative'` as an argument when adding the seasonality or regressor.
 
+
+
 For example, this block sets the built-in seasonalities to multiplicative, but includes an additive quarterly seasonality and an additive regressor:
 
+
 ```R
 # R
 m <- prophet(seasonality.mode = 'multiplicative')
@@ -79,3 +88,4 @@ m.add_seasonality('quarterly', period=91.25, fourier_order=8, mode='additive')
 m.add_regressor('regressor', mode='additive')
 ```
 Additive and multiplicative extra regressors will show up in separate panels on the components plot.
+

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 28 - 0
docs/_docs/non-daily_data.md


+ 7 - 0
docs/_docs/outliers.md

@@ -3,9 +3,11 @@ layout: docs
 docid: "outliers"
 title: "Outliers"
 permalink: /docs/outliers.html
+subsections:
 ---
 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_log_R_outliers1.csv')
@@ -29,8 +31,11 @@ fig = m.plot(forecast)
 
 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')
@@ -52,6 +57,7 @@ fig = model.plot(model.predict(future))
 
 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_log_R_outliers2.csv')
@@ -75,6 +81,7 @@ fig = m.plot(forecast)
 
 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')

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 35 - 0
docs/_docs/quick_start.md


+ 25 - 0
docs/_docs/saturating_forecasts.md

@@ -3,13 +3,25 @@ layout: docs
 docid: "saturating_forecasts"
 title: "Saturating Forecasts"
 permalink: /docs/saturating_forecasts.html
+subsections:
+  - title: Forecasting Growth
+    id: forecasting-growth
+  - title: Saturating Minimum
+    id: saturating-minimum
 ---
+<a id="forecasting-growth"> </a>
+
 ### Forecasting Growth
 
+
+
 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:
 
+
 ```R
 # R
 df <- read.csv('../examples/example_wp_log_R.csv')
@@ -20,6 +32,7 @@ df = pd.read_csv('../examples/example_wp_log_R.csv')
 ```
 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.
 
+
 ```R
 # R
 df$cap <- 8.5
@@ -30,8 +43,11 @@ 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:
 
+
 ```R
 # R
 m <- prophet(df, growth = 'logistic')
@@ -43,6 +59,7 @@ m.fit(df)
 ```
 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:
 
+
 ```R
 # R
 future <- make_future_dataframe(m, periods = 1826)
@@ -63,10 +80,17 @@ fig = m.plot(fcst)
 
 The logistic function has an implicit minimum of 0, and will saturate at 0 the same way that it saturates at the capacity. It is possible to also specify a different saturating minimum.
 
+
+
+<a id="saturating-minimum"> </a>
+
 ### Saturating Minimum
 
+
+
 The logistic growth model can also handle a saturating minimum, which is specified with a column `floor` in the same way as the `cap` column specifies the maximum:
 
+
 ```R
 # R
 df$y <- 10 - df$y
@@ -95,3 +119,4 @@ fig = m.plot(fcst)
 
 
 To use a logistic growth trend with a saturating minimum, a maximum capacity must also be specified.
+

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 62 - 1
docs/_docs/seasonality,_holiday_effects,_and_regressors.md


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 24 - 0
docs/_docs/trend_changepoints.md


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 26 - 0
docs/_docs/uncertainty_intervals.md


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

@@ -2,4 +2,13 @@
     <a class="navItem {% if page.url == groupitem.url %} navItemActive {% endif %}" href="{{ groupitem.url | absolute_url }}">
         {{ groupitem.title }}
     </a>
+    {% if groupitem.subsections %}
+    <ul class="navListSubItems">
+    {% for sub in groupitem.subsections %}
+    <li class="navListSubItem">
+    <a class="navItem" href="{{ groupitem.url | absolute_url }}#{{ sub.id }}">{{ sub.title }}</a>
+    </li>
+    {% endfor %}
+    </ul>
+    {% endif %}
 </li>

+ 23 - 3
docs/_sass/_react_docs_nav.scss

@@ -166,6 +166,11 @@ nav.toc {
           display: block;
           padding-bottom: 10px;
           padding-top: 10px;
+
+          .navListSubItems {
+            padding-bottom: 0px;
+            padding-top: 0px;
+          }
         }
 
         h3 {
@@ -181,7 +186,7 @@ nav.toc {
 
     ul {
       padding-left: 0;
-      padding-right: 24px;
+      padding-right: 18px;
 
       li {
         list-style-type: none;
@@ -194,8 +199,8 @@ nav.toc {
           display: inline-block;
           font-size: 14px;
           line-height: 1.1em;
-          margin: 2px 10px 5px;
-          padding: 5px 0 2px;
+          margin: 2px 10px 2px;
+          padding: 1px 0 1px;
           transition: color 0.3s;
 
           &:hover,
@@ -207,6 +212,20 @@ nav.toc {
             color: $primary-bg;
             font-weight: 900;
           }
+
+          &.navItem {
+            font-weight: bold;
+          }
+
+        }
+
+        .navListSubItem {
+          padding-top: 0;
+          margin-left: 20px;
+
+          a.navItem {
+            font-weight: normal;
+          }
         }
       }
     }
@@ -329,4 +348,5 @@ nav.toc {
       padding: 0 10px;
     }
   }
+
 }

+ 18 - 1
docs/nbconvert_template.tpl

@@ -6,6 +6,13 @@ layout: docs
 docid: "{{resources['metadata']['name']}}"
 title: "{{resources['metadata']['name'].replace('_', ' ').title()}}"
 permalink: /docs/{{resources['metadata']['name']}}.html
+subsections:
+{%- for cell in nb['cells'] if cell.cell_type == 'markdown' and '##' in cell.source -%}
+{% for line in cell.source.split('\n') if line.startswith('##') %}
+  - title: {{ line.lstrip('# ') }}
+    id: {{ line.lstrip('# ').lower().replace(' ', '-') }}
+{%- endfor -%}
+{% endfor %}
 ---
 {%- endblock header -%}
 
@@ -43,4 +50,14 @@ permalink: /docs/{{resources['metadata']['name']}}.html
 
 {% block data_png %} 
 ![png](/prophet/static/{{ output.metadata.filenames['image/png'] }}) 
-{% endblock data_png %}
+{% endblock data_png %}
+
+{% block markdowncell %}
+{%- set lines = cell.source.split('\n') -%}
+{%- for line in lines -%}
+{% if line.startswith('##') %}
+<a id="{{ line.lstrip('# ').lower().replace(' ', '-') }}"> </a>
+{% endif %}
+{{ line }}
+{% endfor %}
+{% endblock markdowncell %}