Class ShapeletTransformTSClassifier


  • public class ShapeletTransformTSClassifier
    extends ASimplifiedTSClassifier<java.lang.Integer>
    Class for a ShapeletTransform classifier as described in Jason Lines, Luke M. Davis, Jon Hills, and Anthony Bagnall. 2012. A shapelet transform for time series classification. In Proceedings of the 18th ACM SIGKDD international conference on Knowledge discovery and data mining (KDD '12). ACM, New York, NY, USA, 289-297. The classifier model is built of shapelets which are used for the transformation of instances to the new feature space built by the shapelets as dimensions. The feature values are the minimum distances of a time series to the feature dimension's shapelet. An ensemble classifier trained on the derived representation is then used for prediction. This classifier only supports univariate time series prediction.
    • Constructor Detail

      • ShapeletTransformTSClassifier

        public ShapeletTransformTSClassifier​(int k,
                                             int seed)
        Constructs an Shapelet Transform classifier using k shapelets, k/2 clusters of the shapelets after shapelet extraction and the FStat quality measure.
        Parameters:
        k - Number of shapelets searched for and used as shapelet clustering input
        seed - Seed for randomized operations
      • ShapeletTransformTSClassifier

        public ShapeletTransformTSClassifier​(int k,
                                             IQualityMeasure qm,
                                             int seed,
                                             boolean clusterShapelets)
        Constructs an Shapelet Transform classifier using k shapelets, k/2 clusters of the shapelets after shapelet extraction (if clusterShapelets is true and the quality measure function qm.
        Parameters:
        k - Number of shapelets searched for and used as shapelet clustering input if enabled
        qm - Quality measure function to be used to assess shapelets
        seed - See for randomized operations
        clusterShapelets - Indicator whether shapelet clustering should be used after extracting the best k shapelets
      • ShapeletTransformTSClassifier

        public ShapeletTransformTSClassifier​(int k,
                                             int numClusters,
                                             IQualityMeasure qm,
                                             int seed,
                                             boolean clusterShapelets)
        Constructs an Shapelet Transform classifier using k shapelets, k/2 clusters of the shapelets after shapelet extraction (if clusterShapelets is true and the quality measure function qm.
        Parameters:
        k - Number of shapelets searched for and used as shapelet clustering input if enabled
        numClusters - Number of clusters into which the shapelets are clustered
        qm - Quality measure function to be used to assess shapelets
        seed - See for randomized operations
        clusterShapelets - Indicator whether shapelet clustering should be used after extracting the best k shapelets
      • ShapeletTransformTSClassifier

        public ShapeletTransformTSClassifier​(int k,
                                             int numClusters,
                                             IQualityMeasure qm,
                                             int seed,
                                             boolean clusterShapelets,
                                             int minShapeletLength,
                                             int maxShapeletLength,
                                             boolean useHIVECOTEEnsemble,
                                             int numFolds)
        Constructs an Shapelet Transform classifier using k shapelets, k/2 clusters of the shapelets after shapelet extraction (if clusterShapelets is true and the quality measure function qm. minShapeletLength and maxShapeletLength specify the shapelet length borders, while useHIVECOTEEnsemble defines whether the HIVE COTE ensemble or the CAWPE ensemble should be used.
        Parameters:
        k - Number of shapelets searched for and used as shapelet clustering input if enabled
        qm - Quality measure function to be used to assess shapelets
        seed - See for randomized operations
        clusterShapelets - Indicator whether shapelet clustering should be used after extracting the best k shapelets
        minShapeletLength - The minimal length of the shapelets
        maxShapeletLength - The maximal length of the shapelets
        useHIVECOTEEnsemble - Indicator whether the HIVE COTE ensemble should be used (CAWPE otherwise)
        timeout - The timeout used for the training
        numFolds - See ShapeletTransformLearningAlgorithm#numFolds
    • Method Detail

      • getShapelets

        public java.util.List<Shapelet> getShapelets()
        Getter for shapelets.
        Returns:
        The actual list of shapelets used for the transformation
      • setShapelets

        public void setShapelets​(java.util.List<Shapelet> shapelets)
        Setter for shapelets.
        Parameters:
        shapelets - The new list of shapelets to be set
      • setClassifier

        public void setClassifier​(weka.classifiers.Classifier classifier)
        Setter for classifier.
        Parameters:
        classifier - The classifier to be set
      • predict

        public java.lang.Integer predict​(double[] univInstance)
                                  throws PredictionException
        Performs a prediction based on the given univariate double[] instance representation and returns the result.
        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.