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

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


    }
    else if(cnum == -1) {
      return DBIDUtil.EMPTYDBIDS.iterator();
    }
    // colors
    DBIDs ids = selectedSegments.get(cnum).getDBIDs();
    return (ids != null) ? ids.iterator() : DBIDUtil.EMPTYDBIDS.iterator();
  }
View Full Code Here


   * @param database the database holding the objects
   * @param k the size of the random sample
   * @return the initial seed list
   */
  private List<ORCLUSCluster> initialSeeds(Relation<V> database, int k) {
    DBIDs randomSample = DBIDUtil.randomSample(database.getDBIDs(), k, seed);
    V factory = DatabaseUtil.assumeVectorField(database).getFactory();
    List<ORCLUSCluster> seeds = new ArrayList<ORCLUSCluster>();
    for(DBID id : randomSample) {
      seeds.add(new ORCLUSCluster(database.get(id), id, factory));
    }
View Full Code Here

      out.commentPrintLn(buf.toString());
    }
    out.flush();

    // print ids.
    DBIDs ids = clus.getIDs();
    Iterator<DBID> iter = ids.iterator();

    while(iter.hasNext()) {
      printObject(out, db, iter.next(), ra);
    }
    out.commentPrintSeparator();
View Full Code Here

    final NeighborSetPredicate npred = getNeighborSetPredicateFactory().instantiate(nrel);
    WritableDataStore<Double> scores = DataStoreUtil.makeStorage(relation.getDBIDs(), DataStoreFactory.HINT_STATIC, Double.class);

    MeanVariance zmv = new MeanVariance();
    for(DBID id : relation.iterDBIDs()) {
      DBIDs neighbors = npred.getNeighborDBIDs(id);
      // Compute Mean of neighborhood
      Mean localmean = new Mean();
      for(DBID n : neighbors) {
        if(id.equals(n)) {
          continue;
View Full Code Here

      out.commentPrintLn(buf.toString());
    }
    out.flush();

    // print ids.
    DBIDs ids = clus.getIDs();
    Iterator<DBID> iter = ids.iterator();

    while(iter.hasNext()) {
      printObject(out, db, iter.next(), ra);
    }
    out.commentPrintSeparator();
View Full Code Here

    PCARunner<NV> pcarun = ClassGenericsUtil.parameterizeOrAbort(PCARunner.class, new EmptyParameterization());

    Iterator<Cluster<EMModel<NV>>> ci = clustering.getAllClusters().iterator();
    for(int cnum = 0; cnum < clustering.getAllClusters().size(); cnum++) {
      Cluster<EMModel<NV>> clus = ci.next();
      DBIDs ids = clus.getIDs();

      if(ids.size() > 0) {
        Matrix covmat = clus.getModel().getCovarianceMatrix();
        NV centroid = clus.getModel().getMean();
        Vector cent = new Vector(proj.fastProjectDataToRenderSpace(centroid));

        // Compute the eigenvectors
View Full Code Here

    Iterator<Cluster<Model>> ci = clustering.getAllClusters().iterator();

    for(int cnum = 0; cnum < clustering.getAllClusters().size(); cnum++) {
      Cluster<?> clus = ci.next();
      final DBIDs ids = clus.getIDs();

      if(alpha >= Double.POSITIVE_INFINITY) {
        GrahamScanConvexHull2D hull = new GrahamScanConvexHull2D();

        for(DBID clpnum : ids) {
          double[] projP = proj.fastProjectDataToRenderSpace(rel.get(clpnum));
          hull.add(new Vector(projP));
        }
        Polygon chres = hull.getHull();

        // Plot the convex hull:
        if(chres != null && chres.size() > 1) {
          SVGPath path = new SVGPath(chres);
          // Approximate area (using bounding box)
          double hullarea = SpatialUtil.volume(chres);
          final double relativeArea = (projarea - hullarea) / projarea;
          final double relativeSize = (double) ids.size() / rel.size();
          opacity = Math.sqrt(relativeSize * relativeArea);

          Element hulls = path.makeElement(svgp);
          addCSSClasses(svgp, cnum, opacity);
          SVGUtil.addCSSClass(hulls, CLUSTERHULL + cnum);
          layer.appendChild(hulls);
        }
      }
      else {
        ArrayList<Vector> ps = new ArrayList<Vector>(ids.size());
        for(DBID clpnum : ids) {
          double[] projP = proj.fastProjectDataToRenderSpace(rel.get(clpnum));
          ps.add(new Vector(projP));
        }
        List<Polygon> polys = (new AlphaShape(ps, alpha * Projection.SCALE)).compute();
 
View Full Code Here

    if(cur instanceof NeighborSetPredicate) {
      if(parts.length == partpos + 1) {
        NeighborSetPredicate pred = (NeighborSetPredicate) cur;
        DBID id = stringToDBID(parts[partpos]);
        if(id != null) {
          DBIDs neighbors = pred.getNeighborDBIDs(id);
          re.appendKeyValue("DBID", id);
          re.appendKeyArray("neighbors");
          for(DBID nid : neighbors) {
            re.appendString(nid.toString());
          }
View Full Code Here

  @Override
  protected void redraw() {
    addCSSClasses(svgp);
    DBIDSelection selContext = context.getSelection();
    if(selContext != null) {
      DBIDs selection = selContext.getSelectedIds();
      GrahamScanConvexHull2D hull = new GrahamScanConvexHull2D();
      for(DBID i : selection) {
        try {
          hull.add(new Vector(proj.fastProjectDataToRenderSpace(rel.get(i))));
        }
View Full Code Here

   * @return the RkNNs of the specified ids, i.e. the kNNs which have been
   *         updated
   */
  private ArrayDBIDs updateKNNsAndRkNNs(DBIDs ids) {
    ArrayDBIDs rkNN_ids = DBIDUtil.newArray();
    DBIDs oldids = DBIDUtil.difference(relation.getDBIDs(), ids);
    for(DBID id1 : oldids) {
      List<DistanceResultPair<D>> kNNs = storage.get(id1);
      D knnDist = kNNs.get(kNNs.size() - 1).getDistance();
      // look for new kNNs
      List<DistanceResultPair<D>> newKNNs = new ArrayList<DistanceResultPair<D>>();
View Full Code Here

TOP

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

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.