当前位置: 首页>>代码示例>>Java>>正文


Java Relation.getRangeQuery方法代码示例

本文整理汇总了Java中de.lmu.ifi.dbs.elki.database.relation.Relation.getRangeQuery方法的典型用法代码示例。如果您正苦于以下问题:Java Relation.getRangeQuery方法的具体用法?Java Relation.getRangeQuery怎么用?Java Relation.getRangeQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在de.lmu.ifi.dbs.elki.database.relation.Relation的用法示例。


在下文中一共展示了Relation.getRangeQuery方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import de.lmu.ifi.dbs.elki.database.relation.Relation; //导入方法依赖的package包/类
/**
 * Run the leader clustering algorithm.
 * 
 * @param relation Data set
 * @return Clustering result
 */
public Clustering<PrototypeModel<O>> run(Relation<O> relation) {
  RangeQuery<O> rq = relation.getRangeQuery(getDistanceFunction(), threshold);

  ModifiableDBIDs seen = DBIDUtil.newHashSet(relation.size());
  Clustering<PrototypeModel<O>> clustering = new Clustering<>("Prototype clustering", "prototype-clustering");

  int queries = 0;
  FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Leader clustering", relation.size(), LOG) : null;
  for(DBIDIter it = relation.iterDBIDs(); it.valid() && seen.size() < relation.size(); it.advance()) {
    if(seen.contains(it)) {
      continue;
    }
    DoubleDBIDList res = rq.getRangeForDBID(it, threshold);
    ++queries;
    ModifiableDBIDs ids = DBIDUtil.newArray(res.size());
    for(DBIDIter cand = res.iter(); cand.valid(); cand.advance()) {
      if(seen.add(cand)) {
        LOG.incrementProcessed(prog);
        ids.add(cand);
      }
    }
    assert (ids.size() > 0 && ids.contains(it));
    PrototypeModel<O> mod = new SimplePrototypeModel<>(relation.get(it));
    clustering.addToplevelCluster(new Cluster<>(ids, mod));
  }
  LOG.statistics(new LongStatistic(this.getClass().getName() + ".queries", queries));
  LOG.ensureCompleted(prog);
  return clustering;
}
 
开发者ID:elki-project,项目名称:elki,代码行数:36,代码来源:Leader.java

示例2: getRangeQuery

import de.lmu.ifi.dbs.elki.database.relation.Relation; //导入方法依赖的package包/类
@Override
public <O> RangeQuery<O> getRangeQuery(DistanceQuery<O> distanceQuery, Object... hints) {
  @SuppressWarnings("unchecked")
  final Relation<O> relation = (Relation<O>) distanceQuery.getRelation();
  return relation.getRangeQuery(distanceQuery, hints);
}
 
开发者ID:elki-project,项目名称:elki,代码行数:7,代码来源:AbstractDatabase.java

示例3: initRangeQueries

import de.lmu.ifi.dbs.elki.database.relation.Relation; //导入方法依赖的package包/类
/**
 * Initializes the dimension selecting distancefunctions to determine the
 * preference vectors.
 *
 * @param relation the database storing the objects
 * @param dimensionality the dimensionality of the objects
 * @return the dimension selecting distancefunctions to determine the
 *         preference vectors
 */
private RangeQuery<V>[] initRangeQueries(Relation<V> relation, int dimensionality) {
  @SuppressWarnings("unchecked")
  RangeQuery<V>[] rangeQueries = (RangeQuery<V>[]) new RangeQuery[dimensionality];
  for(int d = 0; d < dimensionality; d++) {
    rangeQueries[d] = relation.getRangeQuery(new PrimitiveDistanceQuery<>(relation, new OnedimensionalDistanceFunction(d)));
  }
  return rangeQueries;
}
 
开发者ID:elki-project,项目名称:elki,代码行数:18,代码来源:DiSHPreferenceVectorIndex.java

示例4: getRangeQuery

import de.lmu.ifi.dbs.elki.database.relation.Relation; //导入方法依赖的package包/类
/**
 * Get a range query object for the given distance function for radius-based
 * neighbor search. (Range queries in ELKI refers to radius-based ranges, not
 * rectangular query windows.)
 *
 * An index is used when possible, but it may fall back to a linear scan.
 *
 * Hints include:
 * <ul>
 * <li>Range: maximum range requested</li>
 * <li>{@link de.lmu.ifi.dbs.elki.database.query.DatabaseQuery#HINT_BULK} bulk
 * query needed</li>
 * </ul>
 *
 * @param <O> Object type
 * @param database Database
 * @param distanceFunction Distance function
 * @param hints Optimizer hints
 * @return KNN Query object
 */
public static <O> RangeQuery<O> getRangeQuery(Database database, DistanceFunction<? super O> distanceFunction, Object... hints) {
  final Relation<O> relation = database.getRelation(distanceFunction.getInputTypeRestriction(), hints);
  final DistanceQuery<O> distanceQuery = relation.getDistanceQuery(distanceFunction, hints);
  return relation.getRangeQuery(distanceQuery, hints);
}
 
开发者ID:elki-project,项目名称:elki,代码行数:26,代码来源:QueryUtil.java


注:本文中的de.lmu.ifi.dbs.elki.database.relation.Relation.getRangeQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。