Package de.lmu.ifi.dbs.elki.database.ids

Examples of de.lmu.ifi.dbs.elki.database.ids.DBID


  protected void batchNN(AbstractRStarTreeNode<?, ?> node, Map<DBID, KNNHeap<DoubleDistance>> knnLists) {
    if(node.isLeaf()) {
      for(int i = 0; i < node.getNumEntries(); i++) {
        SpatialEntry p = node.getEntry(i);
        for(Entry<DBID, KNNHeap<DoubleDistance>> ent : knnLists.entrySet()) {
          final DBID q = ent.getKey();
          final KNNHeap<DoubleDistance> knns_q = ent.getValue();
          DoubleDistance knn_q_maxDist = knns_q.getKNNDistance();

          DBID pid = ((LeafEntry) p).getDBID();
          // FIXME: objects are NOT accessible by DBID in a plain rtree context!
          DoubleDistance dist_pq = distanceFunction.distance(relation.get(pid), relation.get(q));
          tree.distanceCalcs++;
          if(dist_pq.compareTo(knn_q_maxDist) <= 0) {
            knns_q.add(dist_pq, pid);
View Full Code Here


    Map<DBID, KNNHeap<D>> knnHeaps = new HashMap<DBID, KNNHeap<D>>(entries.size());
    ModifiableDBIDs ids = DBIDUtil.newArray(entries.size());

    // insert
    for(MkAppEntry<D> entry : entries) {
      DBID id = entry.getRoutingObjectID();
      // create knnList for the object
      knnHeaps.put(id, new KNNHeap<D>(k_max + 1, getDistanceQuery().infiniteDistance()));

      ids.add(id);
      // insert the object
View Full Code Here

      // FIXME: doesn't use sampling yet.
      ClassStylingPolicy csp = (ClassStylingPolicy) sp;
      for(int c = csp.getMinStyle(); c < csp.getMaxStyle(); c++) {
        String key = DATALINE + "_" + c;
        for(Iterator<DBID> iter = csp.iterateClass(c); iter.hasNext();) {
          DBID id = iter.next();
          SVGPath path = new SVGPath();
          double[] yPos = proj.fastProjectDataToRenderSpace(relation.get(id));
          for(int i = 0; i < yPos.length; i++) {
            path.drawTo(getVisibleAxisX(i), yPos[i]);
          }
          Element line = path.makeElement(svgp);
          SVGUtil.addCSSClass(line, key);
          layer.appendChild(line);
        }
      }
    }
    else {
      while(ids.hasNext()) {
        DBID id = ids.next();
        SVGPath path = new SVGPath();
        double[] yPos = proj.fastProjectDataToRenderSpace(relation.get(id));
        for(int i = 0; i < yPos.length; i++) {
          path.drawTo(getVisibleAxisX(i), yPos[i]);
        }
View Full Code Here

   * @param expected expected value
   */
  protected void testSingleScore(OutlierResult result, int id, double expected) {
    org.junit.Assert.assertNotNull("No outlier result", result);
    org.junit.Assert.assertNotNull("No score result.", result.getScores());
    final DBID dbid = DBIDUtil.importInteger(id);
    org.junit.Assert.assertNotNull("No result for ID " + id, result.getScores().get(dbid));
    double actual = result.getScores().get(dbid);
    org.junit.Assert.assertEquals("Outlier score of object " + id + " doesn't match.", expected, actual, 0.0001);
  }
View Full Code Here

    for(int i = 0; i < k; i++) {
      // stop if no more results.
      if(!order.hasNext()) {
        return;
      }
      DBID cur = order.next();
      cutoff = or.getScores().get(cur);
    }
    max = or.getOutlierMeta().getActualMaximum();
    ground = or.getOutlierMeta().getTheoreticalBaseline();
    if(Double.isInfinite(ground) || Double.isNaN(ground)) {
View Full Code Here

      DBIDs selection = DBIDUtil.ensureSet(selContext.getSelectedIds());

      final double width = plotwidth / order.size();
      int begin = -1;
      for(int j = 0; j < order.size(); j++) {
        DBID id = order.get(j).getID();
        if(selection.contains(id)) {
          if(begin == -1) {
            begin = j;
          }
        }
View Full Code Here

    else {
      selection = DBIDUtil.newHashSet(selContext.getSelectedIds());
    }

    for(int i = begin; i <= end; i++) {
      DBID id = order.get(i).getID();
      if(mode == Mode.INVERT) {
        if(!selection.contains(id)) {
          selection.add(id);
        }
        else {
View Full Code Here

    ModifiableDBIDs ids = DBIDUtil.newArray(entries.size());

    // insert sequentially
    for(E entry : entries) {
      // create knnList for the object
      final DBID id = entry.getRoutingObjectID();

      ids.add(id);
      knnLists.put(id, new KNNHeap<D>(k_max, getDistanceFactory().infiniteDistance()));

      // insert the object
View Full Code Here

    Map<Integer, CLIQUESubspace<V>> denseSubspaces = new HashMap<Integer, CLIQUESubspace<V>>();

    // identify dense units
    double total = database.size();
    for(Iterator<DBID> it = database.iterDBIDs(); it.hasNext();) {
      final DBID id = it.next();
      V featureVector = database.get(id);
      for(CLIQUEUnit<V> unit : units) {
        unit.addFeatureVector(id, featureVector);
        // unit is a dense unit
        if(!it.hasNext() && unit.selectivity(total) >= tau) {
View Full Code Here

   *
   * @param node the node to be split
   * @param distanceFunction the distance function
   */
  private void promote(N node, DistanceQuery<O, D> distanceFunction) {
    DBID firstPromoted = null;
    DBID secondPromoted = null;

    // choose first and second routing object
    D currentMaxDist = distanceFunction.nullDistance();
    for(int i = 0; i < node.getNumEntries(); i++) {
      DBID id1 = node.getEntry(i).getRoutingObjectID();
      for(int j = i + 1; j < node.getNumEntries(); j++) {
        DBID id2 = node.getEntry(j).getRoutingObjectID();

        D distance = distanceFunction.distance(id1, id2);
        if(distance.compareTo(currentMaxDist) >= 0) {
          firstPromoted = id1;
          secondPromoted = id2;
          currentMaxDist = distance;
        }
      }
    }

    // partition the entries
    List<DistanceEntry<D, E>> list1 = new ArrayList<DistanceEntry<D, E>>();
    List<DistanceEntry<D, E>> list2 = new ArrayList<DistanceEntry<D, E>>();
    for(int i = 0; i < node.getNumEntries(); i++) {
      DBID id = node.getEntry(i).getRoutingObjectID();
      D d1 = distanceFunction.distance(firstPromoted, id);
      D d2 = distanceFunction.distance(secondPromoted, id);

      list1.add(new DistanceEntry<D, E>(node.getEntry(i), d1, i));
      list2.add(new DistanceEntry<D, E>(node.getEntry(i), d2, i));
View Full Code Here

TOP

Related Classes of de.lmu.ifi.dbs.elki.database.ids.DBID

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.