예제 #1
0
 /**
  * Computes for each object the distance to one reference point. (one dimensional representation
  * of the data set)
  *
  * @param refPoint Reference Point Feature Vector
  * @param database database to work on
  * @param distFunc Distance function to use
  * @return array containing the distance to one reference point for each database object and the
  *     object id
  */
 protected DoubleDBIDList computeDistanceVector(
     NumberVector refPoint,
     Relation<? extends NumberVector> database,
     PrimitiveDistanceQuery<? super NumberVector> distFunc) {
   ModifiableDoubleDBIDList referenceDists = DBIDUtil.newDistanceDBIDList(database.size());
   for (DBIDIter iditer = database.iterDBIDs(); iditer.valid(); iditer.advance()) {
     referenceDists.add(distFunc.distance(iditer, refPoint), iditer);
   }
   referenceDists.sort();
   return referenceDists;
 }
예제 #2
0
파일: OUTRES.java 프로젝트: 4sp1r3/elki
 /**
  * Refine a range query.
  *
  * @param neighc Original result
  * @param adjustedEps New epsilon
  * @return refined list
  */
 private DoubleDBIDList refineRange(DoubleDBIDList neighc, double adjustedEps) {
   ModifiableDoubleDBIDList n = DBIDUtil.newDistanceDBIDList(neighc.size());
   // We don't have a guarantee for this list to be sorted
   for (DoubleDBIDListIter neighbor = neighc.iter(); neighbor.valid(); neighbor.advance()) {
     DoubleDBIDPair p = neighbor.getPair();
     double dist = p.doubleValue();
     if (dist <= adjustedEps) {
       n.add(dist, p);
     }
   }
   return n;
 }
예제 #3
0
파일: OUTRES.java 프로젝트: 4sp1r3/elki
 /**
  * Refine neighbors within a subset.
  *
  * @param neighc Neighbor candidates
  * @param dbid Query object
  * @param df distance function
  * @param adjustedEps Epsilon range
  * @param kernel Kernel
  * @return Neighbors of neighbor object
  */
 private DoubleDBIDList subsetNeighborhoodQuery(
     DoubleDBIDList neighc,
     DBIDRef dbid,
     PrimitiveDistanceFunction<? super V> df,
     double adjustedEps,
     KernelDensityEstimator kernel) {
   ModifiableDoubleDBIDList n = DBIDUtil.newDistanceDBIDList(neighc.size());
   V query = kernel.relation.get(dbid);
   for (DoubleDBIDListIter neighbor = neighc.iter(); neighbor.valid(); neighbor.advance()) {
     DoubleDBIDPair p = neighbor.getPair();
     double dist = df.distance(query, kernel.relation.get(p));
     if (dist <= adjustedEps) {
       n.add(dist, p);
     }
   }
   return n;
 }