All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hex.tree.isoforextended.isolationtree.CompressedLeaf Maven / Gradle / Ivy

There is a newer version: 3.46.0.6
Show newest version
package hex.tree.isoforextended.isolationtree;

import water.AutoBuffer;

import static hex.genmodel.algos.isoforextended.ExtendedIsolationForestMojoModel.LEAF;

/**
 * IsolationTree Leaf Node with better memory performance. Store only the data that are needed for scoring.
 */
public class CompressedLeaf extends AbstractCompressedNode {
    private final int _numRows;

    public CompressedLeaf(IsolationTree.Node node) {
        this(node.getHeight(), node.getNumRows());
    }

    public CompressedLeaf(int currentHeight, int numRows) {
        super(currentHeight);
        _numRows = numRows;
    }

    public int getNumRows() {
        return _numRows;
    }

    /**
     * The structure of the bytes is:
     *
     * |identifierOfTheNodeType|numRows|
     */
    @Override
    public void toBytes(AutoBuffer ab) {
        ab.put1(LEAF); // identifier of this node type
        ab.put4(_numRows);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy