kats.models.linear_model module¶

class kats.models.linear_model.LinearModel(data: kats.consts.TimeSeriesData, params: kats.models.linear_model.LinearModelParams)[source]¶

Bases: Generic[kats.models.model.ParamsType]

Model class for Linear Model.

This class provides the fit, predict and plot methods for the Linear Model

data¶

kats.consts.TimeSeriesData, the input time series data as TimeSeriesData

params¶

the parameter class defined with LinearModelParams

fit()None[source]¶

fit Linear Model.

static get_parameter_search_space()List[Dict[str, object]][source]¶

get default parameter search space for Linear model.

plot()[source]¶

Plot Forecasted results from the Linar Model.

predict(steps, include_history=False, **kwargs)[source]¶

predict with fitted linear model.

Parameters
  • steps – the steps or length of the prediction horizon

  • include_history – whether to include the historical data in the prediction

Returns

time, fcst, fcst_lower, and fcst_upper

Return type

The predicted dataframe with the following columns

class kats.models.linear_model.LinearModelParams(alpha=0.05, **kwargs)[source]¶

Bases: kats.consts.Params

Parameter class for Linear model.

This is the parameter class for the linear model.

alpha¶

The alpha level for the confidence interval. The default alpha = 0.05 returns a 95% confidence interval

validate_params()[source]¶

Validate Linear Model Parameters

Since the linear model does not require key parameters to be defined this is not required for this class