Search in sources :

Example 1 with AbstractNodeStore

use of com.amazon.randomcutforest.tree.AbstractNodeStore in project random-cut-forest-by-aws by aws.

the class RandomCutTreeMapper method toModel.

@Override
public RandomCutTree toModel(CompactRandomCutTreeState state, CompactRandomCutTreeContext context, long seed) {
    AbstractNodeStoreMapper nodeStoreMapper = new AbstractNodeStoreMapper();
    nodeStoreMapper.setRoot(state.getRoot());
    AbstractNodeStore nodeStore = nodeStoreMapper.toModel(state.getNodeStoreState(), context);
    int dimension = (state.getDimensions() != 0) ? state.getDimensions() : context.getPointStore().getDimensions();
    // boundingBoxcache is not set deliberately;
    // it should be set after the partial tree is complete
    RandomCutTree tree = new RandomCutTree.Builder().dimension(dimension).storeSequenceIndexesEnabled(state.isStoreSequenceIndexesEnabled()).capacity(state.getMaxSize()).setRoot(state.getRoot()).randomSeed(state.getSeed()).pointStoreView(context.getPointStore()).nodeStore(nodeStore).centerOfMassEnabled(state.isCenterOfMassEnabled()).outputAfter(state.getOutputAfter()).build();
    return tree;
}
Also used : RandomCutTree(com.amazon.randomcutforest.tree.RandomCutTree) AbstractNodeStore(com.amazon.randomcutforest.tree.AbstractNodeStore)

Aggregations

AbstractNodeStore (com.amazon.randomcutforest.tree.AbstractNodeStore)1 RandomCutTree (com.amazon.randomcutforest.tree.RandomCutTree)1