public class LearnPatternSimilarityLearningAlgorithm extends ASimplifiedTSCLearningAlgorithm<java.lang.Integer,LearnPatternSimilarityClassifier>
LearnPatternSimilarityClassifier 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.| Modifier and Type | Class and Description |
|---|---|
static interface |
LearnPatternSimilarityLearningAlgorithm.IPatternSimilarityConfig |
| Constructor and Description |
|---|
LearnPatternSimilarityLearningAlgorithm(LearnPatternSimilarityLearningAlgorithm.IPatternSimilarityConfig config,
LearnPatternSimilarityClassifier model,
TimeSeriesDataset dataset)
Standard constructor.
|
| Modifier and Type | Method and Description |
|---|---|
LearnPatternSimilarityClassifier |
call()
Training procedure for a
LearnPatternSimilarityClassifier. |
static void |
collectLeafCounts(int[] leafNodeCountsForInstance,
weka.core.Instance instance,
AccessibleRandomTree regTree)
Function collecting the leaf counts for the given
instance as
predicted by regTree. |
void |
generateSegmentsAndDifferencesForTree(int[] segments,
int[] segmentsDifference,
int length,
int timeSeriesLength,
java.util.Random random)
Method generating the segment start indices and the segment difference
locations randomly using
random. |
static weka.core.Instance |
generateSubseriesFeatureInstance(double[] instValues,
int[] segments,
int[] segmentsDifference,
int len)
Function generating subseries feature instances based on the given
segments and segmentsDifference matrices. |
static weka.core.Instances |
generateSubseriesFeaturesInstances(java.util.List<weka.core.Attribute> attributes,
int length,
int[] segments,
int[] segmentsDifference,
double[][] dataMatrix)
Function generating a dataset storing the features being generated as
described in the original paper.
|
LearnPatternSimilarityLearningAlgorithm.IPatternSimilarityConfig |
getConfig() |
AccessibleRandomTree |
initializeRegressionTree(int numInstances)
Initializes a new instance of
RandomRegressionTree. |
ai.libs.jaicore.basic.algorithm.events.AlgorithmEvent |
nextWithException() |
getClassifieractivate, announceTimeoutDetected, avoidReinterruptionOnShutdownOnCurrentThread, cancel, checkAndConductTermination, checkTermination, computeTimeoutAware, getActivationTime, getId, getInput, getLoggerName, getNumCPUs, getRemainingTimeToDeadline, getState, getTimeout, getTimeoutPrecautionOffset, hasNext, hasThreadBeenInterruptedDuringShutdown, interruptThreadAsPartOfShutdown, isCanceled, isShutdownInitialized, isStopCriterionSatisfied, isTimeouted, iterator, next, post, registerActiveThread, registerListener, resolveShutdownInterruptOnCurrentThread, setConfig, setLoggerName, setMaxNumThreads, setNumCPUs, setState, setTimeout, setTimeout, setTimeoutPrecautionOffset, shutdown, terminate, unregisterActiveThread, unregisterThreadAndShutdownpublic LearnPatternSimilarityLearningAlgorithm(LearnPatternSimilarityLearningAlgorithm.IPatternSimilarityConfig config, LearnPatternSimilarityClassifier model, TimeSeriesDataset dataset)
seed - See LearnPatternSimilarityLearningAlgorithm#seed.numTrees - See LearnPatternSimilarityLearningAlgorithm#numTrees.maxTreeDepth - See LearnPatternSimilarityLearningAlgorithm#maxTreeDepth.numSegments - See LearnPatternSimilarityLearningAlgorithm#numSegments.public LearnPatternSimilarityClassifier call() throws ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmException, ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedException
LearnPatternSimilarityClassifier. At first,
it generates randomly subsequences (segments) and subsequence difference
locations used for feature generation. The generated features are used to
train a forest of RandomRegressionTree models. The predicted leaf
nodes are stored in the model for a 1NN search for an equally generated
prediction leaf node matrix.ai.libs.jaicore.basic.algorithm.exceptions.AlgorithmExceptionai.libs.jaicore.basic.algorithm.exceptions.AlgorithmTimeoutedExceptionpublic void generateSegmentsAndDifferencesForTree(int[] segments,
int[] segmentsDifference,
int length,
int timeSeriesLength,
java.util.Random random)
random. This method used the
length to specify the interval being generated.
LearnPatternSimilarityLearningAlgorithm#numSegments * 2 many indices are
generated. The start indices can only be between
[0, timeSeriesLength - length] and the segment differences can
only between [0, timeSeriesLength - length -1] (-1 due to the
fact that the next index is used for the difference calculation).segments - Segment start indices used for feature generationsegmentsDifference - Segment difference start indices used for feature generationlength - The length of the segmentstimeSeriesLength - The total length of the complete time seriesrandom - Generator for the random numberspublic AccessibleRandomTree initializeRegressionTree(int numInstances)
RandomRegressionTree.numInstances - The number of instance used for latter training (used for setting
the minimum number of instances per leaf)public static void collectLeafCounts(int[] leafNodeCountsForInstance,
weka.core.Instance instance,
AccessibleRandomTree regTree)
throws PredictionException
instance as
predicted by regTree. The result is stored at the induced leaf
node index in leafNodeCountsForInstance.leafNodeCountsForInstance - The vector storing the frequencies for each leaf node of the tree
being the last node within the predictioninstance - The given Weka instance which is fed to the regTreeregTree - The regression tree used for predictionPredictionException - Thrown if the random regression tree could not predict anything
for the given instancepublic static weka.core.Instances generateSubseriesFeaturesInstances(java.util.List<weka.core.Attribute> attributes,
int length,
int[] segments,
int[] segmentsDifference,
double[][] dataMatrix)
segments and
segmentsDifference indices are used to extract subsequences of
the given dataMatrix and generating value differences,
respectively.attributes - The attributes used by Weka to create the datasetlength - The length considered for the feature generationsegments - Segment start indices used for feature generationsegmentsDifference - Segment difference start indices used for feature generationdataMatrix - Matrix storing the instance values used for feature generationpublic static weka.core.Instance generateSubseriesFeatureInstance(double[] instValues,
int[] segments,
int[] segmentsDifference,
int len)
segments and segmentsDifference matrices. The
len parameter indicates which subsequence instance is generated
within this call. The values are extracted and used for calculation (for
difference) from instValues.instValues - Instance values used for feature generationsegments - Segment start indices used for feature generationsegmentsDifference - Segment difference start indices used for feature generationlen - Current length (is added to the segment and segment difference
locations)public ai.libs.jaicore.basic.algorithm.events.AlgorithmEvent nextWithException()
public LearnPatternSimilarityLearningAlgorithm.IPatternSimilarityConfig getConfig()
getConfig in interface ai.libs.jaicore.basic.algorithm.IAlgorithm<TimeSeriesDataset,LearnPatternSimilarityClassifier>getConfig in class ai.libs.jaicore.basic.algorithm.AAlgorithm<TimeSeriesDataset,LearnPatternSimilarityClassifier>