在 ELKI 中为关系添加索引

Add index to relation in ELKI

我正在尝试为数据库中的关系添加索引,但不知道是否正确?

ListParameterization spatparams = new ListParameterization();
spatparams.addParameter(INDEX_ID, RStarTreeFactory.class);
spatparams.addParameter(AbstractPageFileFactory.Parameterizer.PAGE_SIZE_ID, 300);
spatparams.addParameter(AbstractRStarTreeFactory.Parameterizer.INSERTION_STRATEGY_ID, ApproximativeLeastOverlapInsertionStrategy.class);
spatparams.addParameter(ApproximativeLeastOverlapInsertionStrategy.Parameterizer.INSERTION_CANDIDATES_ID, 1);

// 从现有数组加载数据的适配器。

DatabaseConnection dbc = new ArrayAdapterDatabaseConnection(data);

// 创建数据库(可能包含多个关系!)

Collection<IndexFactory<?, ?>> indexFactories = new ArrayList<>();
ObjectListParameter<IndexFactory<?, ?>> indexFactoryP = new ObjectListParameter<>(INDEX_ID, IndexFactory.class, true);
indexFactories.addAll(indexFactoryP.instantiateClasses(spatparams));

Database db = new StaticArrayDatabase(dbc, indexFactories);
db.initialize();

要通过参数化 API 实例化 class,您不需要创建新的 参数

RStarTreeFactory<DoubleVector> f = 
  ClassGenericsUtil.parameterizeOrAbort(RStarTreeFactory.class, params);

对于R-star树,我建议使用SortTileRecursive批量加载。