瀏覽代碼

Check for Inf values in history; roxygen version bump.

bl 8 年之前
父節點
當前提交
1339aada96

+ 1 - 1
R/DESCRIPTION

@@ -31,5 +31,5 @@ Suggests:
     readr
 License: BSD_3_clause + file LICENSE
 LazyData: true
-RoxygenNote: 5.0.1
+RoxygenNote: 6.0.1
 VignetteBuilder: knitr

+ 3 - 0
R/R/prophet.R

@@ -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)

+ 0 - 1
R/man/compile_stan_model.Rd

@@ -16,4 +16,3 @@ Stan model.
 \description{
 Compile Stan model
 }
-

+ 0 - 1
R/man/df_for_plotting.Rd

@@ -14,4 +14,3 @@ df_for_plotting(m, fcst)
 \description{
 Merge history and forecast for plotting.
 }
-

+ 0 - 1
R/man/fit.prophet.Rd

@@ -24,4 +24,3 @@ with the following elements:
   sigma_obs (M array): Noise level.
 Note that M=1 if MAP estimation.
 }
-

+ 0 - 1
R/man/fourier_series.Rd

@@ -19,4 +19,3 @@ Matrix with seasonality features.
 \description{
 Provides Fourier series components with the specified frequency and order.
 }
-

+ 0 - 1
R/man/get_changepoint_matrix.Rd

@@ -15,4 +15,3 @@ array of indexes.
 \description{
 Gets changepoint matrix for history dataframe.
 }
-

+ 0 - 1
R/man/get_prophet_stan_model.Rd

@@ -16,4 +16,3 @@ Stan model.
 \description{
 Load compiled Stan model
 }
-

+ 0 - 1
R/man/linear_growth_init.Rd

@@ -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.
 }
-

+ 0 - 1
R/man/logistic_growth_init.Rd

@@ -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.
 }
-

+ 0 - 1
R/man/make_all_seasonality_features.Rd

@@ -17,4 +17,3 @@ Dataframe with seasonality.
 \description{
 Dataframe with seasonality features.
 }
-

+ 0 - 1
R/man/make_future_dataframe.Rd

@@ -23,4 +23,3 @@ Dataframe that extends forward from the end of m$history for the
 \description{
 Make dataframe with future dates for forecasting.
 }
-

+ 0 - 1
R/man/make_holiday_features.Rd

@@ -17,4 +17,3 @@ A dataframe with a column for each holiday.
 \description{
 Construct a matrix of holiday features.
 }
-

+ 0 - 1
R/man/make_seasonality_features.Rd

@@ -21,4 +21,3 @@ Dataframe with seasonality.
 \description{
 Data frame with seasonality features.
 }
-

+ 0 - 1
R/man/piecewise_linear.Rd

@@ -23,4 +23,3 @@ Vector y(t).
 \description{
 Evaluate the piecewise linear function.
 }
-

+ 0 - 1
R/man/piecewise_logistic.Rd

@@ -25,4 +25,3 @@ Vector y(t).
 \description{
 Evaluate the piecewise logistic function.
 }
-

+ 0 - 1
R/man/plot.prophet.Rd

@@ -41,4 +41,3 @@ plot(m, forecast)
 }
 
 }
-

+ 0 - 1
R/man/plot_holidays.Rd

@@ -19,4 +19,3 @@ A ggplot2 plot.
 \description{
 Plot the holidays component of the forecast.
 }
-

+ 0 - 1
R/man/plot_trend.Rd

@@ -20,4 +20,3 @@ A ggplot2 plot.
 \description{
 Plot the prophet trend.
 }
-

+ 0 - 1
R/man/plot_weekly.Rd

@@ -21,4 +21,3 @@ A ggplot2 plot.
 \description{
 Plot the weekly component of the forecast.
 }
-

+ 0 - 1
R/man/plot_yearly.Rd

@@ -21,4 +21,3 @@ A ggplot2 plot.
 \description{
 Plot the yearly component of the forecast.
 }
-

+ 0 - 1
R/man/predict.prophet.Rd

@@ -32,4 +32,3 @@ plot(m, forecast)
 }
 
 }
-

+ 0 - 1
R/man/predict_seasonal_components.Rd

@@ -17,4 +17,3 @@ Dataframe with seasonal components.
 \description{
 Predict seasonality broken down into components.
 }
-

+ 0 - 1
R/man/predict_trend.Rd

@@ -17,4 +17,3 @@ Vector with trend on prediction dates.
 \description{
 Predict trend using the prophet model.
 }
-

+ 0 - 1
R/man/predict_uncertainty.Rd

@@ -17,4 +17,3 @@ Dataframe with uncertainty intervals.
 \description{
 Prophet uncertainty intervals.
 }
-

+ 0 - 1
R/man/prophet.Rd

@@ -79,4 +79,3 @@ m <- prophet(history)
 }
 
 }
-

+ 0 - 1
R/man/prophet_plot_components.Rd

@@ -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.
 }
-

+ 0 - 1
R/man/sample_model.Rd

@@ -21,4 +21,3 @@ List of trend, seasonality, and yhat, each a vector like df$t.
 \description{
 Simulate observations from the extrapolated generative model.
 }
-

+ 0 - 1
R/man/sample_predictive_trend.Rd

@@ -19,4 +19,3 @@ Vector of simulated trend over df$t.
 \description{
 Simulate the trend using the extrapolated generative model.
 }
-

+ 0 - 1
R/man/set_auto_seasonalities.Rd

@@ -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.
 }
-

+ 0 - 1
R/man/set_changepoints.Rd

@@ -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.
 }
-

+ 0 - 1
R/man/setup_dataframe.Rd

@@ -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.
 }
-

+ 0 - 1
R/man/validate_inputs.Rd

@@ -12,4 +12,3 @@ validate_inputs(m)
 \description{
 Validates the inputs to Prophet.
 }
-

+ 2 - 0
python/fbprophet/forecaster.py

@@ -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)