Skip to content

Source code and supplimentary materials for "An Experiment Evaluation of Anomaly Detection in Time Series"

License

Notifications You must be signed in to change notification settings

zaqthss/experiment-tsad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

An Experimental Evaluation of Anomaly Detection in Time Series

Source code and supplementary materials for "An Experimental Evaluation of Anomaly Detection in Time Series".

To enable reproductivity, we open source all datasets, algorithms and codes introduced in the paper, and this document produces a guideline of reproduction.

Data

To ease reproducibility, we put it in Google Drive https://drive.google.com/drive/folders/1BJuiWMmBzK2UeiGahVoX2ofqlShELjkN

Requirement

Code Structure

  • Section 4.2.1 Varying Datasets
    • acc
  • Section 4.2.2 Varying Anomaly Rate
    • rate
  • Section 4.2.3 Varying Data Size
    • size
  • Section 4.2.4 Varying Data Dimension
    • dim
  • Section 4.2.5 Varying Anomaly Patterns
    • type
  • Section 4.3.1 Univariate Methods in Multivariate Datasets
    • inter/UMPerDimTest
  • Section 4.3.2 Online Methods in Batched Time Series
    • inter/SlideTest
  • Section 4.3.3 Point Methods in Subsequence Anomalies
    • inter/SPLengthTest
  • Section 4.3.4 Effect of Metrics and Adjustment
    • inter/AdjustPredictTest
  • Section 4.3.5 Effect of Threshold
    • threshold
  • Section 4.3.6 Application
    • application

Example Invocation

Take the code of drawing Table 4 as an example:

// Set parameters
String[] vars = {"yahoo","twitter"};
boolean[] willOperate = {true, true, true};

String[] algNames = {"NETS", "Stare","SHESD"};
String[] metricNames = {"precision", "recall", "fmeasure"};

...
    
// NETS
algIndex++;
if (willOperate[algIndex]) {
    System.out.println(algNames[algIndex] + " begin");
    if (!seriesMulMap.containsKey(dsName)) {
        timeSeriesMulDim = fh.readMulDataWithLabel(rawPath);
        seriesMulMap.put(dsName, timeSeriesMulDim);
        TreeMap<Long, TimePointMulDim> realAnomaly =
            DataHandler.findAnomalyPoint(timeSeriesMulDim);
        realAnomalyMulMap.put(dsName, realAnomaly);
    } else {
        timeSeriesMulDim = seriesMulMap.get(dsName);
    }
        algtime[algIndex][0] = System.currentTimeMillis();
        nets = new NETS();
        Map<String, Object> netsParams = meta.getDataAlgParam().get(dsName).get(algNames[algIndex]);
        nets.init(netsParams, timeSeriesMulDim);
        nets.run();
        algtime[algIndex][1] = System.currentTimeMillis();
        DataHandler.evaluate(
            timeSeriesMulDim, realAnomalyMulMap.get(dsName), metrics[index][algIndex]);
}

...
   
//Write results
fh.writeResults("acc", "uni-point", vars, algNames, metricNames, totaltime, metrics, 1);

Result:

DatasetNETSStareSHSED
PrecisonRecallFmeasure PrecisonRecallFmeasure PrecisonRecallFmeasure
Yahoo 0.72710.842 0.4290.3750.400 `10.6250.769
Twitter 0.7390.8780.802 0.2030.9590.335 `0.2600.1760.210

About

Source code and supplimentary materials for "An Experiment Evaluation of Anomaly Detection in Time Series"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published