Loading...

verticapy.machine_learning.vertica.tsa.ensemble.TimeSeriesByCategory.report#

TimeSeriesByCategory.report(metrics: str | Literal[None, 'anova', 'details'] | list[Literal['aic', 'bic', 'r2', 'rsquared', 'mae', 'mean_absolute_error', 'mse', 'mean_squared_error', 'msle', 'mean_squared_log_error', 'max', 'max_error', 'median', 'median_absolute_error', 'var', 'explained_variance']] | None = None, start: int | None = None, npredictions: int | None = None, method: Literal['auto', 'forecast'] = 'auto') float | TableSample#

Computes a regression report using multiple metrics to evaluate the model (r2, mse, max error…).

Parameters#

metrics: str | list, optional

The metrics used to compute the regression report.

  • None:

    Computes the model different metrics.

  • anova:

    Computes the model ANOVA table.

  • details:

    Computes the model details.

It can also be a list of the metrics used to compute the final report.

  • aic:

    Akaike’s Information Criterion

    \[AIC = 2k - 2\ln(\hat{L})\]
  • bic:

    Bayesian Information Criterion

    \[BIC = -2\ln(\hat{L}) + k \ln(n)\]
  • max:

    Max Error.

    \[ME = \max_{i=1}^{n} \left| y_i - \hat{y}_i \right|\]
  • mae:

    Mean Absolute Error.

    \[MAE = \frac{1}{n} \sum_{i=1}^{n} \left| y_i - \hat{y}_i \right|\]
  • median:

    Median Absolute Error.

    \[MedAE = \text{median}_{i=1}^{n} \left| y_i - \hat{y}_i \right|\]
  • mse:

    Mean Squared Error.

    \[MsE = \frac{1}{n} \sum_{i=1}^{n} \left( y_i - \hat{y}_i \right)^2\]
  • msle:

    Mean Squared Log Error.

    \[MSLE = \frac{1}{n} \sum_{i=1}^{n} (\log(1 + y_i) - \log(1 + \hat{y}_i))^2\]
  • r2:

    R squared coefficient.

    \[R^2 = 1 - \frac{\sum_{i=1}^{n} (y_i - \hat{y}_i)^2}{\sum_{i=1}^{n} (y_i - \bar{y})^2}\]
  • r2a:

    R2 adjusted

    \[\text{Adjusted } R^2 = 1 - \frac{(1 - R^2)(n - 1)}{n - k - 1}\]
  • qe:

    quantile error, the quantile must be included in the name. Example: qe50.1% will return the quantile error using q=0.501.

  • rmse:

    Root-mean-squared error

    \[RMSE = \sqrt{\frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2}\]
  • var:

    Explained Variance

    \[\text{Explained Variance} = 1 - \frac{Var(y - \hat{y})}{Var(y)}\]
start: int, optional

The behavior of the start parameter and its range of accepted values depends on whether you provide a timeseries-column (ts):

  • No provided timeseries-column:

    start must be an integer greater or equal to 0, where zero indicates to start prediction at the end of the in-sample data. If start is a positive value, the function predicts the values between the end of the in-sample data and the start index, and then uses the predicted values as time series inputs for the subsequent npredictions.

  • timeseries-column provided:

    start must be an integer greater or equal to 1 and identifies the index (row) of the timeseries-column at which to begin prediction. If the start index is greater than the number of rows, N, in the input data, the function predicts the values between N and start and uses the predicted values as time series inputs for the subsequent npredictions.

Default:

  • No provided timeseries-column:

    prediction begins from the end of the in-sample data.

  • timeseries-column provided:

    prediction begins from the end of the provided input data.

npredictions: int, optional

integer greater or equal to 1, the number of predicted timesteps.

method: str, optional

Forecasting method. One of the following:

  • auto:

    the model initially utilizes the true values at each step for forecasting. However, when it reaches a point where it can no longer rely on true values, it transitions to using its own predictions for further forecasting. This method is often referred to as “one step ahead” forecasting.

  • forecast:

    the model initiates forecasting from an initial value and entirely disregards any subsequent true values. This approach involves forecasting based solely on the model’s own predictions and does not consider actual observations after the start point.

Returns#

TableSample

report.

Examples#

This model is built based on multiple base models. You should look at the source models to see entire examples.

ARIMA; ARMA; AR; MA;