• API

›Forecasting

Forecasting

  • Autoregressive Neural Network (AR_net)
  • Quadratic Model
  • Linear Model
  • KatsEnsemble
  • Empirical Confidence Interval
  • STLF
  • Theta
  • Holt-Winter’s
  • Prophet
  • SARIMA
  • ARIMA

Detection

  • BOCPD: Residual Translation
  • BOCPD: Bayesian Online Changepoint Detection
  • Outlier Detection
  • ACFDetector
  • Seasonality Detector
  • Cusum Detector

TSFeatures

  • TsFeatures

Multivariate

  • Multivariate Outlier Detection
  • VAR

Utilities

  • Model Hyperparameter Tuning
  • Backtesting
  • Time Series Decomposition
  • Dataswarm Operators

Autoregressive Neural Network (AR_net)

Autoregressive neural network or AR_net model combines the ordinary autoregressive model with neural network model. It uses lagged response values as input features to a neural network architecture(as shown below):

Full technical details can be found in the paper. We demonstrate a simple example use case as follows:

API

# Parameter class
class `ARNetParams`(input_size, output_size, batch_size)

Parameters:

`input_size`: how many time-stamps to use as an input to predict the future
o`utput_size`: each time we make a prediction this is how many timestamps we will predict at a time.
batch_size: during model training, this is how many examples from the past we will use on each iteration.
# Model class
class `ARNet`()

Methods

fit(): # fit ARNet model with given parameters
predict(steps, freq): # predict the future for future steps
plot(): # plot the time series data with confidence internal (if exist)

Example

We use air passenger data as an example for ARIMA model

import pandas as pd
from infrastrategy.kats.consts import TimeSeriesData
from infrastrategy.kats.models.ar_net import ARNetParams, ARNet

# read data and rename the two columns required by TimeSeriesData structure
data = pd.read_csv("./peyton_manning.csv")
data.columns = ["time", "y"]
TSdata = TimeSeriesData(data)

# create ARNetParams with specifying initial param values
params = ARNetParams(input_size=5, output_size=1, batch_size=10)

# create ARIMAModel with given data and params
m = ARNet(data=TSdata, params=params)

# call fit method to fit model
m.fit()

# call predict method to predict the next 60 steps
m.predict(steps=60)

# visualize the results
m.plot()

Quadratic Model →
  • API
    • Parameters:
    • Methods
  • Example
Kats Project
More
GitHubStar
Facebook Open Source
Copyright © 2021 Kats Project @ Facebook