Permalink
Browse files

Modularization

  • Loading branch information...
tzaeschke committed Dec 10, 2018
1 parent fa5c8f7 commit 028fe14eea7b6b4ee7abe76e73a78c03324bb79e
Showing with 648 additions and 1,761 deletions.
  1. +5 −0 CHANGELOG
  2. +17 −0 README.md
  3. +7 −2 pom.xml
  4. +67 −0 src/main/java/ch/ethz/globis/tinspin/Example.java
  5. +194 −0 src/main/java/ch/ethz/globis/tinspin/TestInstances.java
  6. +191 −170 src/main/java/ch/ethz/globis/tinspin/TestManager.java
  7. +56 −63 src/main/java/ch/ethz/globis/tinspin/TestRunner.java
  8. +0 −791 src/main/java/ch/ethz/globis/tinspin/TestStats.java
  9. +0 −329 src/main/java/ch/ethz/globis/tinspin/data/AbstractTest.java
  10. +1 −17 src/main/java/ch/ethz/globis/tinspin/data/TestPoint.java
  11. +5 −5 src/main/java/ch/ethz/globis/tinspin/data/TestPointSky.java
  12. +0 −13 src/main/java/ch/ethz/globis/tinspin/data/TestRectangle.java
  13. +6 −5 src/main/java/ch/ethz/globis/tinspin/data/TestRectangleTOUCH.java
  14. +4 −33 src/main/java/ch/ethz/globis/tinspin/util/TestRunnerOV.java
  15. +0 −294 src/main/java/ch/ethz/globis/tinspin/wrappers/Candidate.java
  16. +55 −0 src/main/java/ch/ethz/globis/tinspin/wrappers/CandidatePHC.java
  17. +2 −2 src/main/java/ch/ethz/globis/tinspin/wrappers/PointPHC.java
  18. +2 −2 src/main/java/ch/ethz/globis/tinspin/wrappers/PointPHC2.java
  19. +2 −2 src/main/java/ch/ethz/globis/tinspin/wrappers/PointPHCCTree.java
  20. +2 −2 src/main/java/ch/ethz/globis/tinspin/wrappers/PointPHCF.java
  21. +2 −2 src/main/java/ch/ethz/globis/tinspin/wrappers/PointPHCRectangle.java
  22. +2 −5 src/main/java/ch/ethz/globis/tinspin/wrappers/PointPHC_IPP.java
  23. +2 −2 src/main/java/ch/ethz/globis/tinspin/wrappers/RectanglePHC.java
  24. +2 −2 src/main/java/ch/ethz/globis/tinspin/wrappers/RectanglePHC2.java
  25. +2 −2 src/main/java/ch/ethz/globis/tinspin/wrappers/RectanglePHCF.java
  26. +2 −2 src/main/java/ch/ethz/globis/tinspin/wrappers/RectanglePHC_IPP.java
  27. +5 −4 src/test/java/ch/ethz/globis/tinspin/AbstractWrapperTest.java
  28. +9 −6 src/test/java/ch/ethz/globis/tinspin/TestPointWrappers.java
  29. +6 −6 src/test/java/ch/ethz/globis/tinspin/TestRectangleWrappers.java
@@ -1,3 +1,8 @@
2018-12-10
==========
- (TZ) Modularization, new base module tinspin-common
- (TZ) Added new Example

2018-11-23
==========
- (TZ) Added (very basic!) import for HDF5 files.
@@ -8,6 +8,23 @@ TinSpin provides several dataset generators for point data and rectangle data. T

The framework was originally developed at ETH Zurich in the GlobIS group. It is now maintained by Tilmann Zäschke.

# Changelog

2018-12:
* Major refactoring with modularization, new Maven module 'tinspin-common'
* Added new [Example](src/main/java/ch/ethz/globis/tinspin/Example.java) for custom testing
* Added (very basic!) import for HDF5 files.
* Testing: Updated Window Query generator again; Use result count only from first run, for comparability; Updated timings to use nanoSecs internally
* CHANGE: WQ timings now return time/query instead of time/result

