Teradata R Package Function Reference - IDWT2D - Teradata R Package - Look here for syntax, methods and examples for the functions included in the Teradata R Package.

Teradata® R Package Function Reference

Product
Teradata R Package
Release Number
16.20
Published
February 2020
Language
English (United States)
Last Update
2020-02-28
dita:id
B700-4007
lifecycle
previous
Product Category
Teradata Vantage

Description

The IDWT2D function is the inverse of DWT2D. IDWT2D applies inverse wavelet transforms on multiple sequences simultaneously. IDWT2D takes as input the output table and meta table 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 table that contains the meta information used in td_dwt2d_mle. Typically, this tbl_teradata object is the meta table generated by td_dwt2d_mle.

coefficient

Required Argument.
Specifies the name of the input tbl_teradata object that contains the coefficient table 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 table 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 table 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 table and meta table. By default, all rows belong to one sequence, and the function generates a distribute key column named 'dwt_idrandom_name' in both the output table and the meta table. In both tables, 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 Teradata tbl objects.
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 remote tibble objects.
    twod_climate_data <- tbl(con, "twod_climate_data")
    
    # Example 1 - The function outputs a coefficient model table and a meta table.
    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")
                               )