...
- exactCalculation If set to true, it uses exact calculation for window mode (recalc values every new tuple). This may be slower. Unexact calculation may be faster, but unaccurate, especially if the mean changes dramatically over time.
- tuplesToLearn The number of tuples that will be used to learn the operator if 'tupleBased' is the choosen trainingMode.
- trainingMode The training mode for this operator
- mean If you want to set the mean manually (with trainingMode = manual) you can do this here.
- standardDeviation If you want to set the standard deviation manually (with trainingMode = manual) you can do this here.
- nameOfParameter attribute Name of the attribute which should be analysed
- uniqueBackupId A unique ID for this operator to save and read backup data.
- GROUP_BY To group the tuples and learn a unique deviation for each group
- fastGrouping Use hash code instead of tuple compare to create group. Potentially unsafe!
...
Code Block | ||
---|---|---|
| ||
#PARSER PQL #ADDQUERY /// Use the online training mode to learn the mean and the standard deviation deviationLearner = DEVIATIONLEARN({ trainingmode = 'ONLINE', nameofparameterattribute = 'temp' }, System.manual ) /// Compare the current tuple with the learned values deviationAnalysis = DEVIATIONANOMALYDETECTION({ interval = 3.0, nameofparameterattribute = 'temp' }, 1:deviationLearner, 0:deviationLearner ) |
...
Code Block | ||
---|---|---|
| ||
#PARSER PQL #DEFINE BACKUPSCHEMA [['sum1', 'Double'],['sum2', 'Double'],['sumWindowSqr', 'Double'],['sumWindow', 'Double'],['m2', 'Double'],['mean', 'Double'],['backupId', 'String'],['k', 'Double'],['standardDeviation', 'Double'],['n', 'Double'],['group', 'Double'],['backupId', 'String']] #ADDQUERY /// Read backup data from the database backupMongo = MONGODBSOURCE({ database = 'odysseus', port = 27017, host = 'localhost', collectionname = 'condition' } ) /// Convert backup data to tuples backupTuple = KEYVALUETOTUPLE({ schema=${BACKUPSCHEMA}, TYPE = 'Backup', KEEPINPUT = 'false' }, backupMongo ) /// Run DeviationLearn and use backup data, if it exists ("Recovery") deviationLearner = DEVIATIONLEARN({ trainingmode = 'ONLINE', nameofparameterattribute = 'vibration', uniquebackupid = 'dev1' }, System.fridgeVibration, backupTuple ) /// Convert backup data from port 2 to a key value object keyValueOp = TUPLETOKEYVALUE({ type='KEYVALUEOBJECT' }, 2:deviationLearner ) /// Save the backup data to the database mongoSink = MONGODBSINK({ database = 'odysseus', port = 27017, host = 'localhost', collectionname = 'condition', batchsize = 1, deletebeforeinsert = 'true', deleteequalattribute = 'backupId' }, keyValueOp ) |