2018-07:
* New logging output with ops/sec instead of time/op
* Operations without side effects (window query, point query, kNN search) are repeatedly executed until a minimum time has passed (in order to avoid problems with warm-up)

# Example

The [Example](src/main/java/ch/ethz/globis/tinspin/Example.java) class demonstrates how to test you own index.

# Results

Some results can be found in the doc folder. The file [benchmark-high-dim-2018-12.ods](doc/benchmark-high-dim-2018-12.ods) contains benchmarks with high-dimensional datasets, such as GloVe-25, GloVe-50, SIFT-128, NYTimes-256 and MNIST-784 (see [ann-benchmark](https://github.com/erikbern/ann-benchmarks)).
@@ -48,17 +48,22 @@
<dependency>
<groupId>ch.ethz.globis.phtree</groupId>
<artifactId>phtree</artifactId>
<version>2.0.1</version>
<version>[2.0,)</version>
</dependency>
<dependency>
<groupId>org.zoodb</groupId>
<artifactId>zoodb</artifactId>
<version>0.4.8</version>
</dependency>
<dependency>
<groupId>org.tinspin</groupId>
<artifactId>tinspin-common</artifactId>
<version>[1.0,)</version>
</dependency>
<dependency>
<groupId>org.tinspin</groupId>
<artifactId>tinspin-indexes</artifactId>
<version>1.7.0</version>
<version>[1.7,)</version>
</dependency>
<!-- <dependency>
<groupId>org.tinspin</groupId>
@@ -0,0 +1,67 @@
/*
* Copyright 2011-2016 ETH Zurich. All Rights Reserved.
*
* This software is the proprietary information of ETH Zurich.
* Use is subject to license terms.
*/
package ch.ethz.globis.tinspin;

import java.io.Serializable;

import ch.ethz.globis.tinspin.wrappers.PointPHC;

public class Example {

private static class MyIndexHandle implements IndexHandle, Serializable {

private static final long serialVersionUID = 1L;

@Override
public String name() {
return "MyIndex";
}

@Override
public String getCandidateClassNameRectangle() {
throw new UnsupportedOperationException();
}

@Override
public String getCandidateClassNamePoint() {
//We only need the String name here:
return PointPHC.class.getName();
}
};


public static void main(String[] args) {
//How to test your own index

//1) Implement an Index into a wrapper class, such as PointPHC.class,
// this requires the 'Candidate' class from tinspin-common.

//2) Create an IndexHandle
IndexHandle myIndex = new MyIndexHandle();

//3) Create TestStats
int N = 10_000; //10_000 points
int DIM = 3; //3 dimensions
TestStats ts = new TestStats(TestInstances.TST.CUBE_P, myIndex, N, DIM, 1.0);

//4a) Either run it as single test:
// Features: This is mainly useful for debugging and superficial tests
// TestRunner test = new TestRunner(ts);
// TestStats s = test.run();
// System.out.println(s);

//4b) Or run it with the Framework
// Features of running the framework:
// - repeated tests with averaged results
// - results are written to logfiiles in 'target/logs'
// - each repeat is run in a separate virtual machine via RMI
// - each repeat is warmed up with a small dataset
ts.cfgNRepeat = 2;
TestManager.runTest(ts);
}

}
@@ -0,0 +1,194 @@
/*
* Copyright 2011-2016 ETH Zurich. All Rights Reserved.
*
* This software is the proprietary information of ETH Zurich.
* Use is subject to license terms.
*/
package ch.ethz.globis.tinspin;

import org.tinspin.data.hdf5.TestPointHDF5;
import org.tinspin.wrappers.PointCTZ;

import ch.ethz.globis.tinspin.data.AbstractTest;
import ch.ethz.globis.tinspin.data.TestPointCSV;
import ch.ethz.globis.tinspin.data.TestPointCluster;
import ch.ethz.globis.tinspin.data.TestPointCube;
import ch.ethz.globis.tinspin.data.TestPointOSM;
import ch.ethz.globis.tinspin.data.TestPointSky;
import ch.ethz.globis.tinspin.data.TestPointTiger;
import ch.ethz.globis.tinspin.data.TestRectangleCluster;
import ch.ethz.globis.tinspin.data.TestRectangleCube;
import ch.ethz.globis.tinspin.data.TestRectangleOSM;
import ch.ethz.globis.tinspin.data.TestRectangleTOUCH;
import ch.ethz.globis.tinspin.data.TestRectangleTiger;
import ch.ethz.globis.tinspin.wrappers.PointArray;
import ch.ethz.globis.tinspin.wrappers.PointCritBitZ;
import ch.ethz.globis.tinspin.wrappers.PointKDZ;
import ch.ethz.globis.tinspin.wrappers.PointPHC;
import ch.ethz.globis.tinspin.wrappers.PointPHC2;
import ch.ethz.globis.tinspin.wrappers.PointPHCF;
import ch.ethz.globis.tinspin.wrappers.PointPHC_IPP;
import ch.ethz.globis.tinspin.wrappers.PointQuad0Z;
import ch.ethz.globis.tinspin.wrappers.PointQuadZ;
import ch.ethz.globis.tinspin.wrappers.PointQuadZ2;
import ch.ethz.globis.tinspin.wrappers.PointRStarZ;
import ch.ethz.globis.tinspin.wrappers.PointSTRZ;
import ch.ethz.globis.tinspin.wrappers.RectangleArray;
import ch.ethz.globis.tinspin.wrappers.RectanglePHC;
import ch.ethz.globis.tinspin.wrappers.RectanglePHC2;
import ch.ethz.globis.tinspin.wrappers.RectanglePHCF;
import ch.ethz.globis.tinspin.wrappers.RectanglePHC_IPP;
import ch.ethz.globis.tinspin.wrappers.RectangleQuad0Z;
import ch.ethz.globis.tinspin.wrappers.RectangleQuadZ;
import ch.ethz.globis.tinspin.wrappers.RectangleRStarZ;
import ch.ethz.globis.tinspin.wrappers.RectangleSTRZ;

public class TestInstances {

/**
* Enum with shortcuts to the candidate test classes.
*
* The class names can be overridden in the TestStats class.
*/
public enum IDX implements IndexHandle {
//Our implementations
//===================
/** Naive array implementation, for verification only */
ARRAY(PointArray.class.getName(), RectangleArray.class.getName()),
/** PH-Tree */
PHC(PointPHC.class.getName(), RectanglePHC.class.getName()),
/** PH-Tree with different preprocessor */
PHC2(PointPHC2.class.getName(), RectanglePHC2.class.getName()),
/** PH-Tree based on PhTreeF */
PHCF(PointPHCF.class.getName(), RectanglePHCF.class.getName()),
/** PH-Tree with Integer pre-processor. */
PHC_IPP(PointPHC_IPP.class.getName(), RectanglePHC_IPP.class.getName()),
/** CritBit */
CBZ(PointCritBitZ.class.getName(), ""),
/** CoverTree */
CTZ(PointCTZ.class.getName(), ""),
/** KD-Tree */
KDZ(PointKDZ.class.getName(), ""),
/** Quadtree with HC navigation */
QTZ(PointQuadZ.class.getName(), RectangleQuadZ.class.getName()),
/** Quadtree with HC navigation v2 */
QT2Z(PointQuadZ2.class.getName(), ""),
/** Plain Quadtree */
QT0Z(PointQuad0Z.class.getName(), RectangleQuad0Z.class.getName()),
/** RStarTree */
RSZ(PointRStarZ.class.getName(), RectangleRStarZ.class.getName()),
/** STR-loaded RStarTree */
STRZ(PointSTRZ.class.getName(), RectangleSTRZ.class.getName()),

//3rd party implementations
//=========================
PRT("ch.ethz.globis.tinspin.wrappers.PointPRT",
"ch.ethz.globis.tinspin.wrappers.RectanglePRT"),
/** R*Tree by lokeshj */
RSL("ch.ethz.globis.tinspin.wrappers.PointRSLokeshj",
"ch.ethz.globis.tinspin.wrappers.Rectangle.RSLokeshj"),
/** R*Tree by Seeger */
RSS("ch.ethz.globis.tinspin.wrappers.PointRStarSeeger",
"ch.ethz.globis.tinspin.wrappers.RectangleRStarSeeger"),
// RSS2("ch.ethz.globis.tinspin.wrappers.PointRStarSeeger2",
// "ch.ethz.globis.tinspin.wrappers.RectangleRStarSeeger2"),
CBR("ch.ethz.globis.tinspin.wrappers.PointCBR", null),
CBF("ch.ethz.globis.tinspin.wrappers.PointCBF", null),
XTR("ch.ethz.globis.tinspin.wrappers.PointXtree",
"ch.ethz.globis.tinspin.wrappers.RectangleXtree"),
XTS("ch.ethz.globis.tinspin.wrappers.PointXTSeeger", null),
KD_LEVY("ch.ethz.globis.tinspin.wrappers.PointKDL", null),
KD_SAVA("ch.ethz.globis.tinspin.wrappers.PointKDS", null),
KD_RED("ch.ethz.globis.tinspin.wrappers.PointKDRed", null),
WBT("org.tinspin.wrappers.PointWBT", null),
WCT("org.tinspin.wrappers.PointWCT", null),
/** Faster Cover Tree by Christoph Conrads. */
FCT("org.tinspin.wrappers.PointFCT", null),

//Experimental implementations
//============================
CUSTOM("", ""),
HIL("", ""),
MX_CIF("", ""),
OCT("", ""),
/** original PH tree */
PHCv1("ch.ethz.globis.tinspin.wrappers.PointPHC_v1", ""),
/** based on PhEntry */
PHC_PHE("ch.ethz.globis.tinspin.wrappers.PointPHC_PHE", null),
/** C++ version of PH-Tree */
PHCC("ch.ethz.globis.tinspin.wrappers.PointPHCCTree", null),
/** Uses a region tree for points. */
PHC_RECTANGLE("ch.ethz.globis.tinspin.wrappers.PointPHCRectangle", null),

//Other
//=====
CUSTOM1(null, null),
CUSTOM2(null, null),
CUSTOM3(null, null),
USE_PARAM_CLASS(null, null);

private final String candidateClassNamePoint;
private final String candidateClassNameRectangle;

IDX(String candidateClassNamePoint,
String candidateClassNameRectangle) {
this.candidateClassNamePoint = candidateClassNamePoint;
this.candidateClassNameRectangle = candidateClassNameRectangle;
}

@Override
public String getCandidateClassNamePoint() {
return candidateClassNamePoint;
}

@Override
public String getCandidateClassNameRectangle() {
return candidateClassNameRectangle;
}
}

public enum TST implements TestHandle {
CUBE_P( TestPointCube.class, false),
CLUSTER_P( TestPointCluster.class, false),
SKYLINE( TestPointSky.class, false),
TIGER_P( TestPointTiger.class, false),
TIGER32( "", false),
OSM_P( TestPointOSM.class, false),
MBR_SIZE( "", false),
MBR_ASPECT( "", false),
VORTEX( "", false),
// CUSTOM( "", false),
CSV( TestPointCSV.class, false),
HDF5( TestPointHDF5.class, false),

CUBE_R( TestRectangleCube.class, true),
CLUSTER_R( TestRectangleCluster.class, true),
OSM_R( TestRectangleOSM.class, true),
TIGER_R( TestRectangleTiger.class, true),
TOUCH( TestRectangleTOUCH.class, true);

private final String className;
private boolean isRangeData;

TST(Class<? extends AbstractTest> cls, boolean isRangeData) {
this.className = cls.getName();
this.isRangeData = isRangeData;
}

TST(String className, boolean isRangeData) {
this.className = className;
this.isRangeData = isRangeData;
}

@Override
public String getTestClassName() {
return className;
}

@Override
public boolean isRangeData() {
return isRangeData;
}
}

}
Oops, something went wrong.

0 comments on commit 028fe14

Please sign in to comment.