Class ShapeletTransformTSClassifier
- java.lang.Object
-
- ai.libs.jaicore.ml.tsc.classifier.ASimplifiedTSClassifier<java.lang.Integer>
-
- ai.libs.jaicore.ml.tsc.classifier.shapelets.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.
-
-
Field Summary
-
Fields inherited from class ai.libs.jaicore.ml.tsc.classifier.ASimplifiedTSClassifier
classMapper, trained
-
-
Constructor Summary
Constructors Constructor Description ShapeletTransformTSClassifier(int k, int seed)Constructs an Shapelet Transform classifier usingkshapelets, k/2 clusters of the shapelets after shapelet extraction and theFStatquality measure.ShapeletTransformTSClassifier(int k, int numClusters, IQualityMeasure qm, int seed, boolean clusterShapelets)Constructs an Shapelet Transform classifier usingkshapelets, k/2 clusters of the shapelets after shapelet extraction (ifclusterShapeletsis true and the quality measure functionqm.ShapeletTransformTSClassifier(int k, int numClusters, IQualityMeasure qm, int seed, boolean clusterShapelets, int minShapeletLength, int maxShapeletLength, boolean useHIVECOTEEnsemble, int numFolds)Constructs an Shapelet Transform classifier usingkshapelets, k/2 clusters of the shapelets after shapelet extraction (ifclusterShapeletsis true and the quality measure functionqm.ShapeletTransformTSClassifier(int k, IQualityMeasure qm, int seed, boolean clusterShapelets)Constructs an Shapelet Transform classifier usingkshapelets, k/2 clusters of the shapelets after shapelet extraction (ifclusterShapeletsis true and the quality measure functionqm.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ShapeletTransformLearningAlgorithmgetLearningAlgorithm(TimeSeriesDataset dataset)AMinimumDistanceSearchStrategygetMinDistanceSearchStrategy()Getter forminDistanceSearchStrategy.java.util.List<Shapelet>getShapelets()Getter forshapelets.java.lang.Integerpredict(double[] univInstance)Performs a prediction based on the given univariate double[] instance representation and returns the result.java.util.List<java.lang.Integer>predict(TimeSeriesDataset dataset)Performs predictions based on the given instances in the given dataset.java.lang.Integerpredict(java.util.List<double[]> multivInstance)Performs a prediction based on the given multivariate list of double[] instance representation and returns the result.voidsetClassifier(weka.classifiers.Classifier classifier)Setter forclassifier.voidsetShapelets(java.util.List<Shapelet> shapelets)Setter forshapelets.-
Methods inherited from class ai.libs.jaicore.ml.tsc.classifier.ASimplifiedTSClassifier
checkWhetherPredictionIsPossible, getClassMapper, isTrained, setClassMapper, train
-
-
-
-
Constructor Detail
-
ShapeletTransformTSClassifier
public ShapeletTransformTSClassifier(int k, int seed)Constructs an Shapelet Transform classifier usingkshapelets, k/2 clusters of the shapelets after shapelet extraction and theFStatquality measure.- Parameters:
k- Number of shapelets searched for and used as shapelet clustering inputseed- Seed for randomized operations
-
ShapeletTransformTSClassifier
public ShapeletTransformTSClassifier(int k, IQualityMeasure qm, int seed, boolean clusterShapelets)Constructs an Shapelet Transform classifier usingkshapelets, k/2 clusters of the shapelets after shapelet extraction (ifclusterShapeletsis true and the quality measure functionqm.- Parameters:
k- Number of shapelets searched for and used as shapelet clustering input if enabledqm- Quality measure function to be used to assess shapeletsseed- See for randomized operationsclusterShapelets- 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 usingkshapelets, k/2 clusters of the shapelets after shapelet extraction (ifclusterShapeletsis true and the quality measure functionqm.- Parameters:
k- Number of shapelets searched for and used as shapelet clustering input if enablednumClusters- Number of clusters into which the shapelets are clusteredqm- Quality measure function to be used to assess shapeletsseed- See for randomized operationsclusterShapelets- 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 usingkshapelets, k/2 clusters of the shapelets after shapelet extraction (ifclusterShapeletsis true and the quality measure functionqm.minShapeletLengthandmaxShapeletLengthspecify the shapelet length borders, whileuseHIVECOTEEnsembledefines 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 enabledqm- Quality measure function to be used to assess shapeletsseed- See for randomized operationsclusterShapelets- Indicator whether shapelet clustering should be used after extracting the best k shapeletsminShapeletLength- The minimal length of the shapeletsmaxShapeletLength- The maximal length of the shapeletsuseHIVECOTEEnsemble- Indicator whether the HIVE COTE ensemble should be used (CAWPE otherwise)timeout- The timeout used for the trainingnumFolds- SeeShapeletTransformLearningAlgorithm#numFolds
-
-
Method Detail
-
getShapelets
public java.util.List<Shapelet> getShapelets()
Getter forshapelets.- Returns:
- The actual list of shapelets used for the transformation
-
setShapelets
public void setShapelets(java.util.List<Shapelet> shapelets)
Setter forshapelets.- Parameters:
shapelets- The new list of shapelets to be set
-
setClassifier
public void setClassifier(weka.classifiers.Classifier classifier)
Setter forclassifier.- Parameters:
classifier- The classifier to be set
-
predict
public java.lang.Integer predict(double[] univInstance) throws PredictionExceptionPerforms a prediction based on the given univariate double[] instance representation and returns the result.- Specified by:
predictin classASimplifiedTSClassifier<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 PredictionExceptionPerforms a prediction based on the given multivariate list of double[] instance representation and returns the result.- Overrides:
predictin classASimplifiedTSClassifier<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.
-
predict
public java.util.List<java.lang.Integer> predict(TimeSeriesDataset dataset) throws PredictionException
Performs predictions based on the given instances in the given dataset.- Specified by:
predictin classASimplifiedTSClassifier<java.lang.Integer>- Parameters:
dataset- TheTimeSeriesDatasetfor which predictions should be made.- Returns:
- Returns the result of the predictions
- Throws:
PredictionException- If something fails during the prediction process
-
getMinDistanceSearchStrategy
public AMinimumDistanceSearchStrategy getMinDistanceSearchStrategy()
Getter forminDistanceSearchStrategy.- Returns:
- the minDistanceSearchStrategy
-
getLearningAlgorithm
public ShapeletTransformLearningAlgorithm getLearningAlgorithm(TimeSeriesDataset dataset)
- Specified by:
getLearningAlgorithmin classASimplifiedTSClassifier<java.lang.Integer>
-
-