mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-11-18 08:53:42 +00:00
Add error message if make_future_dataframe before fit
This commit is contained in:
parent
4628bcd801
commit
7b9acd953f
2 changed files with 5 additions and 0 deletions
|
|
@ -1379,6 +1379,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) {
|
||||||
|
|
|
||||||
|
|
@ -1214,6 +1214,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,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue