Package: kats
DescriptionKats is a toolkit to analyze time series data, a lightweight, easy-to-use, and generalizable framework to perform time series analysis. Time series analysis is an essential component of Data Science and Engineering work at industry, from understanding the key statistics and characteristics, detecting regressions and anomalies, to forecasting future trends. Kats aims to provide the one-stop shop for time series analysis, including detection, forecasting, feature extraction/embedding, multivariate analysis, etc.Kats is released by Facebook'sInfrastructure Data Scienceteam. It is available for download onPyPI.Important linksHomepage:https://facebookresearch.github.io/Kats/Kats Python package:https://pypi.org/project/kats/0.1.0/Facebook Engineering Blog Post:https://engineering.fb.com/2021/06/21/open-source/kats/Source code repository:https://github.com/facebookresearch/katsContributing:https://github.com/facebookresearch/Kats/blob/master/CONTRIBUTING.mdTutorials:https://github.com/facebookresearch/Kats/tree/master/tutorialsInstallation in PythonKats is on PyPI, so you can usepipto install it.pipinstall--upgradepip
pipinstallkatsIf you need only a small subset of Kats, you can install a minimal version of Kats withMINIMAL_KATS=1pipinstallkatswhich omits many dependencies (everything intest_requirements.txt).
However, this will disable many functionalities and causeimport katsto log
warnings. Seesetup.pyfor full details and options.ExamplesHere are a few sample snippets from a subset of Kats offerings:ForecastingUsingProphetmodel to forecast theair_passengersdata set.importpandasaspdfromkats.constsimportTimeSeriesDatafromkats.models.prophetimportProphetModel,ProphetParams# take `air_passengers` data as an exampleair_passengers_df=pd.read_csv("../kats/data/air_passengers.csv",header=0,names=["time","passengers"],)# convert to TimeSeriesData objectair_passengers_ts=TimeSeriesData(air_passengers_df)# create a model param instanceparams=ProphetParams(seasonality_mode='multiplicative')# additive mode gives worse results# create a prophet model instancem=ProphetModel(air_passengers_ts,params)# fit model simply by calling m.fit()m.fit()# make prediction for next 30 monthfcst=m.predict(steps=30,freq="MS")DetectionUsingCUSUMdetection algorithm on simulated data set.# import packagesimportnumpyasnpimportpandasaspdfromkats.constsimportTimeSeriesDatafromkats.detectors.cusum_detectionimportCUSUMDetector# simulate time series with increasenp.random.seed(10)df_increase=pd.DataFrame({'time':pd.date_range('2019-01-01','2019-03-01'),'increase':np.concatenate([np.random.normal(1,0.2,30),np.random.normal(2,0.2,30)]),})# convert to TimeSeriesData objecttimeseries=TimeSeriesData(df_increase)# run detector and find change pointschange_points=CUSUMDetector(timeseries).detector()TSFeaturesWe can extract meaningful features from the given time series data# Initiate feature extraction classimportpandasaspdfromkats.constsimportTimeSeriesDatafromkats.tsfeatures.tsfeaturesimportTsFeatures# take `air_passengers` data as an exampleair_passengers_df=pd.read_csv("../kats/data/air_passengers.csv",header=0,names=["time","passengers"],)# convert to TimeSeriesData objectair_passengers_ts=TimeSeriesData(air_passengers_df)# calculate the TsFeaturesfeatures=TsFeatures().transform(air_passengers_ts)ChangelogVersion 0.2.0ForecastingAdded global model, a neural network forecasting modelAddedglobal model tutorialConsolidated backtesting APIs and some minor bug fixesDetectionAdded model optimizer for anomaly/ changepoint detectionAdded evaluators for anomaly/changepoint detectionImproved simulators, to build synthetic data and inject anomaliesAdded new detectors: ProphetTrendDetector, Dynamic Time Warping based detectorsSupport for meta-learning, to recommend anomaly detection algorithms and parameters for your datasetStandardized API for some of our legacy detectors: OutlierDetector, MKDetectorSupport for Seasonality Removal in StatSigDetectorTsFeaturesAdded time-based featuresOthersBug fixes, code coverage improvement, etc.Version 0.1.0Initial releaseContributorsKats is a project with several skillful researchers and engineers contributing to it.Kats is currently maintained byXiaodong Jiangwith major contributions coming
from many talented individuals in various forms and means. A non-exhaustive but growing list needs to mention:Sudeep Srivastava,Sourav Chatterjee,Jeff Handler,Rohan Bopardikar,Dawei Li,Yanjun Lin,Yang Yu,Michael Brundage,Caner Komurlu,Rakshita Nagalla,Zhichao Wang,Hechao Sun,Peng Gao,Wei Cheung,Jun Gao,Qi Wang,Morteza Kazemi,Tihamér Levendovszky,Jian Zhang,Ahmet Koylan,Kun Jiang,Aida Shoydokova,Ploy Temiyasathit, Sean Lee,Nikolay Pavlovich Laptev,Peiyi Zhang,Emre Yurtbay,Daniel Dequech,Rui Yan,William Luo,Marius Guerard, andPietari Pulkkinen.LicenseKats is licensed under theMIT license.