mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-11-18 08:53:42 +00:00
Check for Inf values in history; roxygen version bump.
This commit is contained in:
parent
efe8299c0a
commit
1339aada96
34 changed files with 6 additions and 32 deletions
|
|
@ -31,5 +31,5 @@ Suggests:
|
||||||
readr
|
readr
|
||||||
License: BSD_3_clause + file LICENSE
|
License: BSD_3_clause + file LICENSE
|
||||||
LazyData: true
|
LazyData: true
|
||||||
RoxygenNote: 5.0.1
|
RoxygenNote: 6.0.1
|
||||||
VignetteBuilder: knitr
|
VignetteBuilder: knitr
|
||||||
|
|
|
||||||
|
|
@ -514,6 +514,9 @@ fit.prophet <- function(m, df, ...) {
|
||||||
}
|
}
|
||||||
history <- df %>%
|
history <- df %>%
|
||||||
dplyr::filter(!is.na(y))
|
dplyr::filter(!is.na(y))
|
||||||
|
if (any(is.infinite(history$y))) {
|
||||||
|
stop("Found infinity in column y.")
|
||||||
|
}
|
||||||
m$history.dates <- sort(zoo::as.Date(df$ds))
|
m$history.dates <- sort(zoo::as.Date(df$ds))
|
||||||
|
|
||||||
out <- setup_dataframe(m, history, initialize_scales = TRUE)
|
out <- setup_dataframe(m, history, initialize_scales = TRUE)
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,3 @@ Stan model.
|
||||||
\description{
|
\description{
|
||||||
Compile Stan model
|
Compile Stan model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,3 @@ df_for_plotting(m, fcst)
|
||||||
\description{
|
\description{
|
||||||
Merge history and forecast for plotting.
|
Merge history and forecast for plotting.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,4 +24,3 @@ with the following elements:
|
||||||
sigma_obs (M array): Noise level.
|
sigma_obs (M array): Noise level.
|
||||||
Note that M=1 if MAP estimation.
|
Note that M=1 if MAP estimation.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,3 @@ Matrix with seasonality features.
|
||||||
\description{
|
\description{
|
||||||
Provides Fourier series components with the specified frequency and order.
|
Provides Fourier series components with the specified frequency and order.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,4 +15,3 @@ array of indexes.
|
||||||
\description{
|
\description{
|
||||||
Gets changepoint matrix for history dataframe.
|
Gets changepoint matrix for history dataframe.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,3 @@ Stan model.
|
||||||
\description{
|
\description{
|
||||||
Load compiled Stan model
|
Load compiled Stan model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,3 @@ Provides a strong initialization for linear growth by calculating the
|
||||||
growth and offset parameters that pass the function through the first and
|
growth and offset parameters that pass the function through the first and
|
||||||
last points in the time series.
|
last points in the time series.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,3 @@ Provides a strong initialization for logistic growth by calculating the
|
||||||
growth and offset parameters that pass the function through the first and
|
growth and offset parameters that pass the function through the first and
|
||||||
last points in the time series.
|
last points in the time series.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,3 @@ Dataframe with seasonality.
|
||||||
\description{
|
\description{
|
||||||
Dataframe with seasonality features.
|
Dataframe with seasonality features.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,4 +23,3 @@ Dataframe that extends forward from the end of m$history for the
|
||||||
\description{
|
\description{
|
||||||
Make dataframe with future dates for forecasting.
|
Make dataframe with future dates for forecasting.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,3 @@ A dataframe with a column for each holiday.
|
||||||
\description{
|
\description{
|
||||||
Construct a matrix of holiday features.
|
Construct a matrix of holiday features.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,3 @@ Dataframe with seasonality.
|
||||||
\description{
|
\description{
|
||||||
Data frame with seasonality features.
|
Data frame with seasonality features.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,4 +23,3 @@ Vector y(t).
|
||||||
\description{
|
\description{
|
||||||
Evaluate the piecewise linear function.
|
Evaluate the piecewise linear function.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,3 @@ Vector y(t).
|
||||||
\description{
|
\description{
|
||||||
Evaluate the piecewise logistic function.
|
Evaluate the piecewise logistic function.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,4 +41,3 @@ plot(m, forecast)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,3 @@ A ggplot2 plot.
|
||||||
\description{
|
\description{
|
||||||
Plot the holidays component of the forecast.
|
Plot the holidays component of the forecast.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,4 +20,3 @@ A ggplot2 plot.
|
||||||
\description{
|
\description{
|
||||||
Plot the prophet trend.
|
Plot the prophet trend.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,3 @@ A ggplot2 plot.
|
||||||
\description{
|
\description{
|
||||||
Plot the weekly component of the forecast.
|
Plot the weekly component of the forecast.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,3 @@ A ggplot2 plot.
|
||||||
\description{
|
\description{
|
||||||
Plot the yearly component of the forecast.
|
Plot the yearly component of the forecast.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,4 +32,3 @@ plot(m, forecast)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,3 @@ Dataframe with seasonal components.
|
||||||
\description{
|
\description{
|
||||||
Predict seasonality broken down into components.
|
Predict seasonality broken down into components.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,3 @@ Vector with trend on prediction dates.
|
||||||
\description{
|
\description{
|
||||||
Predict trend using the prophet model.
|
Predict trend using the prophet model.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,3 @@ Dataframe with uncertainty intervals.
|
||||||
\description{
|
\description{
|
||||||
Prophet uncertainty intervals.
|
Prophet uncertainty intervals.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,4 +79,3 @@ m <- prophet(history)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,4 +36,3 @@ Plot the components of a prophet forecast.
|
||||||
Prints a ggplot2 with panels for trend, weekly and yearly seasonalities if
|
Prints a ggplot2 with panels for trend, weekly and yearly seasonalities if
|
||||||
present, and holidays if present.
|
present, and holidays if present.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,3 @@ List of trend, seasonality, and yhat, each a vector like df$t.
|
||||||
\description{
|
\description{
|
||||||
Simulate observations from the extrapolated generative model.
|
Simulate observations from the extrapolated generative model.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,3 @@ Vector of simulated trend over df$t.
|
||||||
\description{
|
\description{
|
||||||
Simulate the trend using the extrapolated generative model.
|
Simulate the trend using the extrapolated generative model.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,3 @@ Turns on yearly seasonality if there is >=2 years of history.
|
||||||
Turns on weekly seasonality if there is >=2 weeks of history, and the
|
Turns on weekly seasonality if there is >=2 weeks of history, and the
|
||||||
spacing between dates in the history is <7 days.
|
spacing between dates in the history is <7 days.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,4 +20,3 @@ Sets m$changepoints to the dates of changepoints. Either:
|
||||||
2) We are generating a grid of them.
|
2) We are generating a grid of them.
|
||||||
3) The user prefers no changepoints be used.
|
3) The user prefers no changepoints be used.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,3 @@ Adds a time index and scales y. Creates auxillary columns 't', 't_ix',
|
||||||
'y_scaled', and 'cap_scaled'. These columns are used during both fitting
|
'y_scaled', and 'cap_scaled'. These columns are used during both fitting
|
||||||
and predicting.
|
and predicting.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,4 +12,3 @@ validate_inputs(m)
|
||||||
\description{
|
\description{
|
||||||
Validates the inputs to Prophet.
|
Validates the inputs to Prophet.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -490,6 +490,8 @@ class Prophet(object):
|
||||||
raise Exception('Prophet object can only be fit once. '
|
raise Exception('Prophet object can only be fit once. '
|
||||||
'Instantiate a new object.')
|
'Instantiate a new object.')
|
||||||
history = df[df['y'].notnull()].copy()
|
history = df[df['y'].notnull()].copy()
|
||||||
|
if np.isinf(history['y'].values).any():
|
||||||
|
raise ValueError('Found infinity in column y.')
|
||||||
self.history_dates = pd.to_datetime(df['ds']).sort_values()
|
self.history_dates = pd.to_datetime(df['ds']).sort_values()
|
||||||
|
|
||||||
history = self.setup_dataframe(history, initialize_scales=True)
|
history = self.setup_dataframe(history, initialize_scales=True)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue