Example

These examples demonstrate how to use the GMM operator.

The following example detects an outlier in computer memory usage by using the GMM operator:


use com.teracloud.streams.timeseries.modeling::GMM;
composite Main {
  graph
    stream<timestamp ts, float64 KPIs, rstring key> KPIStream = FileSource() { 
      param
        file : "memoryusage.dat";
        format : csv;
    }

    stream<float64 prob, float64 outlierProb, float64 pdfValue> outputStream = GMM(KPIStream) {
      param
        inputTimeSeries: KPIs; // time series to be modelled
        trainingSize: 3400u;   // use first 3400 sample to create the model
        mixtures: 1u;          // use one single mixture
      output
        outputStream:
          prob = probability(),                // probability of the data being normal
          outlierProb = outlierProbability(),  // probability of the data being an anomaly
          pdfValue = PDFValue();               // density probability of the data
    }
}

The following graph shows a time series that represents simulated computer memory usage:



The following graph focuses on a particular time period in the memory usage data, where an outlier is detected by the GMM operator with high probability: