Search in sources :

Example 6 with DataPoint

use of org.deeplearning4j.clustering.sptree.DataPoint in project deeplearning4j by deeplearning4j.

the class VpTreeNodeTest method vpTreeTest.

@Test
public void vpTreeTest() {
    List<DataPoint> points = new ArrayList<>();
    points.add(new DataPoint(0, Nd4j.create(new double[] { 55, 55 })));
    points.add(new DataPoint(1, Nd4j.create(new double[] { 60, 60 })));
    points.add(new DataPoint(2, Nd4j.create(new double[] { 65, 65 })));
    VPTree tree = new VPTree(points);
    List<DataPoint> add = new ArrayList<>();
    List<Double> distances = new ArrayList<>();
    tree.search(new DataPoint(0, Nd4j.create(new double[] { 50, 50 })), 1, add, distances);
    DataPoint assertion = add.get(0);
    assertEquals(new DataPoint(0, Nd4j.create(new double[] { 55, 55 })), assertion);
}
Also used : DataPoint(org.deeplearning4j.clustering.sptree.DataPoint) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

DataPoint (org.deeplearning4j.clustering.sptree.DataPoint)6 ArrayList (java.util.ArrayList)3 VPTree (org.deeplearning4j.clustering.vptree.VPTree)2 AtomicDouble (com.google.common.util.concurrent.AtomicDouble)1 HeapItem (org.deeplearning4j.clustering.sptree.HeapItem)1 Test (org.junit.Test)1 INDArray (org.nd4j.linalg.api.ndarray.INDArray)1