Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
linenumberstrue
#PARSER PQL
#RUNQUERY
/// Values above 50 will be 'true' (which means that the current sequence starts / runs) and smaller values to 'false' (means: sequence ended)
stateInfo = MAP({
                expressions = ['temp', ['temp > 50', 'state']]              
              },
              System.manual
            )

/// The elements within one sequence will be counted (starts from 1 with each new sequence)
sequence = MAP({
              expressions = ['temp','counter(state)']                        
            },
            stateInfo
          )

/// The tuple which marks the end of the sequence (and itself is not part of the sequence) has the counter_state_ 0 and will be filtered out 
onlySequence = SELECT({PREDICATE = 'counter_state_ > 0'}, sequence)

/// Learn how a "normal" sequence is. The first 15 sequences will be learned and used as the definition of "normal"
sequenceLearn = DEVIATIONSEQUENCELEARN({
                  group_by = ['counter_state_'],
                  parameterAttributeattribute = 'temp',
                  sequencesToLearn = 15                                
                },
                onlySequence
              )
              
/// Check, if the current tuple of this sequence differes from the normal tuples of the sequence at the specific point of the sequence
sequenceAnalysis = DEVIATIONSEQUENCEANOMALYDETECTION({
                    interval = 4.0,
                    standardDeviationLearnAttribute = 'standardDeviation',
                    group_by = ['group'],
                    meanLearnAttribute = 'mean',
                    valueDataAttribute = 'temp'                  
                  },
                  0:sequenceLearn,
                  1:sequenceLearn
                )