Package elki.application.experiments
Class ORLibBenchmark
- java.lang.Object
-
- elki.application.AbstractApplication
-
- elki.application.experiments.ORLibBenchmark
-
public class ORLibBenchmark extends AbstractApplication
Load an ORlib problem to evaluate k-medoids clustering quality.- Since:
- 0.8.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classORLibBenchmark.Par<O>Parameterization class.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Class<? extends ClusteringAlgorithm<?>>algClustering algorithmprivate java.net.URIfileInput file.private KMedoidsInitialization<DBID>initInitialization method.private intkNumber of clusters override (optional)private static LoggingLOGClass logger.private RandomFactoryrndRandom generator for shuffling.-
Fields inherited from class elki.application.AbstractApplication
REFERENCE, VERSION
-
-
Constructor Summary
Constructors Constructor Description ORLibBenchmark(java.net.URI file, java.lang.Class<? extends ClusteringAlgorithm<?>> alg, KMedoidsInitialization<DBID> init, int k, RandomFactory rnd)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voidallShortestPaths(int n, double[] mat)Floyd's all-pairs shortest pathsprivate static intcomputeOffset(int x, int y)Compute the offset within the file.static voidmain(java.lang.String[] args)Main method, delegate to super class.private double[]randomShuffle(int n, double[] mat)Random shuffle of the matrix.private static double[]readEdges(int n, TokenizedReader reader, Tokenizer tok)Load the edge list.voidrun()Runs the application.-
Methods inherited from class elki.application.AbstractApplication
printErrorMessage, runCLIApplication, usage
-
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Class logger.
-
file
private java.net.URI file
Input file.
-
alg
private java.lang.Class<? extends ClusteringAlgorithm<?>> alg
Clustering algorithm
-
init
private KMedoidsInitialization<DBID> init
Initialization method.
-
k
private int k
Number of clusters override (optional)
-
rnd
private RandomFactory rnd
Random generator for shuffling.
-
-
Constructor Detail
-
ORLibBenchmark
public ORLibBenchmark(java.net.URI file, java.lang.Class<? extends ClusteringAlgorithm<?>> alg, KMedoidsInitialization<DBID> init, int k, RandomFactory rnd)Constructor.- Parameters:
file- Input file namealg- Algorithm classinit- Random generatork- Override for the number of clustersrnd- Random generator for shuffling
-
-
Method Detail
-
run
public void run()
Description copied from class:AbstractApplicationRuns the application.- Specified by:
runin classAbstractApplication
-
readEdges
private static double[] readEdges(int n, TokenizedReader reader, Tokenizer tok) throws java.io.IOExceptionLoad the edge list.- Parameters:
n- Data set sizereader- Readertok- Tokenizer- Returns:
- Matrix (missing values are infinity)
- Throws:
java.io.IOException
-
allShortestPaths
private static void allShortestPaths(int n, double[] mat)Floyd's all-pairs shortest paths- Parameters:
n- Number of nodesmat- Matrix to complete
-
randomShuffle
private double[] randomShuffle(int n, double[] mat)Random shuffle of the matrix.- Parameters:
n- Data set sizemat- Matrix- Returns:
- New matrix
-
computeOffset
private static int computeOffset(int x, int y)Compute the offset within the file.- Parameters:
x- First coordinatey- Second coordinate- Returns:
- Linear offset
-
main
public static void main(java.lang.String[] args)
Main method, delegate to super class.- Parameters:
args- Command line arguments
-
-