test_class.declarator: log = LoggerFactory.getLogger(KDTreeTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger log = LoggerFactory.getLogger(KDTreeTest.class);
test_class.type: Logger
test_class.var_name: log
test_class.declarator: loader
test_class.modifier: private
test_class.original_string: private DataIngester loader;
test_class.type: DataIngester
test_class.var_name: loader
test_class.declarator: data
test_class.modifier: private
test_class.original_string: private List<Datum> data;
test_class.type: List<Datum>
test_class.var_name: data
test_class.file: contrib/src/test/java/macrobase/analysis/index/KDTreeTest.java
test_class.identifier: KDTreeTest
test_case.body: @Test
      public void testEstimateDistanceVectors() throws Exception {
          this.setUpVerySimpleCsv();
          KDTree node;
          node = new KDTree(data, 2);
          double[] zeroArray = {0, 0, 0};
          for (Datum datum : data) {
              // Check that minimum distance is zero if the point is inside.
              assertArrayEquals(zeroArray, node.getMinMaxDistanceVectors(datum)[0].toArray(), 1e-7);
          }
  
          double[] farAwayPoint = {-10, 5, 21};
          Datum datum = new Datum(new ArrayList<>(), new ArrayRealVector(farAwayPoint));
          double[] minArray = {11, 0, 12};
          double[] maxArray = {21, 4, 20};
          RealVector[] minMaxVectors= node.getMinMaxDistanceVectors(datum);
          assertArrayEquals(minArray, minMaxVectors[0].toArray(), 1e-7);
          assertArrayEquals(maxArray, minMaxVectors[1].toArray(), 1e-7);
      }
test_case.class_method_signature: KDTreeTest.testEstimateDistanceVectors()
test_case.full_signature: @Test public void testEstimateDistanceVectors()
test_case.identifier: testEstimateDistanceVectors
test_case.invocations: setUpVerySimpleCsv assertArrayEquals toArray getMinMaxDistanceVectors getMinMaxDistanceVectors assertArrayEquals toArray assertArrayEquals toArray
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testEstimateDistanceVectors()
focal_class.declarator: leafCapacity
focal_class.modifier: private
focal_class.original_string: private int leafCapacity;
focal_class.type: int
focal_class.var_name: leafCapacity
focal_class.declarator: loChild
focal_class.modifier: protected
focal_class.original_string: protected KDTree loChild;
focal_class.type: KDTree
focal_class.var_name: loChild
focal_class.declarator: hiChild
focal_class.modifier: protected
focal_class.original_string: protected KDTree hiChild;
focal_class.type: KDTree
focal_class.var_name: hiChild
focal_class.declarator: k
focal_class.modifier: protected
focal_class.original_string: protected int k;
focal_class.type: int
focal_class.var_name: k
focal_class.declarator: items
focal_class.modifier: protected
focal_class.original_string: protected List<Datum> items;
focal_class.type: List<Datum>
focal_class.var_name: items
focal_class.declarator: nBelow
focal_class.modifier: protected
focal_class.original_string: protected int nBelow;
focal_class.type: int
focal_class.var_name: nBelow
focal_class.declarator: mean
focal_class.modifier: protected
focal_class.original_string: protected RealVector mean;
focal_class.type: RealVector
focal_class.var_name: mean
focal_class.declarator: splitDimension
focal_class.modifier: private
focal_class.original_string: private int splitDimension;
focal_class.type: int
focal_class.var_name: splitDimension
focal_class.declarator: splitValue
focal_class.modifier: private
focal_class.original_string: private double splitValue;
focal_class.type: double
focal_class.var_name: splitValue
focal_class.declarator: boundaries
focal_class.modifier: private
focal_class.original_string: private double[][] boundaries;
focal_class.type: double[][]
focal_class.var_name: boundaries
focal_class.file: contrib/src/main/java/macrobase/analysis/index/KDTree.java
focal_class.identifier: KDTree
focal_class.class_method_signature: KDTree.KDTree(List<Datum> data, int leafCapacity)
focal_class.full_signature: public  KDTree(List<Datum> data, int leafCapacity)
focal_class.identifier: KDTree
focal_class.modifiers: public
focal_class.parameters: (List<Datum> data, int leafCapacity)
focal_class.signature:  KDTree(List<Datum> data, int leafCapacity)
focal_class.class_method_signature: KDTree.getMinMaxDistanceVectors(Datum queryDatum)
focal_class.full_signature: public RealVector[] getMinMaxDistanceVectors(Datum queryDatum)
focal_class.identifier: getMinMaxDistanceVectors
focal_class.modifiers: public
focal_class.parameters: (Datum queryDatum)
focal_class.return: RealVector[]
focal_class.signature: RealVector[] getMinMaxDistanceVectors(Datum queryDatum)
focal_class.class_method_signature: KDTree.estimateL2DistanceSquared(Datum queryDatum)
focal_class.full_signature: public double[] estimateL2DistanceSquared(Datum queryDatum)
focal_class.identifier: estimateL2DistanceSquared
focal_class.modifiers: public
focal_class.parameters: (Datum queryDatum)
focal_class.return: double[]
focal_class.signature: double[] estimateL2DistanceSquared(Datum queryDatum)
focal_class.class_method_signature: KDTree.isInsideBoundaries(Datum queryDatum)
focal_class.full_signature: public boolean isInsideBoundaries(Datum queryDatum)
focal_class.identifier: isInsideBoundaries
focal_class.modifiers: public
focal_class.parameters: (Datum queryDatum)
focal_class.return: boolean
focal_class.signature: boolean isInsideBoundaries(Datum queryDatum)
focal_class.class_method_signature: KDTree.getItems()
focal_class.full_signature: public List<Datum> getItems()
focal_class.identifier: getItems
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<Datum>
focal_class.signature: List<Datum> getItems()
focal_class.class_method_signature: KDTree.getMean()
focal_class.full_signature: public RealVector getMean()
focal_class.identifier: getMean
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: RealVector
focal_class.signature: RealVector getMean()
focal_class.class_method_signature: KDTree.getBoundaries()
focal_class.full_signature: public double[][] getBoundaries()
focal_class.identifier: getBoundaries
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: double[][]
focal_class.signature: double[][] getBoundaries()
focal_class.class_method_signature: KDTree.getLoChild()
focal_class.full_signature: public KDTree getLoChild()
focal_class.identifier: getLoChild
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: KDTree
focal_class.signature: KDTree getLoChild()
focal_class.class_method_signature: KDTree.getHiChild()
focal_class.full_signature: public KDTree getHiChild()
focal_class.identifier: getHiChild
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: KDTree
focal_class.signature: KDTree getHiChild()
focal_class.class_method_signature: KDTree.isLeaf()
focal_class.full_signature: public boolean isLeaf()
focal_class.identifier: isLeaf
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isLeaf()
focal_class.class_method_signature: KDTree.getnBelow()
focal_class.full_signature: public int getnBelow()
focal_class.identifier: getnBelow
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getnBelow()
focal_class.class_method_signature: KDTree.getSplitDimension()
focal_class.full_signature: public int getSplitDimension()
focal_class.identifier: getSplitDimension
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getSplitDimension()
focal_class.class_method_signature: KDTree.toString(int indent)
focal_class.full_signature: public String toString(int indent)
focal_class.identifier: toString
focal_class.modifiers: public
focal_class.parameters: (int indent)
focal_class.return: String
focal_class.signature: String toString(int indent)
focal_class.class_method_signature: KDTree.toString()
focal_class.full_signature: public String toString()
focal_class.identifier: toString
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_method.body: public RealVector[] getMinMaxDistanceVectors(Datum queryDatum) {
          double[] minDifferences = new double[k];
          double[] maxDifferences = new double[k];
  
          RealVector metrics = queryDatum.metrics();
          for (int i=0; i<k; i++) {
              double deltaLo = metrics.getEntry(i) - this.boundaries[i][0];
              double deltaHi = this.boundaries[i][1] - metrics.getEntry(i);
              // point is outside
              double minD = Math.abs(deltaLo);
              double maxD = Math.abs(deltaHi);
              if (minD < maxD) {
                  minDifferences[i] = minD;
                  maxDifferences[i] = maxD;
              } else {
                  minDifferences[i] = maxD;
                  maxDifferences[i] = minD;
              }
  
              if (deltaLo > 0 && deltaHi > 0) {
                  // Point is inside so only add to max distance.
                  minDifferences[i] = 0;
              }
          }
  
          RealVector[] rtn = new RealVector[2];
          rtn[0] = new ArrayRealVector(minDifferences);
          rtn[1] = new ArrayRealVector(maxDifferences);
          return rtn;
      }
focal_method.class_method_signature: KDTree.getMinMaxDistanceVectors(Datum queryDatum)
focal_method.full_signature: public RealVector[] getMinMaxDistanceVectors(Datum queryDatum)
focal_method.identifier: getMinMaxDistanceVectors
focal_method.invocations: metrics getEntry getEntry abs abs
focal_method.modifiers: public
focal_method.parameters: (Datum queryDatum)
focal_method.return: RealVector[]
focal_method.signature: RealVector[] getMinMaxDistanceVectors(Datum queryDatum)