verticapy.machine_learning.vertica.tsa.ensemble.TimeSeriesByCategory.plot#
- TimeSeriesByCategory.plot(idx: int = 0, vdf: str | vDataFrame | None = None, ts: str | None = None, y: str | None = None, start: int | None = None, npredictions: int = 10, method: Literal['auto', 'forecast'] = 'auto', chart: PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure #
Draws the input submodel.
Parameters#
- idx: int, optional
As the
TimeSeriesByCategory
model generates multiple models, the final plot varies for each submodel. Theidx
parameter corresponds to the submodel index.- vdf: SQLRelation, optional
Object used to run the prediction. You can also specify a customized relation, but you must enclose it with an alias. For example,
(SELECT 1) x
is valid, whereas(SELECT 1)
andSELECT 1
are invalid.- ts: str, optional
TS (Time Series) :py:class`vDataColumn` used to order the data. The :py:class`vDataColumn` type must be
date
(date
,datetime
,timestamp
…) or numerical.- y: str, optional
Response column.
- 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. Ifstart
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 subsequentnpredictions
.
- timeseries-column provided:
start
must be aninteger
greater or equal to1
and identifies the index (row) of the timeseries-column at which to begin prediction. If thestart
index is greater than the number of rows,N
, in the input data, the function predicts the values betweenN
andstart
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 to1
, 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.
- chart: PlottingObject, optional
The chart object to plot on.
- **style_kwargs
Any optional parameter to pass to the Plotting functions.
Returns#
- object
Plotting Object.
Examples#
This model is built based on multiple base models. You should look at the source models to see entire examples.