Teradata R Package Function Reference | 17.00 - 17.00 - IDWT2D - 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 IDWT2D function is the inverse of DWT2D. IDWT2D applies inverse wavelet transforms on multiple sequences simultaneously. IDWT2D takes as input the output tbl_teradata and meta tbl_teradata generated by function DWT2D (td_dwt2d_mle) and outputs the sequences as 2-dimensional matrices. Because the IDWT2D output is comparable to the DWT2D input, the inverse transformation is also called the reconstruction.

Usage

  td_idwt2d_mle (
      meta.table = NULL,
      coefficient = NULL,
      input.columns = NULL,
      sort.column = NULL,
      compact.output = TRUE,
      partition.columns = NULL,
      coefficient.sequence.column = NULL,
      meta.table.sequence.column = NULL
  )

Arguments

meta.table

Required Argument.
Specifies the name of the input tbl_teradata that contains the meta information used in td_dwt2d_mle. Typically, this tbl_teradata object the meta table generated by td_dwt2d_mle.

coefficient

Required Argument.
Specifies the name of the coefficient input tbl_teradata generated by td_dwt2d_mle.

input.columns

Required Argument.
Specifies the names of the columns in the input data that contain 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 input column that represents the order of coefficients in each sequence (the waveletid column in the coefficient tbl_teradata generated by td_dwt2d_mle). The column must contain a sequence of integer values that start from 1 for each sequence. If a value is missing from the sequence, then the function treats the corresponding data column as 0.
Types: character OR vector of Strings (character)

compact.output

Optional Argument.
Specifies whether to ignore (not output) rows in which all coefficient values are very small (having 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 values for this argument, then the function treats the first one as the distribute key of the output tbl_teradata 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)

coefficient.sequence.column

Optional Argument.
Specifies the vector of column(s) that uniquely identifies each row of the input argument "coefficient". 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)

meta.table.sequence.column

Optional Argument.
Specifies the vector of column(s) that uniquely identifies each row of the input argument "meta.table". 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_idwt2d_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. output.table

  2. 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")
                             )

    # Consume output of td_dwt2d_mle() and output the sequences.
    td_idwt2d_out <- td_idwt2d_mle(meta.table = td_dwt2d_out$meta.table,
                               coefficient = td_dwt2d_out$coefficient,
                               input.columns = c("temp_f","pressure_mbar","dewpoint_f"),
                               sort.column = "waveletid",
                               partition.columns = c("state")
                               )