extractors.SDF¶
Module: extractors.SDF
¶
This program implements the symbolic dynamic filtering (SDF) algorithm as a time series feature extraction method, presented in the following paper:
Bahrampour, Soheil, Asok Ray, Soumalya Sarkar, Thyagaraju Damarla, and Nasser M. Nasrabadi. “Performance comparison of feature extraction algorithms for target detection and classification.” Pattern Recognition Letters 34, no. 16 (2013): 2126-2134.
Written by Soheil Bahrampour, August 2012 Rewritten in Python by Arno Klein, October 2015
Functions¶
-
mhealthx.extractors.SDF.
AnalyzeSymbolSeq
(symbolSeq, numStates, morphMatrixFlag)¶ Estimate the Morph matrix and its eigenvector corresponding to eigenvalue 1 by counting.
symbolSeq : numpy array numStates : integer morphMatrixFlag : Boolean
morphMatrix : numpy array PVec : numpy array
>>> import numpy as np >>> from mhealthx.SDF import AnalyzeSymbolSeq >>> symbolSeq = np.array([[1,2,3],[4,5,6]]) >>> numStates = 10 >>> morphMatrixFlag = False >>> morphMatrix, PVec = AnalyzeSymbolSeq(symbolSeq, numStates, morphMatrixFlag)
-
mhealthx.extractors.SDF.
FeatureExtractionSDF
(data, partition, numSymbol, PiMatrixFlag)¶ data : numpy array partition : numpy array numSymbol : integer PiMatrixFlag : Boolean
feature : numpy array
>>> import numpy as np >>> from mhealthx.SDF import FeatureExtractionSDF >>> data = np.random.random((3,4)) >>> data = data.flatten() >>> numSymbol = 10 >>> partition = maxEntropyPartition(data, numSymbol) >>> PiMatrixFlag = False >>> feature = FeatureExtractionSDF(data, partition, numSymbol, PiMatrixFlag)
-
mhealthx.extractors.SDF.
SDF
(trainData, testData)¶ Main function for SDF Feature Extraction.
Each column of trainData and testData contains a time series.
trainData : numpy array testData : numpy array
featuresTrain : numpy array featuresTest : numpy array
>>> import numpy as np >>> from mhealthx.SDF import SDF >>> data = np.random.random((3,4)) >>> data = data.flatten() >>> numSymbol = 10 >>> partition = maxEntropyPartition(data, numSymbol) >>> PiMatrixFlag = False >>> featuresTrain, featuresTest = SDF(trainData, testData)
-
mhealthx.extractors.SDF.
SymbolGen
(rawData, partition)¶ Generate symbol sequence (symData) of a given time series (rawData) using given partition:
rawData : numpy array partition : numpy array
symData : numpy array
>>> import numpy as np >>> from mhealthx.SDF import SymbolGen, maxEntropyPartition >>> rawData = np.random.random((3,4)) >>> rawData = rawData.flatten() >>> numSymbol = 10 >>> partition = maxEntropyPartition(rawData, numSymbol) >>> symData = SymbolGen(rawData, partition)
-
mhealthx.extractors.SDF.
maxEntropyPartition
(partitionData, numSymbol)¶ Perform maximum entropy partitioning on given data.
partitionData : numpy array numSymbol : integer
partition : numpy array
>>> import numpy as np >>> from mhealthx.SDF import maxEntropyPartition >>> partitionData = np.random.random((3,4)) >>> numSymbol = 10 >>> partition = maxEntropyPartition(partitionData, numSymbol)