| |
- RandomProjectionTransform(object=None, data=None, accumulate=None, **generic_arguments)
- DESCRIPTION:
The RandomProjectionTransform() function converts the
high-dimensional input data to a low-dimensional space
using the RandomProjectionFit() function output.
PARAMETERS:
object:
Required Argument.
Specifies the teradataml DataFrame containing the output generated by
RandomProjectionFit() function or the instance of RandomProjectionFit.
Types: teradataml DataFrame or RandomProjectionFit
data:
Required Argument.
Specifies the input teradataml DataFrame.
Types: teradataml DataFrame
accumulate:
Optional Argument.
Specifies the name(s) of input teradataml DataFrame column(s) to copy to the
output. By default, only transformed columns are present in the output.
Types: str OR list of Strings (str)
**generic_arguments:
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: bool
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: bool
Function allows the user to partition, hash, order or local
order the input data. These generic arguments are available
for each argument that accepts teradataml DataFrame as
input and can be accessed as:
* "<input_data_arg_name>_partition_column" accepts str or
list of str (Strings)
* "<input_data_arg_name>_hash_column" accepts str or list
of str (Strings)
* "<input_data_arg_name>_order_column" accepts str or list
of str (Strings)
* "local_order_<input_data_arg_name>" accepts boolean
Note:
These generic arguments are supported by teradataml if
the underlying SQL Engine function supports, else an
exception is raised.
RETURNS:
Instance of RandomProjectionTransform.
Output teradataml DataFrames can be accessed using attribute
references, such as
RandomProjectionTransformObj.<attribute_name>.
Output teradataml DataFrame attribute name is:
result
RAISES:
TeradataMlException, TypeError, ValueError
EXAMPLES:
# Notes:
# 1. Get the connection to Vantage to execute the function.
# 2. One must import the required functions mentioned in
# the example from teradataml.
# 3. Function will raise error if not supported on the Vantage
# user is connected to.
# Load the example data.
load_example_data("teradataml", "stock_movement")
# Create teradataml DataFrame objects.
stock_movement = DataFrame.from_table("stock_movement")
# Check the list of available analytic functions.
display_analytic_functions()
# Example 1 : Get random projection matrix for
# stock_movement DataFrame.
fit_obj = RandomProjectionFit(data = stock_movement,
target_columns = "1:",
epsilon = 0.9,
num_components = 343)
# Generate feature matrix. Note that teradataml DataFrame representing
# the model is passed as input to "object".
RandomProjectionTransform_out = RandomProjectionTransform(object = fit_obj.result,
data = stock_movement)
# Print the result DataFrame.
print(RandomProjectionTransform_out.result)
# Example 2 : Generate feature matrix. Note that model is passed as instance of
# RandomProjectionFit to "object".
RandomProjectionTransform_out1 = RandomProjectionTransform(object = fit_obj,
data = stock_movement)
# Print the result DataFrame.
print(RandomProjectionTransform_out1.result)
|