def anomalyProbability(self, value, anomalyScore, timestamp=None):
if timestamp is None:<EOL><INDENT>timestamp = self._iteration<EOL><DEDENT>dataPoint = (timestamp, value, anomalyScore)<EOL>if self._iteration < self._probationaryPeriod:<EOL><INDENT>likelihood = <NUM_LIT:0.5><EOL><DEDENT>else:<EOL><INDENT>if ( (self._distribution is None) or<EOL>(self._iteration % self._reestimationPeriod == <NUM_LIT:0>) ):<EOL><INDENT>numSkipRecords = self._calcSkipRecords(<EOL>numIngested=self._iteration,<EOL>windowSize=self._historicalScores.maxlen,<EOL>learningPeriod=self._learningPeriod)<EOL>_, _, self._distribution = estimateAnomalyLikelihoods(<EOL>self._historicalScores,<EOL>skipRecords=numSkipRecords)<EOL><DEDENT>likelihoods, _, self._distribution = updateAnomalyLikelihoods(<EOL>[dataPoint],<EOL>self._distribution)<EOL>likelihood = <NUM_LIT:1.0> - likelihoods[<NUM_LIT:0>]<EOL><DEDENT>self._historicalScores.append(dataPoint)<EOL>self._iteration += <NUM_LIT:1><EOL>return likelihood<EOL>
Compute the probability that the current value plus anomaly score represents
an anomaly given the historical distribution of anomaly scores. The closer
the number is to 1, the higher the chance it is an anomaly.

:param value: the current metric ("raw") input value, eg. "orange", or
               '21.2' (deg. Celsius), ...
:param anomalyScore: the current anomaly score
:param timestamp: [optional] timestamp of the ocurrence,
                   default (None) results in using iteration step.
:returns: the anomalyLikelihood for this record.