tdplyr: Model Transformations
Description
Generic transform function for performing transformations using results of model fitting functions, such as
-
td_bincode_fit()
-
td_fit()
-
td_non_linear_combine_fit()
-
td_one_hot_encoding_fit()
-
td_ordinal_encoding_fit()
-
td_outlier_filter_fit()
-
td_polynomial_features_fit()
-
td_random_projection_fit()
-
td_row_normalize_fit()
-
td_scale_fit()
-
td_simple_impute_fit()
-
td_target_encoding_fit()
This function invokes respective transform methods, based on the class of the the model (first argument).
Usage
transform(`_data`, ...)
Arguments
`_data` |
Required Argument.
It is usually created using the following methods:
|
... |
Additional arguments useful for predictions. |
Value
Return value from transfrom depends on the class of the object.
Examples
# Please visit individual predict in-line documentation for more examples.
# transform.td_bincode_fit
# transform.td_fit
# transform.td_non_linear_combine_fit
# transform.td_one_hot_encoding_fit
# transform.td_ordinal_encoding_fit
# transform.td_outlier_filter_fit
# transform.td_polynomial_features_fit
# transform.td_random_projection_fit
# transform.td_row_normalize_fit
# transform.td_scale_fit
# transform.td_simple_impute_fit
# transform.td_target_encoding_fit
#### Bincode Transform Example ####
# Get the current context/connection.
con <- td_get_context()$connection
# Load the example data.
loadExampleData("tdplyr_example", "titanic", "bin_fit_ip")
# Create tbl_teradata object.
titanic_data <- tbl(con, "titanic")
bin_fit_ip <- tbl(con, "bin_fit_ip")
# Check the list of available analytic functions.
display_analytic_functions()
# Example 1: Convert the continuous numeric data in the column 'age' to
# categorical data.
# First generate a model using td_bincode_fit_sqle() function to bin-code the values
# in column 'age' using the 'Variable-Width' method type.
bin_code_1 <- td_bincode_fit_sqle(data=titanic_data,
fit.data=bin_fit_ip,
fit.data.order.column = c('minVal', 'maxVal'),
target.columns='age',
minvalue.column='minVal',
maxvalue.column='maxVal',
label.column='label',
method.type='Variable-Width',
label.prefix='label_prefix'
)
# use S3 transform function to run transform on the output of
# td_bincode_fit_sqle() function.
obj <- transform(bin_code_2,
data=titanic_data,
accumulate=c('passenger', 'ticket')
)
# Print the result.
print(obj$result)