Sigmoid

In-Database Analytic Functions User Guide

brand
Software
prodname
Teradata Warehouse Miner
vrm_release
5.4.2
category
User Guide
featnum
B035-2306-106K

Purpose

A Sigmoid transformation provides rescaling of continuous numeric data in a more sophisticated way than the Rescaling transformation function. In a Sigmoid transformation a numeric column is transformed using a type of sigmoid or s-shaped function. The logit function produces a continuously increasing value between 0 and 1. The modified logit function is twice the logit minus 1 and produces a value between -1 and 1. The hyperbolic tangent function also produces a value between -1 and 1. These non-linear transformations are generally more useful in data mining than a linear Rescaling transformation.

Note that for absolute values of x greater than or equal to 36, the value of the sigmoid function is effectively 1 for positive arguments or 0 for negative arguments, within about 15 digits of significance.

The Sigmoid transformation is supported for numeric columns only, not date columns. The only required parameter for the Sigmoid transformation is columns. The datatype parameter can be used to control the output data type. The sigmoidstyle parameter can also be used to specify the style of sigmoid function.

Syntax

call twm. td_analyze('vartran','database=twm_source;tablename=twm_customer;General Parameters;sigmoid={sigmoidstyle (logit),columns (columns)};');

Required Parameters

columns
Controls the name of the output (transformed) column and its data type. The columns parameter is required by all transformations except Derive. A separate transformation is performed for each column in the list. If a column name is followed by a forward slash and a name, the name after the slash becomes the name of the transformed column in the resultant output table. Otherwise the column name is used as the output column name.
For the Derive transformation, the outputname parameter controls the naming of the transformed output column.
database
The database containing the input table.
sigmoid
The parameter that identifies the type of transformation being performed.
sigmoidstyle

the sigmoidstyle parameter may be used to specify the style of sigmoid function, either logit, modifiedlogit or tanh (for example,. hyperbolic tangent). If sigmoidstyle is not specified, the logit style is assumed as the default.

  • sigmoidstyle (logit)
  • sigmoidstyle (modifiedlogit)
  • sigmoidstyle (tanh)

Refer to Teradata Warehouse Miner User Guide, Volume 2, ADS Generation, Release 5.4.2, B035-2301 for the formulas associated with these sigmoid variations.

tablename
The name of the table to be transformed.
vartran
This parameter is required to run a variable transformation. The vartran parameter is always enclosed in single quotes.

General Parameters (separated by semi-colons)

datatype
For all transformation types, the datatype parameter is used to cast the column to a desired database data type provided it is compatible with the transformed data.
The allowed output types include:
  • byteint
  • char
  • date
  • decimal
  • float
  • integer
  • smallint
  • time
  • timestamp
  • varchar
  • bigint
  • number
fallback
When set to true, this parameter requests a mirrored copy of the output table in the Teradata Database when outputstyle=table.
gensqlonly
When set to true, the SQL for the requested transformations is returned as a result set but not executed. When this parameter is not specified or is set to false, the SQL is executed but not returned.
indexcolumns
When set to true, requests the output table contain the index columns when outputstyle=table.
indexunique
When set to true, requests the output table contain a unique primary index when outputstyle=table.
keycolumns
When null replacement is requested, either via a Null Replacement transformation or in combination with a Bin Code, Derive, Design Code, Recode, Rescale, Sigmoid or Z Score transformation, the keycolumns parameter must be specified. The column or columns listed must form a unique key into the input and output table of the transformation.
lockingclause

Requests the generated SQL contain the given locking clause in the appropriate location depending on the output style.

An example of a locking clause when the output style defaults to select is:

LOCKING mydb.mytable FOR ACCESS;

multiset
When set to true, requests an output table that may contain duplicate rows when outputstyle=table.
noindex
When set to true, requests the output table contain no index columns when outputstyle=table.
nullstyle
Data types supported by various nullstyle parameters are:
Data Type Description Example
literal,value numeric, character, and date nullstyle (literal,value)
mean numeric and date nullstyle (mean)
median numeric and date nullstyle (median)
medianwithoutaveraging any supported data type nullstyle (medianwithoutaveraging)
mode any supported date type nullstyle (mode)
imputed,table any supported data type nullstyle (imputed,tablename)

If date values are entered, the keyword DATE must precede the date value, which should not be enclosed in single quotes.

outputdatabase
The database that will contain the resulting output table when outputstyle=table or view.
outputtablename
The name of the output table when outputstyle=table or view.
outputstyle
The allowed output styles are:
  • select
  • table
  • view
If outputstyle is not specified, the function generates a SELECT statement and does not create a table or view.
outputstyle={select||table||view}
whereclause
Requests the generated SQL contain the given WHERE clause in appropriate places in the generated SQL. This is independent of the output style requested.

Examples

Examples in this section show how to use Sigmoid. These examples assume that the td_analyze function has been installed in a database named twm.

The following example demonstrates the Sigmoid transformation.

call twm.td_analyze('vartran','database=twm_source;tablename=twm_customer;sigmoid={sigmoidstyle(logit),columns(cust_id,age,income)}{sigmoidstyle(modifiedlogit),columns(cust_id/cid2,age/age2,income/inc2)}{sigmoidstyle(tanh),columns(cust_id/cid3,age/age3,income/inc3)};');

The following example demonstrates combined null replacement. keycolumns must be included as a general parameter when null value replacement is performed.

call twm.td_analyze('vartran','database=twm_source;tablename=twm_customer;keycolumns=cust_id;sigmoid=sigmoidstyle(logit),nullstyle(literal,0),columns(age,income);');