DWT
- class hana_ml.algorithms.pal.tsa.wavelet.DWT(wavelet, boundary='zero', level=None, packet=False, order=None, compression=None, method=None, threshold=None, level_thresholds=None)
-
A designed class for discrete wavelet transform and wavelet packet transform.
- Parameters:
-
- waveletstr
-
Specifies the wavelet filter used for discrete wavelet transform. Valid options include:
-
Daubechies family : 'db1' ~ 'db20'
-
Biorthogonal family: 'bior1.1', 'bior1.3', 'bior1.5', 'bior2.2', 'bior2.4', 'bior2.6', 'bior2.8', 'bior3.1', 'bior3.3', 'bior3.5', 'bior3.7', 'bior3.9', 'bior4.4', 'bior5.5', 'bior6.8'
-
Reverse Biorthogonal family : 'rbio1.1', 'rbio1.3', 'rbio1.5', 'rbio2.2', 'rbio2.4', 'rbio2.6', 'rbio2.8', 'rbio3.1', 'rbio3.3', 'rbio3.5', 'rbio3.7', 'rbio3.9', 'rbio4.4', 'rbio5.5', 'rbio6.8'
-
Coifman family: 'coif1' ~ 'coif5'
-
Symmetric family: 'sym2' ~ 'sym20'
-
- boundarystr, otpional
-
Specifies the padding method for boundary values. Valid options include:
-
'zero' : Zero padding
-
'symmetric' : Symmetric padding
-
'periodic' : Periodic padding
-
'reflect' : Reflect padding
-
'smooth' : Smooth padding
-
'constant' : Constant padding
Defaults to 'zero'.
-
- levelint, optional
-
Specifies the decompose level for wavelet (packet) transform.
Defaults to 1.
- packetbool, optional
-
Specifies whether or not to perform wavelet packet transformation.
-
True : to perform wavelet packet transformation.
-
False : to perform discrete wavelet transform.
Defaults to False.
-
- order{'index', 'frequency'}, optional
-
Specifies the order of node in the wavelet packet coefficients table.
-
'index' : ordered by the indices of nodes(ascending).
-
'frequency' : ordered by the frequencies of nodes, from low to high.
Valid only when
packet
is True.Defaults to 'index'.
-
- compressionbool, optional
-
Specifies whether or not to discard zero values in wavelet coefficients.
Defaults to False.
- method{'no', 'soft', 'hard'}, optional
-
Specifies the thresholding method applied to wavelet coefficients.
-
'no' : No thresholding
-
'soft' : Soft-thresholding
-
'hard' : Hard-thresholding
Defaults to 'no'.
-
- thresholdfloat, optional
-
Specifies the uniform thresholding value for soft/hard-thresholding.
Valid only when
method
is set as 'soft' or 'hard'.Defaults to 1e-9.
- level_thresholdsListOfTuples, optional
-
Specifies level-wise thresholding values via a list of tuples, with the 1st element of each tuple being the level, and 2nd element being the respective thresholding value. For example, [(1, 1e-2), (2, 1e-3)] means using threshold 1e-2 for level 1 wavelet coefficients for thresholding, and 1e-3 for level-2 wavelet coefficients for thresholding.
If both
threshold
andlevel_thresholds
are specified,level_thresholds
takes precedence.
- Attributes:
-
- coeff_DataFrame
-
DataFrame containing the result of PAL multi-level discrete wavelet (packet) transformation.
If
packet
is False, then the DataFrame is expected to be structured as follows:-
1st column : LEVEL, representing the decomposition level of coefficients, where approximation coefficients are marked with 0 while details coefficients are marked by their respective levels.
-
2nd column : ID, representing the order of coefficients.
-
3rd column : Approximation and detail coefficients for discrete wavelet transform(decomposition).
If
packet
is True, the the DataFrame is expected to be structured as follows:-
1st column : NODE, representing index of the nodes(i.e. leaves of the binary tree for wavelet packet transformation).
-
2nd column : ID, representing the time/spatial order of coefficients.
-
3rd column : COEFFICIENTS, wavelet packet coefficients.
-
- stats_DataFrame
-
DataFrame containing the key statistics for multi-level wavelet packet transformation.
The DataFrame is expected to be structured as follows:
-
1st column : NAME, type NVARCHAR(100), names of statistics.
-
2nd column : VAL, type NVARCHAR(5000), value of statistics(in particular, the coefficient size in different decomposition levels).
Available only when
packet
is True. -
Methods
inverse
([wavelet, boundary])Inverse transformation of wavelet decomposition, i.e. reconstruction.
transform
(data, key[, col])Performing the forward transformation(i.e. decomposition) for discrete wavelet transformation or wavelet packet transformation.
- transform(data, key, col=None)
-
Performing the forward transformation(i.e. decomposition) for discrete wavelet transformation or wavelet packet transformation.
- Parameters:
-
- dataDataFrame
-
Time-series data to apply discrete wavelet transform to.
- keystr
-
Specifies the time-stamp column in
data
.The column should be of type INTEGER, and the values do not need to be arranged in order.
- colstr, optional
-
Specifies the signal values for wavelet transformation, should be of type DOUBLE or DECIMAL(p,s).
The values contained in this column must be evenly-spaced in time.
If not specified, it defaults to the first non-key column of
data
.
- Returns:
-
- A DTW object with wavelet coefficients as its attribute.
- inverse(wavelet=None, boundary=None)
-
Inverse transformation of wavelet decomposition, i.e. reconstruction.
- Parameters:
-
- waveletstr, optional
-
Specifies the wavelet filter used in the decomposition phase.
If not provided, the value in self.wavelet is used.
- boundarystr, optional
-
Specifies the padding method for boundary values. Valid options include: 'zero', 'symmetric', 'periodic', 'reflect', 'smooth' and 'constant'.
If not provided, the value in self.boundary is used.
- Returns:
-
- DataFrame
-
The reconstructed time-series data after inverse transformation.
Inherited Methods from PALBase
Besides those methods mentioned above, the DWT class also inherits methods from PALBase class, please refer to PAL Base for more details.