| |
Methods defined here:
- __init__(self, data=None, target_columns=None, alpha=0.1, start_rows=2, include_first=False, data_sequence_column=None, data_partition_column=None, data_order_column=None)
- DESCRIPTION:
The ExponentialMovAvg function computes the exponential moving average
of the points in a time series, exponentially decreasing the
weights of older values.
PARAMETERS:
data:
Required Argument.
Specifies the name of the teradataml DataFrame that contains the
columns.
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:
Required Argument.
Specifies Order By columns for data.
Values to this argument can be provided as list, if multiple columns
are used for ordering.
Types: str OR list of Strings (str)
target_columns:
Optional Argument.
Specifies the input column names for which the moving average is to
be computed. If you omit this argument, then the function copies
every input column to the output teradataml DataFrame but does not
compute moving average.
Types: str OR list of Strings (str)
alpha:
Optional Argument.
Specifies the damping factor, a value in the range [0, 1], which
represents a percentage in the range [0, 100]. For example, if alpha
is 0.2, then the damping factor is 20%. A higher alpha discounts
older observations faster.
Default Value: 0.1
Types: float
start_rows:
Optional Argument.
Specifies the number of rows at the beginning of the time series that
the function "skips" before it begins the calculation of the
exponential moving average. The function uses the arithmetic average
of these rows as the initial value of the exponential moving average.
The value n must be an integer.
Default Value: 2
Types: int
include_first:
Optional Argument.
Specifies whether to include the starting rows in the output table.
If you specify "true", the output columns for the starting rows
contain NULL, because their exponential moving average is undefined.
Default Value: False
Types: bool
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 ExponentialMovAvg.
Output teradataml DataFrames can be accessed using attribute
references, such as ExponentialMovAvgObj.<attribute_name>.
Output teradataml DataFrame attribute name is:
result
RAISES:
TeradataMlException
EXAMPLES:
# Load Example Data
load_example_data("movavg", "ibm_stock")
# Create teradataml DataFrame objects.
ibm_stock = DataFrame.from_table("ibm_stock")
# Example - Compute the exponential moving average
ExponentialMovAvg_out = ExponentialMovAvg(data = ibm_stock,
data_partition_column = ["name"],
data_order_column = ["period"],
target_columns = ["stockprice"],
start_rows = 10,
include_first = True
)
# Print the results
print(ExponentialMovAvg_out)
- __repr__(self)
- Returns the string representation for a ExponentialMovAvg 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.
|