use of com.linkedin.thirdeye.anomalydetection.model.transform.TransformationFunction in project pinot by linkedin.
the class MinMaxThresholdFunction method init.
@Override
public void init(AnomalyFunctionDTO spec) throws Exception {
super.init(spec);
// Removes zeros from time series, which currently mean empty values in ThirdEye.
TransformationFunction zeroRemover = new ZeroRemovalFunction();
currentTimeSeriesTransformationChain.add(zeroRemover);
detectionModel = new MinMaxThresholdDetectionModel();
detectionModel.init(properties);
mergeModel = new MinMaxThresholdMergeModel();
mergeModel.init(properties);
}
use of com.linkedin.thirdeye.anomalydetection.model.transform.TransformationFunction in project pinot by linkedin.
the class WeekOverWeekRuleFunction method init.
public void init(Properties properties) {
this.properties = properties;
String baselineProp = this.properties.getProperty(BASELINE);
if (StringUtils.isNotBlank(baselineProp)) {
this.initPropertiesForDataModel(baselineProp);
}
dataModel = new SeasonalDataModel();
dataModel.init(this.properties);
// Removes zeros from time series, which currently mean empty values in ThirdEye.
TransformationFunction zeroRemover = new ZeroRemovalFunction();
currentTimeSeriesTransformationChain.add(zeroRemover);
baselineTimeSeriesTransformationChain.add(zeroRemover);
// Add total count threshold transformation
if (this.properties.containsKey(TotalCountThresholdRemovalFunction.TOTAL_COUNT_METRIC_NAME)) {
TransformationFunction totalCountThresholdFunction = new TotalCountThresholdRemovalFunction();
totalCountThresholdFunction.init(this.properties);
currentTimeSeriesTransformationChain.add(totalCountThresholdFunction);
}
// Add moving average smoothing transformation
if (this.properties.containsKey(ENABLE_SMOOTHING)) {
TransformationFunction movingAverageSoothingFunction = new MovingAverageSmoothingFunction();
movingAverageSoothingFunction.init(this.properties);
currentTimeSeriesTransformationChain.add(movingAverageSoothingFunction);
baselineTimeSeriesTransformationChain.add(movingAverageSoothingFunction);
}
predictionModel = new SeasonalAveragePredictionModel();
predictionModel.init(this.properties);
detectionModel = new SimpleThresholdDetectionModel();
detectionModel.init(this.properties);
mergeModel = new SimplePercentageMergeModel();
mergeModel.init(this.properties);
}
use of com.linkedin.thirdeye.anomalydetection.model.transform.TransformationFunction in project pinot by linkedin.
the class AbstractModularizedAnomalyFunction method transformTimeSeries.
/**
* Transform the current time series and baselines.
*
* TODO: Apply Chain-of-Responsibility on the transformation chain
*
* @param metricName the name of the metric on which we apply transformation and prediction
* @param anomalyDetectionContext anomaly detection context that contains the time series to be
* transformed.
*/
private void transformTimeSeries(String metricName, AnomalyDetectionContext anomalyDetectionContext) {
// Transform the observed (current) time series
if (anomalyDetectionContext.getTransformedCurrent(metricName) == null) {
anomalyDetectionContext.setTransformedCurrent(metricName, anomalyDetectionContext.getCurrent(metricName));
}
List<TransformationFunction> currentTimeSeriesTransformationChain = getCurrentTimeSeriesTransformationChain();
if (CollectionUtils.isNotEmpty(currentTimeSeriesTransformationChain)) {
for (TransformationFunction tf : currentTimeSeriesTransformationChain) {
anomalyDetectionContext.setTransformedCurrent(metricName, tf.transform(anomalyDetectionContext.getTransformedCurrent(metricName), anomalyDetectionContext));
}
}
// Transform baseline time series
if (anomalyDetectionContext.getTransformedBaselines(metricName) == null) {
anomalyDetectionContext.setTransformedBaselines(metricName, anomalyDetectionContext.getBaselines(metricName));
}
List<TransformationFunction> baselineTimeSeriesTransformationChain = getBaselineTimeSeriesTransformationChain();
if (CollectionUtils.isNotEmpty(anomalyDetectionContext.getTransformedBaselines(metricName)) && CollectionUtils.isNotEmpty(baselineTimeSeriesTransformationChain)) {
for (TransformationFunction tf : baselineTimeSeriesTransformationChain) {
List<TimeSeries> transformedBaselines = new ArrayList<>();
for (TimeSeries ts : anomalyDetectionContext.getTransformedBaselines(metricName)) {
TimeSeries transformedTS = tf.transform(ts, anomalyDetectionContext);
transformedBaselines.add(transformedTS);
}
anomalyDetectionContext.setTransformedBaselines(metricName, transformedBaselines);
}
}
}
Aggregations