Class LearnPatternSimilarityClassifier


  • public class LearnPatternSimilarityClassifier
    extends ASimplifiedTSClassifier<java.lang.Integer>
    Class representing the Learn Pattern Similarity classifier as described in Baydogan, Mustafa & Runger, George. (2015). Time series representation and similarity based on local autopatterns. Data Mining and Knowledge Discovery. 30. 1-34. 10.1007/s10618-015-0425-y. This classifier currently only supports univariate time series prediction.
    • Constructor Detail

      • LearnPatternSimilarityClassifier

        public LearnPatternSimilarityClassifier​(int seed,
                                                int numTrees,
                                                int maxTreeDepth,
                                                int numSegments)
        Standard constructor.
        Parameters:
        seed - Seed used for randomized operations
        numTrees - Number of trees being trained
        maxTreeDepth - Maximum depth of the trained trees
        numSegments - Number of segments used per tree for feature generation
    • Method Detail

      • predict

        public java.lang.Integer predict​(double[] univInstance)
                                  throws PredictionException
        Predicts the class by generated segment and segment difference features based on segments and segmentsDifference. The induced instances are propagated to the forest of RandomRegressionTrees trees. The predicted leaf nodes are used within a 1NN search on the training leaf nodes to find the nearest instance and taking its class as prediction value.
        Specified by:
        predict in class ASimplifiedTSClassifier<java.lang.Integer>
        Parameters:
        univInstance - Univariate instance to be predicted
        Returns:
        Returns the result of the prediction
        Throws:
        PredictionException - If something fails during the prediction process.
      • findNearestInstanceIndex

        public int findNearestInstanceIndex​(int[][] leafNodeCounts)
        Performs a simple nearest neighbor search on the stored trainLeafNodes for the given leafNodeCounts using Manhattan distance.
        Parameters:
        leafNodeCounts - Leaf node counts induced during the prediction phase
        Returns:
        Returns the index of the nearest neighbor instance
      • predict

        public java.lang.Integer predict​(java.util.List<double[]> multivInstance)
                                  throws PredictionException
        Performs a prediction based on the given multivariate list of double[] instance representation and returns the result.
        Overrides:
        predict in class ASimplifiedTSClassifier<java.lang.Integer>
        Parameters:
        multivInstance - Multivariate instance given by a list of multiple double[] time series used for the prediction
        Returns:
        Returns the result of the prediction
        Throws:
        PredictionException - If something fails during the prediction process.
      • getSegments

        public int[][] getSegments()
        Returns:
        the segments
      • setSegments

        public void setSegments​(int[][] segments)
        Parameters:
        segments - the segments to set
      • getSegmentsDifference

        public int[][] getSegmentsDifference()
        Returns:
        the segmentsDifference
      • setSegmentsDifference

        public void setSegmentsDifference​(int[][] segmentsDifference)
        Parameters:
        segmentsDifference - the segmentsDifference to set
      • getLengthPerTree

        public int[] getLengthPerTree()
        Returns:
        the lengthPerTree
      • setLengthPerTree

        public void setLengthPerTree​(int[] lengthPerTree)
        Parameters:
        lengthPerTree - the lengthPerTree to set
      • getClassAttIndexPerTree

        public int[] getClassAttIndexPerTree()
        Returns:
        the classAttIndexPerTree
      • setClassAttIndexPerTree

        public void setClassAttIndexPerTree​(int[] classAttIndexPerTree)
        Parameters:
        classAttIndexPerTree - the classAttIndexPerTree to set
      • setTrees

        public void setTrees​(AccessibleRandomTree[] trees)
        Parameters:
        trees - the trees to set
      • getTrainLeafNodes

        public int[][][] getTrainLeafNodes()
        Returns:
        the trainLeafNodes
      • setTrainLeafNodes

        public void setTrainLeafNodes​(int[][][] trainLeafNodes)
        Parameters:
        trainLeafNodes - the trainLeafNodes to set
      • getTrainTargets

        public int[] getTrainTargets()
        Returns:
        the trainTargets
      • setTrainTargets

        public void setTrainTargets​(int[] trainTargets)
        Parameters:
        trainTargets - the trainTargets to set
      • getAttributes

        public java.util.List<weka.core.Attribute> getAttributes()
        Returns:
        the attributes
      • setAttributes

        public void setAttributes​(java.util.List<weka.core.Attribute> attributes)
        Parameters:
        attributes - the attributes to set