"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "notebooks/seasonality,_holiday_effects,_and_regressors.ipynb" between
prophet-1.1.tar.gz and prophet-1.1.1.tar.gz

About: Prophet is a tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.

seasonality,_holiday_effects,_and_regressors.ipynb  (prophet-1.1):seasonality,_holiday_effects,_and_regressors.ipynb  (prophet-1.1.1)
skipping to change at line 13 skipping to change at line 13
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 1,
"metadata": { "metadata": {
"block_hidden": true "block_hidden": true
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"%load_ext rpy2.ipython\n", "%load_ext rpy2.ipython\n",
"%matplotlib inline\n", "%matplotlib inline\n",
"\n",
"from prophet import Prophet\n", "from prophet import Prophet\n",
"import pandas as pd\n",
"from matplotlib import pyplot as plt\n", "from matplotlib import pyplot as plt\n",
"import pandas as pd\n",
"import logging\n", "import logging\n",
"logging.getLogger('prophet').setLevel(logging.ERROR)\n",
"import warnings\n", "import warnings\n",
"\n",
"logging.getLogger('prophet').setLevel(logging.ERROR)\n",
"warnings.filterwarnings(\"ignore\")" "warnings.filterwarnings(\"ignore\")"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"metadata": { "metadata": {
"block_hidden": true "block_hidden": true
}, },
"outputs": [ "outputs": [
{ {
"name": "stderr", "name": "stderr",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"INFO:numexpr.utils:NumExpr defaulting to 8 threads.\n" "INFO:numexpr.utils:NumExpr defaulting to 8 threads.\n"
] ]
} }
], ],
"source": [ "source": [
"df = pd.read_csv('../examples/example_wp_log_peyton_manning.csv')\n", "df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/e xamples/example_wp_log_peyton_manning.csv')\n",
"m = Prophet()\n", "m = Prophet()\n",
"m.fit(df)\n", "m.fit(df)\n",
"future = m.make_future_dataframe(periods=366)" "future = m.make_future_dataframe(periods=366)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"metadata": { "metadata": {
"block_hidden": true "block_hidden": true
skipping to change at line 67 skipping to change at line 69
"R[write to console]: Loading required package: rlang\n", "R[write to console]: Loading required package: rlang\n",
"\n", "\n",
"R[write to console]: Disabling daily seasonality. Run prophet with daily. seasonality=TRUE to override this.\n", "R[write to console]: Disabling daily seasonality. Run prophet with daily. seasonality=TRUE to override this.\n",
"\n" "\n"
] ]
} }
], ],
"source": [ "source": [
"%%R\n", "%%R\n",
"library(prophet)\n", "library(prophet)\n",
"df <- read.csv('../examples/example_wp_log_peyton_manning.csv')\n", "df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/exa mples/example_wp_log_peyton_manning.csv')\n",
"m <- prophet(df)\n", "m <- prophet(df)\n",
"future <- make_future_dataframe(m, periods=366)" "future <- make_future_dataframe(m, periods=366)"
] ]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"### Modeling Holidays and Special Events\n", "### Modeling Holidays and Special Events\n",
"If you have holidays or other recurring events that you'd like to model, yo u 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 fu ture (out as far as the forecast is being made). If they won't repeat in the fut ure, Prophet will model them and then not include them in the forecast.\n", "If you have holidays or other recurring events that you'd like to model, yo u 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 fu ture (out as far as the forecast is being made). If they won't repeat in the fut ure, Prophet will model them and then not include them in the forecast.\n",
skipping to change at line 1225 skipping to change at line 1227
"\n", "\n",
"#### Coefficients of additional regressors\n", "#### Coefficients of additional regressors\n",
"\n", "\n",
"To extract the beta coefficients of the extra regressors, use the utility f unction `regressor_coefficients` (`from prophet.utilities import regressor_coeff icients` in Python, `prophet::regressor_coefficients` in R) on the fitted model. The estimated beta coefficient for each regressor roughly represents the increa se in prediction value for a unit increase in the regressor value (note that the coefficients returned are always on the scale of the original data). If `mcmc_s amples` is specified, a credible interval for each coefficient is also returned, which can help identify whether each regressor is \"statistically significant\" ." "To extract the beta coefficients of the extra regressors, use the utility f unction `regressor_coefficients` (`from prophet.utilities import regressor_coeff icients` in Python, `prophet::regressor_coefficients` in R) on the fitted model. The estimated beta coefficient for each regressor roughly represents the increa se in prediction value for a unit increase in the regressor value (note that the coefficients returned are always on the scale of the original data). If `mcmc_s amples` is specified, a credible interval for each coefficient is also returned, which can help identify whether each regressor is \"statistically significant\" ."
] ]
} }
], ],
"metadata": { "metadata": {
"celltoolbar": "Edit Metadata", "celltoolbar": "Edit Metadata",
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 3 (ipykernel)",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
"name": "ipython", "name": "ipython",
"version": 3 "version": 3
}, },
"file_extension": ".py", "file_extension": ".py",
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.8.3" "version": "3.8.10"
} }
}, },
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 1 "nbformat_minor": 4
} }
 End of changes. 10 change blocks. 
7 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)