• Stars
    star
    116
  • Rank 303,894 (Top 6 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created almost 8 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Java implementation of Seasonal-Trend-Loess time-series decomposition algorithm.

Seasonal Decomposition of Time Series by Loess

travis-ci-status License

The Seasonal-Trend-Loess (STL) algorithm decomposes a time series into seasonal, trend and residual components. The algorithm uses Loess interpolation (original paper here) to smooth the cyclic sub-series (e.g. all January values in the CO2 data shown in the example below). After removing the seasonality from the signal, the remainder is smoothed (in multiple steps) to find the trend. This process is repeated and may include robustness iterations that take advantage of the weighted-least-squares underpinnings of Loess to remove the effects of outliers. The details are described in STL: A Seasonal-Trend Decomposition Procedure Based on Loess.

stl-decomp-4j is a Java port of the original Ratfor/Fortran available from Netlib (original source here; also included as part of examples/StlPerfTest/fortran_benchmark), extended to support local quadratic interpolation. stl-decomp-4j expects equally spaced data with no missing values, similar to the original Fortran version (and the R and Python versions, which both use the original Fortran version under the hood).

Check out the the stl-decomp-4j wiki for TODOs, etc.

Example

At a minimum, the STL algorithm requires specifying the periodicity of the data (e.g. 12 for monthly) and the width of the Loess smoother used to smooth the cyclic seasonal sub-series. In general, there are three Loess smoothers that each require three parameters: a width, a degree, and a jump. The width specifies the number of data points that the local interpolation uses to smooth each point, the degree specifies the degree of the local polynomial that is fit to the data, and the jump specifies how many points are skipped between Loess interpolations, with linear interpolation being done between these points. Because of this complexity, construction is done via Builder objects, as shown in this simple example.

double[] values = getSomeMonthlyData(); // Monthly time-series data

SeasonalTrendLoess.Builder builder = new SeasonalTrendLoess.Builder();
SeasonalTrendLoess smoother = builder.
			setPeriodLength(12).    // Data has a period of 12
			setSeasonalWidth(35).   // Monthly data smoothed over 35 years
			setNonRobust().         // Not expecting outliers, so no robustness iterations
			buildSmoother(values);

SeasonalTrendLoess.Decomposition stl = smoother.decompose();
double[] seasonal = stl.getSeasonal();
double[] trend = stl.getTrend();
double[] residual = stl.getResidual();

The StlDemoRestServer example includes a copy of the Monthly CO2 Measurement Data and a simple REST server that reads this data, performs an STL decomposition on the data, and serves up the results to http://localhost:4567/stldemo. The examples/StlDemoRestServer/index.html file loads the data from this server and plots the resulting decomposition. The code that does the actual decomposition is identical to that shown above, resulting in the following decomposition:

CO2 Plot

Benchmarking

The StlPerfTest example times the STL running on the CO2 data mentioned above or on a time-series of 10 years of random hourly data. The same benchmark is implemented in the original Fortran here. See Performance Tests for instructions on running these tests.

Limited testing show the Java to be about half the speed of the Fortran. A comparison of the resulting decompositions is shown in the StlJavaFortranComparison notebook.

Extension to include exogenous inputs

The STL method is extended to incorporate exogenous inputs where details can be found in the StlExogenous example. To apply exogenous inputs, build the smoother with them (double[][] exogenousinputs with each row being one exogenous input) as shown in the example below. After calling the .decompose() method, you can get the STL components. Note that the .getTrend() method now extracts the combined effect of the trend and exogenous inputs.

SeasonalTrendLoess smoother = builder.buildSmoother(values, exogenousinputs);

Documentation

The implementation of the quadratic extension of LoessInterpolator is described, mathematically, in ImplementationNotes.

TODO: JavaDoc link goes here

Build Dependencies

To include stl-decomp-4j in your maven project, add the following to your pom file:

        <dependency>
          <groupId>com.github.servicenow.stl4j</groupId>
          <artifactId>stl-decomp-4j</artifactId>
          <version>1.0.5</version>
        </dependency>

The stl-decomp-4j implementation has no external dependencies.

The unit tests depend on junit, commons-math3 and slf4j-simple.

The examples have further dependencies on commons-cli, opencsv, spark-core, and jackson-mapper-asl.

More Repositories

1

N-BEATS

N-BEATS is a neural-network based model for univariate timeseries forecasting. N-BEATS is a ServiceNow Research project that was started at Element AI.
Python
509
star
2

picard

PICARD - Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Models. PICARD is a ServiceNow Research project that was started at Element AI.
Haskell
340
star
3

HighRes-net

Pytorch implementation of HighRes-net, a neural network for multi-frame super-resolution, trained and tested on the European Space Agency’s Kelvin competition. This is a ServiceNow Research project that was started at Element AI.
Jupyter Notebook
278
star
4

BrowserGym

BrowserGym, a gym environment for web task automation in the Chromium browser.
Python
272
star
5

embedding-propagation

Codebase for Embedding Propagation: Smoother Manifold for Few-Shot Classification. This is a ServiceNow Research project that was started at Element AI.
Python
208
star
6

LCFCN

ECCV 2018 - Where are the Blobs: Counting by Localization with Point Supervision. This is a ServiceNow Research project that was started at Element AI.
Python
169
star
7

seasonal-contrast

seasonal-contrast is a ServiceNow Research project that was started at Element AI.
Python
161
star
8

TACTiS

TACTiS-2: Better, Faster, Simpler Attentional Copulas for Multivariate Time Series, from ServiceNow Research
Python
126
star
9

TADAM

The implementation of https://papers.nips.cc/paper/7352-tadam-task-dependent-adaptive-metric-for-improved-few-shot-learning . TADAM is a ServiceNow Research project that was started at Element AI.
Jupyter Notebook
106
star
10

WorkArena

WorkArena: How Capable are Web Agents at Solving Common Knowledge Work Tasks?
Python
105
star
11

osaka

Codebase for "Online Fast Adaptation and Knowledge Accumulation: a New Approach to Continual Learning". This is a ServiceNow Research project that was started at Element AI.
Python
102
star
12

example-restclient-myworkapp-nodejs

This project contains source code for an example Node.js web application that interacts with ServiceNow's REST APIs.
JavaScript
97
star
13

geo-bench

GEO-Bench: Toward Foundation Models for Earth Monitoring
Python
80
star
14

PySNC

Python API for ServiceNow
Python
76
star
15

am3

Adaptive Cross-Modal Few-shot learning OSS code. This is a ServiceNow Research project that was started at Element AI.
Python
65
star
16

devtraining-needit-utah

65
star
17

multithreaded-estimators

Multithreading inference in Tensorflow Estimators. This is a ServiceNow Research project that was started at Element AI.
Python
57
star
18

duorat

DuoRAT is a ServiceNow Research project that was started at Element AI.
Python
55
star
19

TapeAgents

TapeAgents is a framework that facilitates all stages of the LLM Agent development lifecycle
Python
51
star
20

azimuth

Helping AI practitioners better understand their datasets and models in text classification. From ServiceNow.
Python
51
star
21

synbols

The Synbols dataset generator is a ServiceNow Research project that was started at Element AI.
Python
43
star
22

app-dev-methodology

38
star
23

devtraining-needit-tokyo

This repository is used by the Developer Site training content, Tokyo release.
36
star
24

HypE

Knowledge Hypergraphs: Prediction Beyond Binary Relations is a ServiceNow Research project that was started at Element AI.
Python
30
star
25

devtraining-needit-paris

This repository is used by the developer site training content, Paris release. It is used for the Build the NeedIt App, Scripting in ServiceNow, Application Security, Importing Data, Automating Application Logic, Flow Designer, REST Integrations, Reporting and Analytics, Domain Separation, Mobile Applications, and Context-sensitive Help courses.
29
star
26

data-augmentation-with-llms

Data Augmentation for Intent Classification with Off-the-Shelf Large Language Models is a ServiceNow Research project
Python
28
star
27

devtraining-needit-quebec

This repository is used by the developer site training content, Paris release. It is used for the Build the NeedIt App, Scripting in ServiceNow, Application Security, Importing Data, Automating Application Logic, Flow Designer, REST Integrations, Reporting and Analytics, Domain Separation, Mobile Applications, and Context-sensitive Help courses.
27
star
28

bilevel_augment

bilevel_augment is a ServiceNow Research project that was started at Element AI.
Jupyter Notebook
26
star
29

servicenow-cli

Alternative download for ServiceNow CLI clients.
26
star
30

devtraining-needit-rome

This repository is used by the developer site training content, Rome release. It is used for the Build the NeedIt App, Scripting in ServiceNow, Application Security, Importing Data, Automating Application Logic, Flow Designer, REST Integrations, Reporting and Analytics, Domain Separation, Mobile Applications, and Context-sensitive Help courses.
26
star
31

wise_ils

BMVC 2019 - Where are the Masks: Instance Segmentation with Image-level Supervision. This is a ServiceNow Research project that was started at Element AI.
Python
25
star
32

ALM

Documentation, guides, templates, everything else in between for Application Lifecycle Management at ServiceNow.
23
star
33

sncicd_githubworkflow

.yml sample pipeline template for workflow
21
star
34

example-restclient-myworkapp-ios

This project contains source code for an example iOS application that interacts with ServiceNow's REST APIs.
Objective-C
20
star
35

servicenow-devops-change

JavaScript
18
star
36

devtraining-needit-sandiego

This repository is used by the Developer Site training content, San Diego release.
18
star
37

AgentLab

Python
18
star
38

avenue

Avenue is a simulator designed to test and prototype reinforcement learning algorithms. Avenue is a ServiceNow Research project that was started at Element AI.
Python
15
star
39

context-is-key-forecasting

Context is Key: A Benchmark for Forecasting with Essential Textual Information
Jupyter Notebook
15
star
40

atf-headless-runner

RobotFramework
14
star
41

sncicd-instance-scan

TypeScript
13
star
42

typed-dag

Causal discovery with typed directed acyclic graphs (t-DAG). This is a ServiceNow Research project that was started at Element AI.
Python
13
star
43

beyond-trivial-explanations

Beyond Trivial Counterfactual Explanations with Diverse Valuable Explanations is a ServiceNow Research project that was started at Element AI.
Python
13
star
44

servicenow-cicd-azure-extension

Extension for Azure Pipelines to help developers get started faster with ServiceNow's CI/CD APIs
JavaScript
12
star
45

sncicd-apply-changes

TypeScript
12
star
46

MiniTouch

MiniTouch is a ServiceNow Research project that was started at Element AI.
Python
11
star
47

sncicd-gitlab-docker

Docker image containing build steps for running your ServiceNow CI/CD pipelines on GitLab.
JavaScript
10
star
48

synbols-benchmarks

Benchmarks for the Synbols project. Synbols is a ServiceNow Research project that was started at Element AI.
Python
10
star
49

promptmix-emnlp-2023

Offical code repository for PromptMix: A Class Boundary Augmentation Method for Large Language Model Distillation, EMNLP 2023
Python
10
star
50

bytesteady

A fast classification and tagging tool using byte-level n-gram embeddings. bytesteady is a ServiceNow Research project that was started at Element AI.
C++
10
star
51

sncicd-plugin-activate

TypeScript
8
star
52

sncicd-publish-app

TypeScript
8
star
53

sncicd-batch-install

TypeScript
8
star
54

better-ui

ServiceNow UI giving you back the full width of your screen
8
star
55

active-fairness

Code for the paper "Can Active Learning Preemptively Mitigate Fairness Issues?" presented at RAI 2021. This is a ServiceNow Research project that was started at Element AI.
Jupyter Notebook
8
star
56

tk-knn

Python
7
star
57

a-day-in-the-life-of-a-ux-engineer

This is a sample repository for Platform UX Engineering
JavaScript
7
star
58

fashiongen-challenge-template

Base template to submit a model for the challenge. Fashiogen is a ServiceNow Research project that was started at Element AI.
Dockerfile
7
star
59

RepoFusion

This repository contains code for data preparation and experiments for pre training llm with repository level context in various ways
Python
6
star
60

build-pynini-wheels

Build `manylinux2014_x86_64` Python wheels for `pynini`, wrapping all its dependencies. This is a ServiceNow Research project that was started at Element AI.
Dockerfile
6
star
61

sncicd-plugin-rollback

TypeScript
6
star
62

devtraining-createnotes-orlando

Repository for the Service Portal Creating Custom Widgets module, Orlando release.
6
star
63

sncicd-tests-run

TypeScript
6
star
64

K15APIDemo

K15APIDemo
Swift
6
star
65

sncicd-install-app

TypeScript
6
star
66

radar.apple.com

Samples for Apple Radars.
Objective-C
5
star
67

workflow-discovery

Python
5
star
68

sncicd-rollback-app

TypeScript
4
star
69

THANOS

This ANOmaly is Synthetic - A Timeseries Recipe Data Generator
Jupyter Notebook
4
star
70

SISR

PyTorch-SRGAN is a modern PyTorch implementation of SRGAN Single Example Super Resolution. PyTorch-SRGAN is a ServiceNow Research project that was started at Element AI.
Python
4
star
71

Alpha-UX

Design guidelines and specs for SIR UX
HTML
4
star
72

devtraining-createnotes-paris

Repository for the Service Portal Creating Custom Widgets module, Paris release.
3
star
73

servicenow-devops-test-report

JavaScript
3
star
74

mid-cyberark-external-credential-resolver

MID Server External Credential Resolver for CyberArk vault.
Java
3
star
75

regions-of-reliability

Regions of Reliability in the Evaluation of Multivariate Probabilistic Forecasts
Python
3
star
76

K16-dd-order-tracking

3
star
77

servicenow-devops-get-change

We are creating new custom actions for Github Actions feature of Github. These actions are needed for ITSM DevOps product.
JavaScript
3
star
78

dir_lines_streamer

Rust crate allowing reading files inside a directory line-by-line, one file after the other (in human-alphabetical order). dir_lines_streamer is a ServiceNow Research project that was started at Element AI.
Rust
3
star
79

geo-bench-experiments

Python
3
star
80

servicenow-devops-sonar

JavaScript
2
star
81

devtraining-createnotes-tokyo

Repository for the Service Portal Creating Custom Widgets learning module, Tokyo release.
2
star
82

ExperienceHub

HTML
2
star
83

VA-iOS-SDK

Virtual Agent SDK for iOS native apps. Used to add VA to an existing app.
2
star
84

broad

Functionality to download and prepare BROAD, an image evaluation dataset for broad OOD detection.
Python
2
star
85

neighbour-distance

neighbour-distance is a ServiceNow Research project that was started at Element AI.
Jupyter Notebook
2
star
86

synbols-resources

Resources for the Synbols dataset generator. Synbols is a ServiceNow Research project that was started at Element AI.
PureBasic
2
star
87

devtraining-createnotes-rome

Repository for the Service Portal Creating Custom Widgets module, Rome release.
2
star
88

servicenow-devops-config-validate

JavaScript
2
star
89

servicenow-devops-update-change

We are creating new custom actions for Github Actions feature of Github. These actions are needed for ITSM DevOps product.
JavaScript
2
star
90

repliqa

A Question-Answering Dataset on Unseen Content [Details Coming Soon!]
Jupyter Notebook
2
star
91

agent-poirot

1
star
92

lightstep-ir-grafana-metrics

1
star
93

devtraining-application-release

1
star
94

devtraining-createnotes-sandiego

Repository for the Service Portal Creating Custom Widgets module, San Diego release.
1
star
95

FigmaResources

Archive of prior release Figma libraries
1
star
96

research

Unlock work experiences of the future. Join ServiceNow Research as we advance the state-of-the-art in Enterprise AI.
1
star
97

devtraining-createnotes-quebec

Repository for the Service Portal Creating Custom Widgets module, Quebec release.
1
star
98

acc-ansible

1
star
99

sn_ss_api_matrix

ServiceNow Server Side API Matrix
1
star
100

Public-Sector-Innovation-Community

1
star