Teradata R Package Function Reference | 17.00 - 17.00 - DWT2D - 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 DWT2D function implements Mallat's algorithm (an iterate algorithm in the Discrete Wavelet Transform field) on 2-dimensional matrices and applies wavelet transform on multiple sequences simultaneously.

Usage

  td_dwt2d_mle (
      data = NULL,
      input.columns = NULL,
      index.columns = NULL,
      range = NULL,
      wavelet = NULL,
      wavelet.filter = NULL,
      level = NULL,
      extension.mode = "sym",
      compact.output = TRUE,
      partition.columns = NULL,
      data.sequence.column = NULL,
      wavelet.filter.sequence.column = NULL
  )

Arguments

data

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

input.columns

Required Argument.
Specifies the names of the columns in the input tbl_teradata that 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)

index.columns


Required Argument. Specifies the columns that contain the indexes of the input sequences. For a matrix, this takes a vector of two elements, the first element is the column containing the x coordinates and second element is the column containing the y coordinates.
Types: character OR vector of Strings (character)

range

Optional Argument.
Specifies the start and end indexes of the input data, all of which must be integers.
The default values for each sequence are:

  1. starty: minimum y index

  2. startx: minimum x index

  3. endy: maximum y index

  4. endx: maximum x index.


Specify the argument value in the format '(startx,starty),(endx,endy)'. The function treats any NULL value as 0. The range can specify a maximum of 1,000,000 cells.
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 that contains the coefficients of the wavelet filters.

level

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

extension.mode

Optional Argument.
Specifies the method for handling border distortion, an extension mode from the supported extension modes specified below - td_dwt_mle "extension.mode" argument.
Default Value: "sym"
Permitted Values: sym, zpd, ppd
Types: character

compact.output

Optional Argument.
Specifies whether to ignore rows in which all coefficient values have an absolute value less than 1e-12. For a sparse input matrix, ignoring such rows reduces the output tbl_teradata size.
Default Value: TRUE
Types: logical

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 coefficient 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_dwt2d_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.
    # dataset contains climate data in cities in California (CA), Texas (TX), and Washington (WA).
    # The cities are represented by two-dimensional coordinates (latitude and longitude).
    # The data are temperature (in degrees Fahrenheit), pressure (in Mbars), 
    # and dew point (in degrees Fahrenheit).
    loadExampleData("dwt2d_example", "twod_climate_data")
    
    # Create object(s) of class "tbl_teradata".
    twod_climate_data <- tbl(con, "twod_climate_data")
    
    # Example 1 - The function outputs a coefficient model tbl_teradata and a meta tbl_teradata.
    td_dwt2d_out <- td_dwt2d_mle(data = twod_climate_data,
                             input.columns = c("temp_f","pressure_mbar","dewpoint_f"),
                             index.columns = c("latitude","longitude"),
                             wavelet = "db2",
                             level = 2,
                             compact.output = TRUE,
                             partition.columns = c("state")
                             )