Class HSTreeNode

  • All Implemented Interfaces:
    Serializable

    public class HSTreeNode
    extends Object
    implements Serializable
    A node in an HSTree. Based on the work S. C. Tan, K. M. Ting, and T. F. Liu, “Fast anomaly detection for streaming data,” in IJCAI Proceedings-International Joint Conference on Artificial Intelligence, 2011, vol. 22, no. 1, pp. 1511–1516. Made use of by HSTrees.java.
    Author:
    Richard Hugh Moulton
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      HSTreeNode​(double[] min, double[] max, int k, int maxDepth)
      Constructor for an HSTreeNode.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void printNode()
      Prints this node to string and, if it is an internal node, prints its children nodes as well.
      double score​(Instance inst, int sizeLimit)
      If this node is a leaf node or it has a mass profile of less than sizeLimit, this returns the anomaly score for the argument instance.
      void updateMass​(Instance inst, boolean referenceWindow)
      Update the mass profile of this node.
      void updateModel()
      Update the node's model by setting the latest window's mass profile as the reference window's mass profile, resetting the latest window's mass profile to zero and updating any subordinates nodes' models.
    • Constructor Detail

      • HSTreeNode

        public HSTreeNode​(double[] min,
                          double[] max,
                          int k,
                          int maxDepth)
        Constructor for an HSTreeNode.
        Parameters:
        min - the minimum values of the attributes for this node's workspace
        max - the maximum values of the attributes for this node's workspace
        k - the depth of this node in the HSTree
        maxDepth - the maximum depth of this HSTree
    • Method Detail

      • updateMass

        public void updateMass​(Instance inst,
                               boolean referenceWindow)
        Update the mass profile of this node.
        Parameters:
        inst - the instance being passed through the HSTree.
        referenceWindow - if the HSTree is in the initial reference window: true, else: false
      • updateModel

        public void updateModel()
        Update the node's model by setting the latest window's mass profile as the reference window's mass profile, resetting the latest window's mass profile to zero and updating any subordinates nodes' models.
      • score

        public double score​(Instance inst,
                            int sizeLimit)
        If this node is a leaf node or it has a mass profile of less than sizeLimit, this returns the anomaly score for the argument instance. Otherwise this node determines which of its subordinate nodes the argument instance belongs to and asks it provide the anomaly score.
        Parameters:
        inst - the instance being passed through the tree
        sizeLimit - the minimum mass profile for a node to calculate the argument instance's anomaly score
        Returns:
        the argument instance's anomaly score (r * 2^depth)
      • printNode

        protected void printNode()
        Prints this node to string and, if it is an internal node, prints its children nodes as well. Useful for debugging the entire tree structure.