mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-11-17 08:40:56 +00:00
Merge in some minor fixes from master
This commit is contained in:
parent
aa4e223152
commit
0c30f6efcf
3 changed files with 14 additions and 4 deletions
|
|
@ -321,7 +321,8 @@ setup_dataframe <- function(m, df, initialize_scales = FALSE) {
|
||||||
df$ds <- set_date(df$ds)
|
df$ds <- set_date(df$ds)
|
||||||
if (anyNA(df$ds)) {
|
if (anyNA(df$ds)) {
|
||||||
stop(paste('Unable to parse date format in column ds. Convert to date ',
|
stop(paste('Unable to parse date format in column ds. Convert to date ',
|
||||||
'format. Either %Y-%m-%d or %Y-%m-%d %H:%M:%S'))
|
'format (%Y-%m-%d or %Y-%m-%d %H:%M:%S) and check that there',
|
||||||
|
'are no NAs.'))
|
||||||
}
|
}
|
||||||
for (name in names(m$extra_regressors)) {
|
for (name in names(m$extra_regressors)) {
|
||||||
if (!(name %in% colnames(df))) {
|
if (!(name %in% colnames(df))) {
|
||||||
|
|
@ -1361,6 +1362,9 @@ make_future_dataframe <- function(m, periods, freq = 'day',
|
||||||
if (freq == 'm') {
|
if (freq == 'm') {
|
||||||
freq <- 'month'
|
freq <- 'month'
|
||||||
}
|
}
|
||||||
|
if (is.null(m$history.dates)) {
|
||||||
|
stop('Model must be fit before this can be used.')
|
||||||
|
}
|
||||||
dates <- seq(max(m$history.dates), length.out = periods + 1, by = freq)
|
dates <- seq(max(m$history.dates), length.out = periods + 1, by = freq)
|
||||||
dates <- dates[2:(periods + 1)] # Drop the first, which is max(history$ds)
|
dates <- dates[2:(periods + 1)] # Drop the first, which is max(history$ds)
|
||||||
if (include_history) {
|
if (include_history) {
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ On Windows, PyStan requires a compiler so you'll need to [follow the instruction
|
||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
Make sure compilers (gcc, g++) and Python development tools (python-dev) are installed. If you are using a VM, be aware that you will need at least 4GB of memory to install fbprophet, and at least 2GB of memory to use fbprophet.
|
Make sure compilers (gcc, g++, build-essential) and Python development tools (python-dev, python3-dev) are installed. If you are using a VM, be aware that you will need at least 4GB of memory to install fbprophet, and at least 2GB of memory to use fbprophet.
|
||||||
|
|
||||||
### Anaconda
|
### Anaconda
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,9 +162,9 @@ class Prophet(object):
|
||||||
raise ValueError('Holidays must have both lower_window and ' +
|
raise ValueError('Holidays must have both lower_window and ' +
|
||||||
'upper_window, or neither')
|
'upper_window, or neither')
|
||||||
if has_lower:
|
if has_lower:
|
||||||
if max(self.holidays['lower_window']) > 0:
|
if self.holidays['lower_window'].max() > 0:
|
||||||
raise ValueError('Holiday lower_window should be <= 0')
|
raise ValueError('Holiday lower_window should be <= 0')
|
||||||
if min(self.holidays['upper_window']) < 0:
|
if self.holidays['upper_window'].min() < 0:
|
||||||
raise ValueError('Holiday upper_window should be >= 0')
|
raise ValueError('Holiday upper_window should be >= 0')
|
||||||
for h in self.holidays['holiday'].unique():
|
for h in self.holidays['holiday'].unique():
|
||||||
self.validate_column_name(h, check_holidays=False)
|
self.validate_column_name(h, check_holidays=False)
|
||||||
|
|
@ -1218,6 +1218,8 @@ class Prophet(object):
|
||||||
pd.Dataframe that extends forward from the end of self.history for the
|
pd.Dataframe that extends forward from the end of self.history for the
|
||||||
requested number of periods.
|
requested number of periods.
|
||||||
"""
|
"""
|
||||||
|
if self.history_dates is None:
|
||||||
|
raise Exception('Model must be fit before this can be used.')
|
||||||
last_date = self.history_dates.max()
|
last_date = self.history_dates.max()
|
||||||
dates = pd.date_range(
|
dates = pd.date_range(
|
||||||
start=last_date,
|
start=last_date,
|
||||||
|
|
@ -1307,6 +1309,9 @@ class Prophet(object):
|
||||||
fig, axes = plt.subplots(npanel, 1, facecolor='w',
|
fig, axes = plt.subplots(npanel, 1, facecolor='w',
|
||||||
figsize=(9, 3 * npanel))
|
figsize=(9, 3 * npanel))
|
||||||
|
|
||||||
|
if npanel == 1:
|
||||||
|
axes = [axes]
|
||||||
|
|
||||||
for ax, plot in zip(axes, components):
|
for ax, plot in zip(axes, components):
|
||||||
if plot == 'trend':
|
if plot == 'trend':
|
||||||
self.plot_forecast_component(
|
self.plot_forecast_component(
|
||||||
|
|
@ -1468,6 +1473,7 @@ class Prophet(object):
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
----------
|
----------
|
||||||
|
name: Seasonality name, like 'daily', 'weekly'.
|
||||||
ax: Optional matplotlib Axes to plot on. One will be created if
|
ax: Optional matplotlib Axes to plot on. One will be created if
|
||||||
this is not provided.
|
this is not provided.
|
||||||
uncertainty: Optional boolean to plot uncertainty intervals.
|
uncertainty: Optional boolean to plot uncertainty intervals.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue