| |
Methods defined here:
- __init__(self, data=None, method=None, miss_value='KEEP', input_columns=None, scale_global=False, accumulate=None, multiplier=1.0, intercept='0', data_sequence_column=None, data_partition_column=None, data_order_column=None)
- DESCRIPTION:
The ScaleByPartition function scales the sequences in each partition
independently, using the same formula as the function Scale.
PARAMETERS:
data:
Required Argument.
Specifies the input teradataml DataFrame for ScaleByPartition function.
data_partition_column:
Required Argument.
Specifies Partition By columns for data.
Values to this argument can be provided as list, if multiple columns
are used for partition.
Types: str OR list of Strings (str)
data_order_column:
Optional Argument.
Specifies Order By columns for data.
Values to this argument can be provided as a list, if multiple
columns are used for ordering.
Types: str OR list of Strings (str)
method:
Required Argument.
Specifies one or more statistical methods to use to scale the data
set. If you specify multiple methods, the output teradataml DataFrame includes
the column scalemethod (which contains the method name) and a row for each
input-row/method combination.
Permitted Values: MEAN, SUM, USTD, STD, RANGE, MIDRANGE, MAXABS
Types: str or list of Strings (str)
miss_value:
Optional Argument.
Specifies how the ScaleByPartition function processes NULL
values in input:
KEEP: Keep NULL values.
OMIT: Ignore any row that has a NULL value.
ZERO: Replace each NULL value with zero.
LOCATION: Replace each NULL value with its location value.
Default Value: "KEEP"
Permitted Values: KEEP, OMIT, ZERO, LOCATION
Types: str
input_columns:
Required Argument.
Specifies the input teradataml DataFrame columns that contain the
attribute values of the samples to be scaled. The attribute values must be numeric
values between -1e308 and 1e308. If a value is outside this range,
the function treats it as infinity.
Types: str OR list of Strings (str)
scale_global:
Optional Argument.
Specifies whether all columns specified in input_columns are scaled to the same location
and scale. (Each input column is scaled separately).
Default Value: False
Types: bool
accumulate:
Optional Argument.
Specifies the input teradataml DataFrame columns to copy to the
output teradataml DataFrame. By default, the function copies no input teradataml
DataFrame columns to the output teradataml DataFrame.
Tip: To identify the sequences in the output, specify the
partition columns in this argument.
Types: str OR list of Strings (str)
multiplier:
Optional Argument.
Specifies one or more multiplying factors to apply to the input
variables (multiplier in the following formula):
X" = intercept + multiplier * (X - location)/scale
If you specify only one multiplier, it applies to all columns specified
by the input_columns argument. If you specify multiple multiplying factor,
each multiplier applies to the corresponding input column. For example,
the first multiplier applies to the first column specified by the input_columns argument,
the second multiplier applies to the second input column, and so on.
Default Value: 1.0
Types: float OR list of floats
intercept:
Optional Argument.
Specifies one or more addition factors incrementing the scaled
results-intercept in the following formula:
X' = intercept + multiplier * (X - location)/scale
If you specify only one intercept, it applies to all columns specified
by the input_columns argument. If you specify multiple addition factors,
each intercept applies to the corresponding input column.
The syntax of intercept is:
[-]{number | min | mean | max }
where min, mean, and max are the global minimum,
maximum, mean values in the corresponding columns.
The function scales the values of min, mean, and max.
The formula for computing the scaled global minimum is:
scaledmin = (minX - location)/scale
The formulas for computing the scaled global mean and maximum
are analogous to the preceding formula.
For example, if intercept is "- min" and multiplier is 1,
the scaled result is transformed to a nonnegative sequence according
to this formula, where scaledmin is the scaled value:
X' = -scaledmin + 1 * (X - location)/scale.
Default Value: "0"
Types: str or list of Strings (str)
data_sequence_column:
Optional Argument.
Specifies the list of column(s) that uniquely identifies each row of
the input argument "data". The argument is used to ensure
deterministic results for functions which produce results that vary
from run to run.
Types: str OR list of Strings (str)
RETURNS:
Instance of ScaleByPartition.
Output teradataml DataFrames can be accessed using attribute
references, such as ScaleByPartitionObj.<attribute_name>.
Output teradataml DataFrame attribute name is:
result
RAISES:
TeradataMlException
EXAMPLES:
# Load example data.
# The table 'scale_housing' contains house properties
# like the number of bedrooms, lot size, the number of bathrooms, number of stories etc.
load_example_data("scalebypartition", "scale_housing")
# Create teradataml DataFrame objects.
scale_housing = DataFrame.from_table("scale_housing")
# Example 1 - This function scales the sequences on partition cloumn 'lotsize, using
# the same formula as the function.
scale_by_partition_out = ScaleByPartition(data=scale_housing,
data_partition_column ="lotsize",
input_columns = ["id","price", "lotsize", "bedrooms", "bathrms"],
method = "maxabs",
accumulate = "types"
)
# Print the result DataFrame
print(scale_by_partition_out)
- __repr__(self)
- Returns the string representation for a ScaleByPartition class instance.
- get_build_time(self)
- Function to return the build time of the algorithm in seconds.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
- get_prediction_type(self)
- Function to return the Prediction type of the algorithm.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
- get_target_column(self)
- Function to return the Target Column of the algorithm.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
- show_query(self)
- Function to return the underlying SQL query.
When model object is created using retrieve_model(), then None is returned.
|