Description
ZScore will allows rescaling of continuous numeric data in a more
sophisticated way than a Rescaling transformation. In a Z-Score
transformation, a numeric column is transformed into its Z-score based
on the mean value and standard deviation of the data in the column.
Z-Score transforms each column value into the number of standard
deviations from the mean value of the column. This non-linear transformation
is useful in data mining rather than in a linear Rescaling transformation.
The Z-Score transformation supports both numeric and date type input data.
Note:
The object of this class is passed to "zscore" argument of
td_transform_valib()
.
Usage
tdZScore(columns, datatype=NULL, fillna=NULL)
Arguments
columns |
Required Argument. | ||||||||||||||||||||||||||||||||||||
datatype |
Optional Argument.
Notes:
Examples:
Types: character | ||||||||||||||||||||||||||||||||||||
fillna |
Optional Argument.
Types: tdFillNa |
Value
An object of tdZScore class.
Examples
Notes:
# 1. To run any transformation, user needs to use td_transform_valib()
# function.
# 2. To do so set option 'val.install.location' to the database name
# where Vantage analytic library functions are installed.
# 3. Datasets used in these examples can be loaded using Vantage Analytic
# Library installer.
# Get the current context/connection
con <- td_get_context()$connection
# Set the option 'val.install.location'.
options(val.install.location = "SYSLIB")
# Load example data.
loadExampleData("val_example", "sales")
# Create object(s) of class "tbl_teradata".
sales <- tbl(con, "sales")
sales
# Example 1: Rescaling with ZScore is carried out on 'Feb' column.
zs <- tdZScore(columns="Feb")
# Perform the ZScore transformation using td_transform_valib().
obj <- td_transform_valib(data=sales, zscore=zs)
obj$result
# Example 2: Rescaling with ZScore is carried out with multiple columns 'Jan'
# and 'Apr' with null replacement using 'mode' style.
fn <- tdFillNa(style="mode")
zs <- tdZScore(columns=list("Jan"="january", "Apr"="april"), fillna=fn)
# Perform the ZScore transformation using td_transform_valib().
obj <- td_transform_valib(data=sales, zscore=zs, key.columns="accounts")
obj$result