Teradata R Package Function Reference - IDWT - 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 IDWT function is the inverse of DWT(td_dwt_mle). IDWT applies inverse wavelet transforms on multiple sequences simultaneously. IDWT takes as input the output table and meta table generated by DWT(td_dwt_mle) and outputs the sequences in time domain. Because the IDWT output is comparable to the DWT(td_dwt_mle) input, the inverse transformation is also called the reconstruction.

Usage

  td_idwt_mle (
      coefficient = NULL,
      meta.table = NULL,
      input.columns = NULL,
      sort.column = NULL,
      partition.columns = NULL,
      coefficient.sequence.column = NULL,
      meta.table.sequence.column = NULL
  )

Arguments

coefficient

Required Argument.
Specifies the name of the input tbl_teradata or view that contains the coefficients generated by td_dwt_mle.

meta.table

Required Argument.
Specifies the name of the input tbl_teradata that contains the output 'meta.table' of td_dwt_mle. Typically this argument is the output meta.table as returned by td_dwt_mle.

input.columns

Required Argument.
Specifies the names of the columns in the input table specified in "coefficient" argument 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_dwt_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)

partition.columns

Optional Argument.
Specifies the names of the partition columns, which identify the sequences. Rows with the the same "partition.columns" values belong to the same sequence. If you specify multiple values in "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 coefficient 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_idwt_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.
    # This example uses hourly climate data for five cities on a given day.
    loadExampleData("dwt_example", "ville_climatedata")
    
    # Create remote tibble objects.
    ville_climatedata <- tbl(con, "ville_climatedata")
    
    # Example 1 -
    # Apply DWT to sequences to create their coefficients and corresponding metadata.
    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
                         )
                         
    # use the coefficient model table and the meta table generated by td_dwt_mle function 
    # and apply td_idwt_mle to the filtered coefficients to reconstruct the sequences.
    td_idwt_out <- td_idwt_mle(coefficient = td_dwt_out$coefficient,
                           meta.table = td_dwt_out$meta.table,
                           input.columns = c("temp_f","pressure_mbar","dewpoint_f"),
                           sort.column = "waveletid",
                           partition.columns = c("city")
                           )