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

Teradata® Package for R Function Reference

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for R
Release Number
17.20
Published
March 2024
Language
English (United States)
Last Update
2024-05-03
dita:id
TeradataR_FxRef_Enterprise_1720
Product Category
Teradata Vantage

RandomProjectionFit

Description

The td_random_projection_fit_sqle() function returns a random projection matrix based on the specified arguments.

The function also returns the required parameters for transforming the input data into lower-dimensional data. The td_random_projection_transform_sqle() function uses the td_random_projection_fit_sqle() output to reduce the dimensionality of the input data.

Usage

  td_random_projection_fit_sqle (
      data = NULL,
      target.columns = NULL,
      num.components = NULL,
      seed = NULL,
      epsilon = 0.1,
      density = 0.33333333,
      projection.method = "GAUSSIAN",
      output.featurenames.prefix = "td_rpj_feature",
      ...
  )

Arguments

data

Required Argument.
Specifies the input tbl_teradata.
Types: tbl_teradata

target.columns

Required Argument.
Specifies the columns/features for dimensionality reduction.
Types: character OR vector of Strings (character)

num.components

Required Argument.
Specifies the target dimension(number of features) into which data points from the original dimension will be projected.
The "num.components" value cannot be greater than the original dimension (number of features) and must satisfy the Johnson-Lindenstrauss Lemma result. The minimum value allowed for the "num.components" argument is calculated using the td_random_projection_min_components_sqle() function.
Types: integer

seed

Optional Argument.
Specifies the random seed the function uses for repeatable results.
The algorithm uses the seed to generate a random projection matrix.
The seed must be a non-negative integer value.
Default Value: The Random Seed value is used for generating a random projection matrix, and hence the output is non-deterministic.
Types: integer

epsilon

Optional Argument.
Specifies a value to control distortion introduced while projecting the data to a lower dimension. The amount of distortion increases if you increase the value.
Accepts value between 0 and 1.
Default Value: 0.1
Types: float OR integer

density

Optional Argument.
Specifies the approximate ratio of non-zero elements in the random projection matrix when SPARSE is used as the "projection.method".
Permitted Values: [0,1]
Default Value: 0.33333333
Types: float OR integer

projection.method

Optional Argument.
Specifies the method name for generating the random projection matrix.
Default Value: "GAUSSIAN"
Permitted Values: "GAUSSIAN", "SPARSE"
Types: character

output.featurenames.prefix

Optional Argument.
Specifies the prefix for the output column names.
Default Value: "td_rpj_feature"
Types: character

...

Specifies the generic keyword arguments SQLE functions accept. Below are the generic keyword arguments:
persist:
Optional Argument.
Specifies whether to persist the results of the function in a table or not. When set to TRUE, results are persisted in a table; otherwise, results are garbage collected at the end of the session.
Default Value: FALSE
Types: logical

volatile:
Optional Argument.
Specifies whether to put the results of the function in a volatile table or not. When set to TRUE, results are stored in a volatile table, otherwise not.
Default Value: FALSE
Types: logical

Function allows the user to partition, hash, order or local order the input data. These generic arguments are available for each argument that accepts tbl_teradata as input and can be accessed as:

  • "<input.data.arg.name>.partition.column" accepts character or vector of character (Strings)

  • "<input.data.arg.name>.hash.column" accepts character or vector of character (Strings)

  • "<input.data.arg.name>.order.column" accepts character or vector of character (Strings)

  • "local.order.<input.data.arg.name>" accepts logical

Note:
These generic arguments are supported by tdplyr if the underlying SQL Engine function supports, else an exception is raised.

Value

Function returns an object of class "td_random_projection_fit_sqle" which is a named list containing object of class "tbl_teradata".
Named list member(s) can be referenced directly with the "$" operator using the name(s):

  1. result

  2. output.data

Examples

  
    
    # Get the current context/connection.
    con <- td_get_context()$connection
    
    # Load the example data.
    loadExampleData("tdplyr_example", "stock_movement")
    
    # Create tbl_teradata object.
    stock_movement <- tbl(con, "stock_movement")
    
    # Check the list of available analytic functions.
    display_analytic_functions()
    
    # Example 1 : Get random projection matrix for
    #             stock_movement tbl_teradata.
    RandomProjectionFit_out <- td_random_projection_fit_sqle(
                                                  data = stock_movement,
                                                  target.columns = "1:",
                                                  epsilon = 0.9,
                                                  num.components = 343
                                                  )
    
    # Print the result tbl_teradata objects.
    print(RandomProjectionFit_out$result)
    print(RandomProjectionFit_out$output.data)