Date: Mon, 4 Jul 2022 02:37:15 +0200 (CEST) Message-ID: <1684325023.793.1656895035387@odysseus.offis.uni-oldenburg.de> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_792_20260357.1656895035386" ------=_Part_792_20260357.1656895035386 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html DeviationSequenceLearn operator

# DeviationSequenceLearn operator

This operator learns deviation of (each point of a) sequence. Th= e sequence needs a counter so that the operator can distinguish multiple se= quences and the values within a sequence. The operator uses the online-lear= n algorithm of the De= viationLearn operator.

### Example

The operator gets the following input:

Counter Value
0 8
1 5
2 20
0 4
1 6
2 22

This were two sequences, because a new sequence starts if the counter of= the next tuple is smaller than the previous counter. Every sequence had th= ree tuples. The output on port 1 would be the following:

group mean standardDeviation
0 8.0 0.0
1 5.0 0.0
2 20.0 0.0
0 6.0 2.828
1 5.5 0.707
2 21.0 1.414

### Parameters

• attribute Name of the attribute which should be analys= ed
• sequencesToLearn The number of (correct) sequencesto l= earn from. The first x sequences will define the perfect sequence the other= s are compared to. If set to 0, the operator will not stop to learn (learn = infinity sequences). Default is 0.
• GROUP_BY To group the tuples into the single parts of = the sequence.
• fastGrouping Use hash code instead of tuple compare to= create group. Potentially unsafe!

### Example

The example PQL code shows, how to use the operator. The GROUP_BY parame= ter is very important because it is used to distinguish the single values w= ithin one sequence.

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

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

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

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