mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-07-28 20:11:27 +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
|
||||
License: BSD_3_clause + file LICENSE
|
||||
LazyData: true
|
||||
RoxygenNote: 5.0.1
|
||||
RoxygenNote: 6.0.1
|
||||
VignetteBuilder: knitr
|
||||
|
|
|
|||
|
|
@ -514,6 +514,9 @@ fit.prophet <- function(m, df, ...) {
|
|||
}
|
||||
history <- df %>%
|
||||
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))
|
||||
|
||||
out <- setup_dataframe(m, history, initialize_scales = TRUE)
|
||||
|
|
|
|||
|
|
@ -16,4 +16,3 @@ Stan model.
|
|||
\description{
|
||||
Compile Stan model
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,4 +14,3 @@ df_for_plotting(m, fcst)
|
|||
\description{
|
||||
Merge history and forecast for plotting.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,4 +24,3 @@ with the following elements:
|
|||
sigma_obs (M array): Noise level.
|
||||
Note that M=1 if MAP estimation.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,4 +19,3 @@ Matrix with seasonality features.
|
|||
\description{
|
||||
Provides Fourier series components with the specified frequency and order.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,4 +15,3 @@ array of indexes.
|
|||
\description{
|
||||
Gets changepoint matrix for history dataframe.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,4 +16,3 @@ Stan model.
|
|||
\description{
|
||||
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
|
||||
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
|
||||
last points in the time series.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,4 +17,3 @@ Dataframe with seasonality.
|
|||
\description{
|
||||
Dataframe with seasonality features.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,4 +23,3 @@ Dataframe that extends forward from the end of m$history for the
|
|||
\description{
|
||||
Make dataframe with future dates for forecasting.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,4 +17,3 @@ A dataframe with a column for each holiday.
|
|||
\description{
|
||||
Construct a matrix of holiday features.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,4 +21,3 @@ Dataframe with seasonality.
|
|||
\description{
|
||||
Data frame with seasonality features.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,4 +23,3 @@ Vector y(t).
|
|||
\description{
|
||||
Evaluate the piecewise linear function.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,4 +25,3 @@ Vector y(t).
|
|||
\description{
|
||||
Evaluate the piecewise logistic function.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,4 +41,3 @@ plot(m, forecast)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,4 +19,3 @@ A ggplot2 plot.
|
|||
\description{
|
||||
Plot the holidays component of the forecast.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,4 +20,3 @@ A ggplot2 plot.
|
|||
\description{
|
||||
Plot the prophet trend.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,4 +21,3 @@ A ggplot2 plot.
|
|||
\description{
|
||||
Plot the weekly component of the forecast.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,4 +21,3 @@ A ggplot2 plot.
|
|||
\description{
|
||||
Plot the yearly component of the forecast.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,4 +32,3 @@ plot(m, forecast)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,4 +17,3 @@ Dataframe with seasonal components.
|
|||
\description{
|
||||
Predict seasonality broken down into components.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,4 +17,3 @@ Vector with trend on prediction dates.
|
|||
\description{
|
||||
Predict trend using the prophet model.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,4 +17,3 @@ Dataframe with uncertainty intervals.
|
|||
\description{
|
||||
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
|
||||
present, and holidays if present.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,4 +21,3 @@ List of trend, seasonality, and yhat, each a vector like df$t.
|
|||
\description{
|
||||
Simulate observations from the extrapolated generative model.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,4 +19,3 @@ Vector of simulated trend over df$t.
|
|||
\description{
|
||||
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
|
||||
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.
|
||||
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
|
||||
and predicting.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,4 +12,3 @@ validate_inputs(m)
|
|||
\description{
|
||||
Validates the inputs to Prophet.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -490,6 +490,8 @@ class Prophet(object):
|
|||
raise Exception('Prophet object can only be fit once. '
|
||||
'Instantiate a new object.')
|
||||
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()
|
||||
|
||||
history = self.setup_dataframe(history, initialize_scales=True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue