Loading...

vastorbit.machine_learning.vast.tsa.AR.fit

AR.fit(input_relation: Annotated[str | VastFrame, ''], ts: str, y: Annotated[str | list[str], 'STRING representing one column or a list of columns'], test_relation: Annotated[str | VastFrame, ''] = '', return_report: bool = False) str | None

Trains the model using pure SQL.

Parameters:
  • input_relation (SQLRelation) – Training relation.

  • ts (str) – TS (Time Series) VastColumn used to order the data. The VastColumn type must be date (date, datetime, timestamp…) or numerical.

  • y (SQLColumns) –

    Response column.

    In the case of multivariate analysis, it represents a list of all the predictors.

  • test_relation (SQLRelation, optional) – Relation used to test the model.

  • return_report (bool, optional) – When set to True, the model summary will be returned. Otherwise, it will be printed.

Returns:

model’s summary.

Return type:

str

Raises:

NotImplementedError – If the model contains MA (Moving Average) components. Only AR and VAR models are supported for SQL-based training.

Examples

We import vastorbit:

import vastorbit as vo

For this example, we will use the airline passengers dataset.

import vastorbit.datasets as vod
data = vod.load_airline_passengers()

First we import the model:

from vastorbit.machine_learning.vast.tsa import AR

Then we can create the model:

model = AR(p=2)

We can now fit the model:

model.fit(data, "date", "passengers")