}
}
// Label outlier result (reference)
{
OutlierResult bylabelresult = bylabel.run(database);
writeResult(fout, ids, bylabelresult, new IdentityScaling(), "bylabel");
}
// No/all outliers "results"
{
OutlierResult noresult = (new TrivialNoOutlier()).run(database);
writeResult(fout, ids, noresult, new IdentityScaling(), "no-outliers");
OutlierResult allresult = (new TrivialAllOutlier()).run(database);
writeResult(fout, ids, allresult, new IdentityScaling(), "all-outliers");
}
// KNN
logger.verbose("Running KNN");
runForEachK(new AlgRunner() {
@Override
public void run(int k, String kstr) {
KNNOutlier<O, D> knn = new KNNOutlier<O, D>(distf, k);
OutlierResult knnresult = knn.run(database, relation);
// Setup scaling
StandardDeviationScaling scaling = new StandardDeviationScaling();
scaling.prepare(knnresult);
writeResult(fout, ids, knnresult, scaling, "KNN-" + kstr);
detachResult(database, knnresult);
}
});
// KNN Weight
logger.verbose("Running KNNweight");
runForEachK(new AlgRunner() {
@Override
public void run(int k, String kstr) {
KNNWeightOutlier<O, D> knnw = new KNNWeightOutlier<O, D>(distf, k);
OutlierResult knnresult = knnw.run(database, relation);
// Setup scaling
StandardDeviationScaling scaling = new StandardDeviationScaling();
scaling.prepare(knnresult);
writeResult(fout, ids, knnresult, scaling, "KNNW-" + kstr);
detachResult(database, knnresult);
}
});
// Run LOF
logger.verbose("Running LOF");
runForEachK(new AlgRunner() {
@Override
public void run(int k, String kstr) {
LOF<O, D> lof = new LOF<O, D>(k, distf, distf);
OutlierResult lofresult = lof.run(relation);
// Setup scaling
StandardDeviationScaling scaling = new StandardDeviationScaling(1.0, 1.0);
scaling.prepare(lofresult);
writeResult(fout, ids, lofresult, scaling, "LOF-" + kstr);
detachResult(database, lofresult);
}
});
// LoOP
logger.verbose("Running LoOP");
runForEachK(new AlgRunner() {
@Override
public void run(int k, String kstr) {
LoOP<O, D> loop = new LoOP<O, D>(k, k, distf, distf, 1.0);
OutlierResult loopresult = loop.run(database, relation);
writeResult(fout, ids, loopresult, new IdentityScaling(), "LOOP-" + kstr);
detachResult(database, loopresult);
}
});
// LDOF
logger.verbose("Running LDOF");
runForEachK(new AlgRunner() {
@Override
public void run(int k, String kstr) {
LDOF<O, D> ldof = new LDOF<O, D>(distf, k);
OutlierResult ldofresult = ldof.run(database, relation);
// Setup scaling
StandardDeviationScaling scaling = new StandardDeviationScaling(1.0, 1.0);
scaling.prepare(ldofresult);
writeResult(fout, ids, ldofresult, scaling, "LDOF-" + kstr);
detachResult(database, ldofresult);
}
});
// ABOD
if(runabod && relation.size() < 10000) {
try {
final PolynomialKernelFunction poly = new PolynomialKernelFunction(PolynomialKernelFunction.DEFAULT_DEGREE);
@SuppressWarnings("unchecked")
final DistanceFunction<DoubleVector, DoubleDistance> df = DistanceFunction.class.cast(distf);
logger.verbose("Running ABOD");
runForEachK(new AlgRunner() {
@Override
public void run(int k, String kstr) {
ABOD<DoubleVector> abod = new ABOD<DoubleVector>(k, poly, df);
OutlierResult abodresult = abod.run(database);
// Setup scaling
StandardDeviationScaling scaling = new MinusLogStandardDeviationScaling(null, 1.0);
scaling.prepare(abodresult);
writeResult(fout, ids, abodresult, scaling, "ABOD-" + kstr);
detachResult(database, abodresult);