Class TimeSeriesBagOfFeaturesClassifier


  • public class TimeSeriesBagOfFeaturesClassifier
    extends ASimplifiedTSClassifier<java.lang.Integer>
    Implementation of the Time Series Bag-of-Features (TSBF) classifier as described in Baydogan, Mustafa & Runger, George & Tuv, Eugene. (2013). A Bag-of-Features Framework to Classify Time Series. IEEE Transactions on Pattern Analysis and Machine Intelligence. 35. 2796-802. 10.1109/TPAMI.2013.72. This classifier only supports univariate time series prediction.
    • Constructor Detail

      • TimeSeriesBagOfFeaturesClassifier

        public TimeSeriesBagOfFeaturesClassifier​(int seed)
        Standard constructor using the default parameters (numBins = 10, numFolds = 10, zProp = 0.1, minIntervalLength = 5) for the TSBF classifier.
        Parameters:
        seed - Seed used for randomized operations
      • TimeSeriesBagOfFeaturesClassifier

        public TimeSeriesBagOfFeaturesClassifier​(int seed,
                                                 int numBins,
                                                 int numFolds,
                                                 double zProp,
                                                 int minIntervalLength)
        Constructor specifying parameters (cf. TimeSeriesBagOfFeaturesClassifier(int)).
        Parameters:
        seed - Seed used for randomized operations
        numBins - See TimeSeriesBagOfFeaturesClassifier#numBins
        numFolds - Number of folds for the internal OOB probability CV estimation
        zProp - Proportion of the total time series length to be used for the subseries generation
        minIntervalLength - The minimal interval length used for the interval generation
      • TimeSeriesBagOfFeaturesClassifier

        public TimeSeriesBagOfFeaturesClassifier​(int seed,
                                                 int numBins,
                                                 int numFolds,
                                                 double zProp,
                                                 int minIntervalLength,
                                                 boolean useZNormalization)
        Constructor specifying parameters (cf. TimeSeriesBagOfFeaturesClassifier(int)).
        Parameters:
        seed - Seed used for randomized operations
        numBins - See TimeSeriesBagOfFeaturesClassifier#numBins
        numFolds - Number of folds for the internal OOB probability CV estimation
        zProp - Proportion of the total time series length to be used for the subseries generation
        minIntervalLength - The minimal interval length used for the interval generation
        useZNormalization - Indicator whether the Z normalization should be used
    • Method Detail

      • predict

        public java.lang.Integer predict​(double[] univInstance)
                                  throws PredictionException
        Method predicting the class of the given univInstance. At first, an internal feature representation using a bag of features is generated by the previously trained subsequences and intervals. These internal instances are used to get an internal class probability estimation for each subsequence and interval for each instance using a Random Forest classifier. These probabilities are aggregated to a histogram which is then fed to a final Random Forest classifier predicting the instance's target class.
        Specified by:
        predict in class ASimplifiedTSClassifier<java.lang.Integer>
        Parameters:
        univInstance - Univariate instance given by a double vector of time series values used for the prediction
        Returns:
        Returns the result of the prediction
        Throws:
        PredictionException - If something fails during the prediction process.
      • 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.
      • getSubseriesClf

        public weka.classifiers.trees.RandomForest getSubseriesClf()
        Returns:
        the subseriesClf
      • setSubseriesClf

        public void setSubseriesClf​(weka.classifiers.trees.RandomForest subseriesClf)
        Parameters:
        subseriesClf - the subseriesClf to set
      • getFinalClf

        public weka.classifiers.trees.RandomForest getFinalClf()
        Returns:
        the finalClf
      • setFinalClf

        public void setFinalClf​(weka.classifiers.trees.RandomForest finalClf)
        Parameters:
        finalClf - the finalClf to set
      • getNumBins

        public int getNumBins()
        Returns:
        the numBins
      • setNumBins

        public void setNumBins​(int numBins)
        Parameters:
        numBins - the numBins to set
      • getNumClasses

        public int getNumClasses()
        Returns:
        the numClasses
      • setNumClasses

        public void setNumClasses​(int numClasses)
        Parameters:
        numClasses - the numClasses to set
      • getIntervals

        public int[][][] getIntervals()
        Returns:
        the intervals
      • setIntervals

        public void setIntervals​(int[][][] intervals)
        Parameters:
        intervals - the intervals to set
      • getSubsequences

        public int[][] getSubsequences()
        Returns:
        the subsequences
      • setSubsequences

        public void setSubsequences​(int[][] subsequences)
        Parameters:
        subsequences - the subsequences to set