| |
Methods defined here:
- __init__(self, data=None, input_columns=None, sort_column=None, wavelet=None, wavelet_filter=None, level=None, extension_mode='sym', partition_columns=None, data_sequence_column=None, wavelet_filter_sequence_column=None)
- DESCRIPTION:
The DWT function implements the Mallat algorithm (an iterate
algorithm in the Discrete Wavelet Transform field) and applies
wavelet transform on multiple sequences simultaneously.
The input is typically a set of time series sequences. You specify
the wavelet name or wavelet filter teradataml DataFrame, transform
level, and (optionally) extension mode. The function returns the
transformed sequences in Hilbert space with the corresponding
component identifiers and indices. (The transformation is also
called the decomposition.)
You can filter the result to reduce the lengths of the transformed
sequences and then use the function IDWT to reconstruct them;
therefore, the DWT and IDWT functions are useful for compression
and removing noise.
PARAMETERS:
data:
Required Argument.
Specifies the name of the teradataml DataFrame that contains
the sequences to be transformed.
input_columns:
Required Argument.
Specifies the names of the columns in the input teradataml
DataFrame that contain the data to be transformed. These
columns must contain numeric values between -1e308 and 1e308.
The function treats NULL in columns as 0.
Types: str OR list of Strings (str)
sort_column:
Required Argument.
Specifies the name of the column that defines the order of
samples in the sequences to be transformed. In a time series
sequence, the column can consist of timestamp values.
Note:
If sort_column has duplicate elements in a sequence (that
is, in a partition), then sequence order can vary, and the
function can produce different transform results for the
sequence.
Types: str
wavelet:
Optional Argument.
Specifies a wavelet filter name.
Wavelet Family Permitted values for the argument
Daubechies 'db1' or 'haar', 'db2', .... ,'db10'
Coiflets 'coif1', ... , 'coif5'
Symlets 'sym1', ... ,' sym10'
Discrete Meyer 'dmey'
Biorthogonal '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'
Reverse Biorthogonal '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'
Types: str
wavelet_filter:
Optional Argument.
Specifies the teradataml DataFrame that contains the coefficients
of the wave filters.
level:
Required Argument.
Specifies the wavelet transform level. The value level must be
an integer in the range [1, 1000].
Types: int
extension_mode:
Optional Argument.
Specifies the method for handling border distortion.
Permitted values for this argument:
• "sym" : Symmetrically replicate boundary values, mirroring
the points near the boundaries.
For example: 4 4 3 2 1 | 1 2 3 4 | 4 3 2 1 1
• "zpd" : Zero-pad boundary values with zero.
For example: 0 0 0 0 0 | 1 2 3 4 | 0 0 0 0 0
• "ppd" : Periodic extension, fill boundary values as the input
sequence is a periodic one.
For example: 4 1 2 3 4 | 1 2 3 4 | 1 2 3 4 1
Default Value: "sym"
Types: str
partition_columns:
Optional Argument.
Specifies the names of the columns, which identify the sequences
to which data belongs. Rows with the same partition columns
values belong to the same sequence. If you specify multiple
partition columns, then the function treats the first one as the
distribute key of the output and meta tables. By default, all
rows belong to one sequence, and the function generates a
distribute key column named 'dwt_idrandom_name' in both the
output teradataml DataFrame and the meta table. In both tables,
every cell of dwt_idrandom_name has the value 1.
Types: str OR list of Strings (str)
data_sequence_column:
Optional Argument.
Specifies the list of column(s) that uniquely identifies each
row of the input argument "data". The argument is used to
ensure deterministic results for functions which produce
results that vary from run to run.
Types: str OR list of Strings (str)
wavelet_filter_sequence_column:
Optional Argument.
Specifies the list of column(s) that uniquely identifies each
row of the input argument "wavelet_filter". The argument is used
to ensure deterministic results for functions which produce
results that vary from run to run.
Types: str OR list of Strings (str)
RETURNS:
Instance of DWT.
Output teradataml DataFrames can be accessed using attribute
references, such as DWTObj.<attribute_name>.
Output teradataml DataFrame attribute names are:
1. coefficient
2. meta_table
3. output
RAISES:
TeradataMlException
EXAMPLES:
# Load example data.
load_example_data('dwt', ['ville_climatedata', 'dwt_filter_dim'])
# This example uses hourly climate data 'ville_climatedata' for five
# cities (Asheville, Greenville, Brownsville, Nashville and Knoxville)
# on a given day. The data are temperature (in degrees Fahrenheit),
# pressure (in mbars), and dewpoint (in degrees Fahrenheit). The function
# generates the coefficient model teradataml DataFrame and the meta_table
# teradataml DataFrame, which can be used as input to the function IDWT.
# The table 'dwt_filter_dim' contains wavelet filter information needed
# to generate coefficient model teradataml DataFrame and the meta_table
# teradataml DataFrame.
# Create teradataml DataFrame objects.
ville_climatedata = DataFrame.from_table("ville_climatedata")
dwt_filter_dim = DataFrame.from_table("dwt_filter_dim")
# Example 1 : Using 'db2' wavelet to apply DWT function on columns,
# "temp_f", "pressure_mbar" and "dewpoint_f" (of DataFrame
# 'ville_climatedata') partitioned by the column "city"
# and sorted by column "period".
DWT_out1 = DWT(data = ville_climatedata,
input_columns = ["temp_f","pressure_mbar","dewpoint_f"],
sort_column = "period",
wavelet = "db2",
level = 2,
partition_columns = ["city"]
)
# Print the results
print(DWT_out1.coefficient) # Prints coefficient DataFrame which stores
# the coefficients generated by the wavelet
# transform.
print(DWT_out1.meta_table) # Prints meta_table DataFrame which stores
# the meta information for the wavelet
# transform.
print(DWT_out1.output) # Prints output teradataml DataFrame.
# Example 2 : Using wavelet_filter DataFrame to apply DWT function
# on columns, "temp_f", "pressure_mbar" and "dewpoint_f" (of
# DataFrame 'ville_climatedata') partitioned by the column
# "city" and sorted by column "period".
DWT_out2 = DWT(data = ville_climatedata,
input_columns = ["temp_f","pressure_mbar","dewpoint_f"],
wavelet_filter=dwt_filter_dim,
sort_column = "period",
level = 2,
partition_columns = "city",
wavelet_filter_sequence_column="filtername"
)
# Print the results
print(DWT_out2.coefficient) # Prints coefficient DataFrame which stores
# the coefficients generated by the wavelet
# transform.
print(DWT_out2.meta_table) # Prints meta_table DataFrame which stores
# the meta information for the wavelet
# transform.
print(DWT_out2.output) # Prints output teradataml DataFrame.
- __repr__(self)
- Returns the string representation for a DWT class instance.
- get_build_time(self)
- Function to return the build time of the algorithm in seconds.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
- get_prediction_type(self)
- Function to return the Prediction type of the algorithm.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
- get_target_column(self)
- Function to return the Target Column of the algorithm.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
- show_query(self)
- Function to return the underlying SQL query.
When model object is created using retrieve_model(), then None is returned.
|