Package elki.application.greedyensemble
Class ComputeKNNOutlierScores<O extends NumberVector>
- java.lang.Object
-
- elki.application.AbstractApplication
-
- elki.application.AbstractDistanceBasedApplication<O>
-
- elki.application.greedyensemble.ComputeKNNOutlierScores<O>
-
- Type Parameters:
O
- Vector type
@Reference(authors="Erich Schubert, Remigius Wojdanowski, Arthur Zimek, Hans-Peter Kriegel", title="On Evaluation of Outlier Rankings and Outlier Scores", booktitle="Proc. 12th SIAM Int. Conf. on Data Mining (SDM 2012)", url="https://doi.org/10.1137/1.9781611972825.90", bibkey="DBLP:conf/sdm/SchubertWZK12") public class ComputeKNNOutlierScores<O extends NumberVector> extends AbstractDistanceBasedApplication<O>
Application that runs a series of kNN-based algorithms on a data set, for building an ensemble in a second step. The output file consists of a label and one score value for each object.Since some algorithms can be too slow to run on large data sets and for large values of k, they can be disabled. For example -disable '(LDOF|DWOF|COF|FastABOD)' disables these two methods completely. Alternatively, you can use the parameter -ksquaremax to control the maximum k for these four methods separately.
For methods where k=1 does not make sense, this value will be skipped, and the procedure will commence at 1+stepsize.
Reference:
Erich Schubert, Remigius Wojdanowski, Arthur Zimek, Hans-Peter Kriegel
On Evaluation of Outlier Rankings and Outlier Scores
Proc. 12th SIAM Int. Conf. on Data Mining (SDM 2012)- Since:
- 0.5.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ComputeKNNOutlierScores.Par<O extends NumberVector>
Parameterization class.private static class
ComputeKNNOutlierScores.TimeoutException
Exception used in timeout logic.
-
Field Summary
Fields Modifier and Type Field Description (package private) ByLabelOutlier
bylabel
By label outlier detection - reference(package private) java.util.regex.Pattern
disable
Pattern for disabling (skipping) methods.(package private) IntGenerator
krange
Range of k.(package private) int
ksquarestop
Maximum k for O(k^2) methods.private static Logging
LOG
Our logger class.(package private) java.nio.file.Path
outfile
Output file(package private) ScalingFunction
scaling
Scaling function.(package private) long
timelimit
Timelimit for computation (not strictly enforced).-
Fields inherited from class elki.application.AbstractDistanceBasedApplication
distance, inputstep
-
Fields inherited from class elki.application.AbstractApplication
REFERENCE, VERSION
-
-
Constructor Summary
Constructors Constructor Description ComputeKNNOutlierScores(InputStep inputstep, Distance<? super O> distance, IntGenerator krange, ByLabelOutlier bylabel, java.nio.file.Path outfile, ScalingFunction scaling, java.util.regex.Pattern disable, int ksquarestop, long timelimit)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
isDisabled(java.lang.String name)
Test if a given algorithm is disabled.static void
main(java.lang.String[] args)
Main method.void
run()
Runs the application.private void
runForEachK(java.lang.String prefix, int mink, int maxk, java.util.function.IntFunction<OutlierResult> runner, java.util.function.BiConsumer<java.lang.String,OutlierResult> out)
Iterate over the k range.(package private) void
writeResult(java.lang.Appendable out, DBIDs ids, OutlierResult result, ScalingFunction scaling, java.lang.String label)
Write a single output line.-
Methods inherited from class elki.application.AbstractApplication
printErrorMessage, runCLIApplication, usage
-
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Our logger class.
-
krange
final IntGenerator krange
Range of k.
-
outfile
java.nio.file.Path outfile
Output file
-
bylabel
ByLabelOutlier bylabel
By label outlier detection - reference
-
scaling
ScalingFunction scaling
Scaling function.
-
disable
java.util.regex.Pattern disable
Pattern for disabling (skipping) methods.
-
ksquarestop
int ksquarestop
Maximum k for O(k^2) methods.
-
timelimit
long timelimit
Timelimit for computation (not strictly enforced). In ms.
-
-
Constructor Detail
-
ComputeKNNOutlierScores
public ComputeKNNOutlierScores(InputStep inputstep, Distance<? super O> distance, IntGenerator krange, ByLabelOutlier bylabel, java.nio.file.Path outfile, ScalingFunction scaling, java.util.regex.Pattern disable, int ksquarestop, long timelimit)
Constructor.- Parameters:
inputstep
- Input stepdistance
- Distance functionkrange
- K parameter rangebylabel
- By label outlier (reference)outfile
- Output filescaling
- Scaling functiondisable
- Pattern for disabling methodsksquarestop
- Maximum k for O(k^2) methodstimelimit
- Time limit in seconds
-
-
Method Detail
-
run
public void run()
Description copied from class:AbstractApplication
Runs the application.- Specified by:
run
in classAbstractApplication
-
writeResult
void writeResult(java.lang.Appendable out, DBIDs ids, OutlierResult result, ScalingFunction scaling, java.lang.String label)
Write a single output line.- Parameters:
out
- Output streamids
- DBIDsresult
- Outlier resultscaling
- Scaling functionlabel
- Identification label
-
runForEachK
private void runForEachK(java.lang.String prefix, int mink, int maxk, java.util.function.IntFunction<OutlierResult> runner, java.util.function.BiConsumer<java.lang.String,OutlierResult> out)
Iterate over the k range.- Parameters:
prefix
- Prefix stringmink
- Minimum value of k for this methodmaxk
- Maximum value of k for this methodrunner
- Runner to runout
- Output function
-
isDisabled
protected boolean isDisabled(java.lang.String name)
Test if a given algorithm is disabled.- Parameters:
name
- Algorithm name- Returns:
true
if disabled
-
main
public static void main(java.lang.String[] args)
Main method.- Parameters:
args
- Command line parameters.
-
-