Class LearnPatternSimilarityClassifier
- java.lang.Object
-
- ai.libs.jaicore.ml.classification.singlelabel.timeseries.learner.ASimplifiedTSClassifier<java.lang.Integer>
-
- ai.libs.jaicore.ml.weka.classification.singlelabel.timeseries.learner.trees.LearnPatternSimilarityClassifier
-
public class LearnPatternSimilarityClassifier extends ai.libs.jaicore.ml.classification.singlelabel.timeseries.learner.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 Summary
Constructors Constructor Description LearnPatternSimilarityClassifier(int seed, int numTrees, int maxTreeDepth, int numSegments)Standard constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intfindNearestInstanceIndex(int[][] leafNodeCounts)Performs a simple nearest neighbor search on the storedtrainLeafNodesfor the givenleafNodeCountsusing Manhattan distance.java.util.List<weka.core.Attribute>getAttributes()int[]getClassAttIndexPerTree()LearnPatternSimilarityLearningAlgorithmgetLearningAlgorithm(ai.libs.jaicore.ml.classification.singlelabel.timeseries.dataset.TimeSeriesDataset2 dataset)int[]getLengthPerTree()int[][]getSegments()int[][]getSegmentsDifference()int[][][]getTrainLeafNodes()int[]getTrainTargets()AccessibleRandomTree[]getTrees()java.lang.Integerpredict(double[] univInstance)Predicts the class by generated segment and segment difference features based onsegmentsandsegmentsDifference.java.util.List<java.lang.Integer>predict(ai.libs.jaicore.ml.classification.singlelabel.timeseries.dataset.TimeSeriesDataset2 dataset)java.lang.Integerpredict(java.util.List<double[]> multivInstance)voidsetAttributes(java.util.List<weka.core.Attribute> attributes)voidsetClassAttIndexPerTree(int[] classAttIndexPerTree)voidsetLengthPerTree(int[] lengthPerTree)voidsetSegments(int[][] segments)voidsetSegmentsDifference(int[][] segmentsDifference)voidsetTrainLeafNodes(int[][][] trainLeafNodes)voidsetTrainTargets(int[] trainTargets)voidsetTrees(AccessibleRandomTree[] trees)
-
-
-
Constructor Detail
-
LearnPatternSimilarityClassifier
public LearnPatternSimilarityClassifier(int seed, int numTrees, int maxTreeDepth, int numSegments)Standard constructor.- Parameters:
seed- Seed used for randomized operationsnumTrees- Number of trees being trainedmaxTreeDepth- Maximum depth of the trained treesnumSegments- Number of segments used per tree for feature generation
-
-
Method Detail
-
predict
public java.lang.Integer predict(double[] univInstance) throws org.api4.java.ai.ml.core.exception.PredictionExceptionPredicts the class by generated segment and segment difference features based onsegmentsandsegmentsDifference. The induced instances are propagated to the forest ofRandomRegressionTreestrees. 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:
predictin classai.libs.jaicore.ml.classification.singlelabel.timeseries.learner.ASimplifiedTSClassifier<java.lang.Integer>- Parameters:
univInstance- Univariate instance to be predicted- Throws:
org.api4.java.ai.ml.core.exception.PredictionException
-
findNearestInstanceIndex
public int findNearestInstanceIndex(int[][] leafNodeCounts)
Performs a simple nearest neighbor search on the storedtrainLeafNodesfor the givenleafNodeCountsusing 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 org.api4.java.ai.ml.core.exception.PredictionException- Overrides:
predictin classai.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:
predictin classai.libs.jaicore.ml.classification.singlelabel.timeseries.learner.ASimplifiedTSClassifier<java.lang.Integer>- Throws:
org.api4.java.ai.ml.core.exception.PredictionException
-
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
-
getTrees
public AccessibleRandomTree[] getTrees()
- Returns:
- the trees
-
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
-
getLearningAlgorithm
public LearnPatternSimilarityLearningAlgorithm getLearningAlgorithm(ai.libs.jaicore.ml.classification.singlelabel.timeseries.dataset.TimeSeriesDataset2 dataset)
- Specified by:
getLearningAlgorithmin classai.libs.jaicore.ml.classification.singlelabel.timeseries.learner.ASimplifiedTSClassifier<java.lang.Integer>
-
-