Class ShapeletTransformTSClassifier


  • public class ShapeletTransformTSClassifier
    extends ai.libs.jaicore.ml.classification.singlelabel.timeseries.learner.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.
    • Field Summary

      • Fields inherited from class ai.libs.jaicore.ml.classification.singlelabel.timeseries.learner.ASimplifiedTSClassifier

        classMapper, trained
    • Constructor Summary

      Constructors 
      Constructor Description
      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.
      ShapeletTransformTSClassifier​(int k, int numClusters, ai.libs.jaicore.ml.classification.singlelabel.timeseries.quality.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.
      ShapeletTransformTSClassifier​(int k, int numClusters, ai.libs.jaicore.ml.classification.singlelabel.timeseries.quality.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.
      ShapeletTransformTSClassifier​(int k, ai.libs.jaicore.ml.classification.singlelabel.timeseries.quality.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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ShapeletTransformLearningAlgorithm getLearningAlgorithm​(ai.libs.jaicore.ml.classification.singlelabel.timeseries.dataset.TimeSeriesDataset2 dataset)  
      ai.libs.jaicore.ml.classification.singlelabel.timeseries.shapelets.search.AMinimumDistanceSearchStrategy getMinDistanceSearchStrategy()
      java.util.List<ai.libs.jaicore.ml.classification.singlelabel.timeseries.shapelets.Shapelet> getShapelets()
      Getter for shapelets.
      java.lang.Integer predict​(double[] univInstance)
      java.util.List<java.lang.Integer> predict​(ai.libs.jaicore.ml.classification.singlelabel.timeseries.dataset.TimeSeriesDataset2 dataset)
      java.lang.Integer predict​(java.util.List<double[]> multivInstance)
      void setClassifier​(weka.classifiers.Classifier classifier)
      Setter for classifier.
      void setShapelets​(java.util.List<ai.libs.jaicore.ml.classification.singlelabel.timeseries.shapelets.Shapelet> shapelets)
      Setter for shapelets.
      • Methods inherited from class ai.libs.jaicore.ml.classification.singlelabel.timeseries.learner.ASimplifiedTSClassifier

        checkWhetherPredictionIsPossible, getClassMapper, isTrained, setClassMapper, train
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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,
                                             ai.libs.jaicore.ml.classification.singlelabel.timeseries.quality.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,
                                             ai.libs.jaicore.ml.classification.singlelabel.timeseries.quality.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,
                                             ai.libs.jaicore.ml.classification.singlelabel.timeseries.quality.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<ai.libs.jaicore.ml.classification.singlelabel.timeseries.shapelets.Shapelet> getShapelets()
        Getter for shapelets.
        Returns:
        The actual list of shapelets used for the transformation
      • setShapelets

        public void setShapelets​(java.util.List<ai.libs.jaicore.ml.classification.singlelabel.timeseries.shapelets.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 org.api4.java.ai.ml.core.exception.PredictionException
        Specified by:
        predict in class ai.libs.jaicore.ml.classification.singlelabel.timeseries.learner.ASimplifiedTSClassifier<java.lang.Integer>
        Throws:
        org.api4.java.ai.ml.core.exception.PredictionException
      • predict

        public java.lang.Integer predict​(java.util.List<double[]> multivInstance)
                                  throws org.api4.java.ai.ml.core.exception.PredictionException
        Overrides:
        predict in class ai.libs.jaicore.ml.classification.singlelabel.timeseries.learner.ASimplifiedTSClassifier<java.lang.Integer>
        Throws:
        org.api4.java.ai.ml.core.exception.PredictionException
      • predict

        public java.util.List<java.lang.Integer> predict​(ai.libs.jaicore.ml.classification.singlelabel.timeseries.dataset.TimeSeriesDataset2 dataset)
                                                  throws org.api4.java.ai.ml.core.exception.PredictionException
        Specified by:
        predict in class ai.libs.jaicore.ml.classification.singlelabel.timeseries.learner.ASimplifiedTSClassifier<java.lang.Integer>
        Throws:
        org.api4.java.ai.ml.core.exception.PredictionException
      • getMinDistanceSearchStrategy

        public ai.libs.jaicore.ml.classification.singlelabel.timeseries.shapelets.search.AMinimumDistanceSearchStrategy getMinDistanceSearchStrategy()
        Returns:
        the minDistanceSearchStrategy
      • getLearningAlgorithm

        public ShapeletTransformLearningAlgorithm getLearningAlgorithm​(ai.libs.jaicore.ml.classification.singlelabel.timeseries.dataset.TimeSeriesDataset2 dataset)
        Specified by:
        getLearningAlgorithm in class ai.libs.jaicore.ml.classification.singlelabel.timeseries.learner.ASimplifiedTSClassifier<java.lang.Integer>