de.lmu.ifi.dbs.elki.database.relation.Relation.getRangeQuery()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(11.8k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中de.lmu.ifi.dbs.elki.database.relation.Relation.getRangeQuery方法的一些代码示例,展示了Relation.getRangeQuery的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Relation.getRangeQuery方法的具体详情如下:
包路径:de.lmu.ifi.dbs.elki.database.relation.Relation
类名称:Relation
方法名:getRangeQuery

Relation.getRangeQuery介绍

[英]Get a range query object for the given distance query. (Range queries in ELKI refers to radius-based ranges, not rectangular query windows.) When possible, this will use an index, but it may default to an expensive linear scan. Hints include:

  • Distance object: Maximum query range
  • DatabaseQuery#HINT_BULK bulk query needed
    [中]获取给定距离查询的范围查询对象。(ELKI中的范围查询指的是基于半径的范围,而不是矩形查询窗口。)如果可能,这将使用索引,但它可能默认为昂贵的线性扫描。提示包括:
    *距离对象:最大查询范围
    *数据库查询#提示_需要批量查询

代码示例

代码示例来源:origin: elki-project/elki

@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);
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-database

@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);
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki

@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);
}

代码示例来源:origin: elki-project/elki

/**
 * Get a range query object for the given distance query. (Range queries in
 * ELKI refers to radius-based ranges, not rectangular query windows.)
 *
 * When possible, this will use an index, but it may default to an expensive
 * linear scan.
 *
 * Hints include:
 * <ul>
 * <li>Distance object: Maximum query range</li>
 * <li>{@link DatabaseQuery#HINT_BULK} bulk query needed</li>
 * </ul>
 *
 * @param distanceFunction Distance function to use
 * @param hints Optimizer hints (optional)
 * @return KNN Query object
 */
default RangeQuery<O> getRangeQuery(DistanceFunction<? super O> distanceFunction, Object... hints) {
 DistanceQuery<O> distanceQuery = getDistanceQuery(distanceFunction, hints);
 return getRangeQuery(distanceQuery, hints);
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-core-api

/**
 * Get a range query object for the given distance query. (Range queries in
 * ELKI refers to radius-based ranges, not rectangular query windows.)
 *
 * When possible, this will use an index, but it may default to an expensive
 * linear scan.
 *
 * Hints include:
 * <ul>
 * <li>Distance object: Maximum query range</li>
 * <li>{@link DatabaseQuery#HINT_BULK} bulk query needed</li>
 * </ul>
 *
 * @param distanceFunction Distance function to use
 * @param hints Optimizer hints (optional)
 * @return KNN Query object
 */
default RangeQuery<O> getRangeQuery(DistanceFunction<? super O> distanceFunction, Object... hints) {
 DistanceQuery<O> distanceQuery = getDistanceQuery(distanceFunction, hints);
 return getRangeQuery(distanceQuery, hints);
}

代码示例来源:origin: elki-project/elki

/**
 * 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 relation Relation used
 * @param distanceFunction Distance function
 * @param hints Optimizer hints
 *
 * @param <O> Object type
 * @return KNN Query object
 */
public static <O> RangeQuery<O> getRangeQuery(Relation<O> relation, DistanceFunction<? super O> distanceFunction, Object... hints) {
 final DistanceQuery<O> distanceQuery = relation.getDistanceQuery(distanceFunction, hints);
 return relation.getRangeQuery(distanceQuery, hints);
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki

/**
 * 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 relation Relation used
 * @param distanceFunction Distance function
 * @param hints Optimizer hints
 *
 * @param <O> Object type
 * @return KNN Query object
 */
public static <O> RangeQuery<O> getRangeQuery(Relation<O> relation, DistanceFunction<? super O> distanceFunction, Object... hints) {
 final DistanceQuery<O> distanceQuery = relation.getDistanceQuery(distanceFunction, hints);
 return relation.getRangeQuery(distanceQuery, hints);
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-database

/**
 * 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 relation Relation used
 * @param distanceFunction Distance function
 * @param hints Optimizer hints
 *
 * @param <O> Object type
 * @return KNN Query object
 */
public static <O> RangeQuery<O> getRangeQuery(Relation<O> relation, DistanceFunction<? super O> distanceFunction, Object... hints) {
 final DistanceQuery<O> distanceQuery = relation.getDistanceQuery(distanceFunction, hints);
 return relation.getRangeQuery(distanceQuery, hints);
}

代码示例来源:origin: elki-project/elki

/**
 * 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;
}

代码示例来源:origin: elki-project/elki

/**
 * 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);
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki

/**
 * 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);
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-database

/**
 * 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);
}

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki

/**
 * 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) {
 Class<RangeQuery<V>> rqcls = ClassGenericsUtil.uglyCastIntoSubclass(RangeQuery.class);
 RangeQuery<V>[] rangeQueries = ClassGenericsUtil.newArrayOfNull(dimensionality, rqcls);
 for(int d = 0; d < dimensionality; d++) {
  rangeQueries[d] = relation.getRangeQuery(new PrimitiveDistanceQuery<>(relation, new OnedimensionalDistanceFunction(d)));
 }
 return rangeQueries;
}

代码示例来源:origin: elki-project/elki

/**
  * Test degenerate case: single point.
  * 
  * @param factory
  */
 protected void testSinglePoint(IndexFactory<?> factory, Class<?> expectKNNQuery, Class<?> expectRangeQuery) {
  ArrayAdapterDatabaseConnection dbc = new ArrayAdapterDatabaseConnection(new double[][] { { 1, 0 } });
  Database db = new StaticArrayDatabase(dbc, factory != null ? Arrays.asList(factory) : null);
  db.initialize();
  Relation<DoubleVector> rep = db.getRelation(TypeUtil.DOUBLE_VECTOR_FIELD);
  DistanceQuery<DoubleVector> dist = db.getDistanceQuery(rep, EuclideanDistanceFunction.STATIC);
  DBIDRef first = rep.iterDBIDs();
  if(expectKNNQuery != null) {
   KNNQuery<DoubleVector> knnq = rep.getKNNQuery(dist);
   assertTrue("Returned knn query is not of expected class: expected " + expectKNNQuery + " got " + knnq.getClass(), expectKNNQuery.isAssignableFrom(knnq.getClass()));
   KNNList knn = knnq.getKNNForDBID(first, 1);
   assertEquals("Wrong number of knn results", 1, knn.size());
   assertTrue("Wrong knn result", DBIDUtil.equal(knn.iter(), first));
  }
  if(expectRangeQuery != null) {
   RangeQuery<DoubleVector> rangeq = rep.getRangeQuery(dist);
   assertTrue("Returned range query is not of expected class: expected " + expectRangeQuery + " got " + rangeq.getClass(), expectRangeQuery.isAssignableFrom(rangeq.getClass()));
   DoubleDBIDList range = rangeq.getRangeForDBID(first, 0);
   assertEquals("Wrong number of range results", 1, range.size());
   assertTrue("Wrong range result", DBIDUtil.equal(range.iter(), first));
  }
 }
}

代码示例来源:origin: elki-project/elki

RangeQuery<O> rq = relation.getRangeQuery(getDistanceFunction(), threshold);

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-clustering

RangeQuery<O> rq = relation.getRangeQuery(getDistanceFunction(), threshold);

相关文章