Teradata R Package Function Reference | 17.00 - 17.00 - DWT - Teradata R Package

Teradata® R Package Function Reference

prodname
Teradata R Package
vrm_release
17.00
created_date
September 2020
category
Programming Reference
featnum
B700-4007-090K

Description

The DWT function implements Mallat's algorithm (an iterate algorithm in the Discrete Wavelet Transform field) and applies wavelet transform on multiple sequences simultaneously.

Usage

  td_dwt_mle (
      data = NULL,
      input.columns = NULL,
      sort.column = NULL,
      wavelet = NULL,
      wavelet.filter = NULL,
      level = NULL,
      extension.mode = "sym",
      partition.columns = NULL,
      data.sequence.column = NULL,
      wavelet.filter.sequence.column = NULL
  )

Arguments

data

Required Argument.
Specifies the name of the tbl_teradata contains the sequences to be transformed.

input.columns

Required Argument.
Specifies the names of the columns in the input tbl_teradata contains the data to be transformed. These columns must contain numeric values between -1e308 and 1e308. The function treats NULL as 0.
Types: character OR vector of Strings (character)

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 (i.e, in a partition), then sequence order can vary, and the function can produce different transform results for the sequence.
Types: character

wavelet

Optional Argument.
Required if "wavelet.filter" argument is not specified.
Specifies a wavelet filter name. Refer table below to find wavelet family and its supported wavelet names.

  1. Daubechies : 'db1' or 'haar', 'db2', .... ,'db10'

  2. Coiflets : 'coif1', ... , 'coif5'

  3. Symlets : 'sym1', ... ,' sym10'

  4. Discrete Meyer: 'dmey'

  5. 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'

  6. 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: character

wavelet.filter

Optional Argument.
Required if "wavelet" argument is not specified. Specifies the name of the tbl_teradata object that contains the coefficients. of the wave filters.

level

Required Argument.
Specifies the wavelet transform level. The value of this argument must be an integer in the range [1, 1000].
Types: integer

extension.mode

Optional Argument.
Specifies the method for handling border distortion. The value level must be an integer in the range [1, 1000].
Supported Extension Modes are :

  1. sym : (Default) Symmetrically replicate boundary values, mirroring the points near the boundaries.
    For example : 4 4 3 2 1 | 1 2 3 4 | 4 3 21 1

  2. zpd : Zero-pad boundary values with zero.
    For example: 0 0 0 0 0 | 12 3 4 | 0 0 0 0 0

  3. ppd : Periodic extension, fill boundary values as the input sequence is a periodic one.
    For example: 4 1 2 3 4 | 12 3 4 | 12 3 4 1

Types: character

partition.columns

Optional Argument.
Specifies the names of the "partition.columns", which identify the sequences. 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 tbl_teradata. By default, all rows belong to one sequence, and the function generates a distribute key column named "dwt_idrandom_name" in both the output tbl_teradata and the meta tbl_teradata. In both tbl_teradata, every cell of "dwt_idrandom_name" has the value 1.
Types: character OR vector of Strings (character)

data.sequence.column

Optional Argument.
Specifies the vector 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: character OR vector of Strings (character)

wavelet.filter.sequence.column

Optional Argument.
Specifies the vector 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: character OR vector of Strings (character)

Value

Function returns an object of class "td_dwt_mle" which is a named list containing objects of class "tbl_teradata".
Named list members can be referenced directly with the "$" operator using following names:

  1. coefficient

  2. meta.table

  3. output

Examples

    # Get the current context/connection
    con <- td_get_context()$connection
    
    # Load example data.
    # This example uses hourly climate data for five cities on a given day.
    loadExampleData("dwt_example", "ville_climatedata")
    
    # Create object(s) of class "tbl_teradata".
    ville_climatedata <- tbl(con, "ville_climatedata")
    
    # Example 1 - The function creates the coefficient model tbl_teradata and the meta tbl_teradata.
    td_dwt_out <- td_dwt_mle(data = ville_climatedata,
                         input.columns = c('temp_f','pressure_mbar','dewpoint_f'),
                         sort.column = "period",
                         wavelet = "db2",
                         partition.columns = c("city"),
                         level=2
                         )