Skip to content

[Feature Request] Add Seasonality Detection for Time-Series Data #5230

Closed

Description

Feature Description

In time series data, seasonality is the presence of variations that occur at specific regular intervals less than a year, such as weekly, monthly, or quarterly. With the support of seasonality and seasonality decomposition, we can improve a list of operations on time-series data:

  • Anomaly Detection
  • Forcasting
  • and more

We propose to provide

  1. Seasonality Detection Support for Time-Series Data based on fourier analysis. PR 5231
  2. Seasonality Decomposition for Time-Series Data based on STL.
    a. First, we support decomposition with Anomaly Detection PR 5202
    b. Second, separate seasonality decomposition as a individual API as a Transformer

Detail API Proposal

  • DetectSeasonality
        /// <summary>
        /// Obtain the period by adopting techniques of spectral analysis. which is founded by
        /// the fourier analysis. returns -1 means there's no significant period. otherwise, a period
        /// is returned.
        /// </summary>
        /// <param name="catalog">The detect seasonality catalog.</param>
        /// <param name="input">Input DataView.The data is an instance of <see cref="Microsoft.ML.IDataView"/>.</param>
        /// <param name="inputColumnName">Name of column to process. The column data must be <see cref="System.Double"/>.</param>
        /// <param name="seasonalityWindowSize">An upper bound on the largest relevant seasonality in the input time-series.
        /// When set to -1, use the whole input to fit model, when set to a positive integer, use this number as batch size.
        /// Default value is -1.</param>
        /// <returns>The detected period if seasonality period exists, otherwise return -1.</returns>
        public static int DetectSeasonality(this AnomalyDetectionCatalog catalog, IDataView input, string inputColumnName, int seasonalityWindowSize = -1)
  • Seasonality Decompose
    Add two optional parameters to existing DetectEntireAnomalyBySrCnn API:
    -- period: Seasonality Period (either from user or auto-detected by the DetectSeasonality API.
    -- deseasonalityMode: Median, Average, STL.
public static IDataView DetectEntireAnomalyBySrCnn(
  this AnomalyDetectionCatalog catalog,
  IDataView input, string outputColumnName, 
  string inputColumnName,
  double threshold = 0.3, 
   int batchSize = 1024, 
   double sensitivity = 99, 
   SrCnnDetectMode detectMode = SrCnnDetectMode.AnomalyOnly, 
   int period = 0, 
   SrCnnDeseasonalityMode deseasonalityMode = SrCnnDeseasonalityMode.Stl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

P2Priority of the issue for triage purpose: Needs to be fixed at some point.enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions