| |
Methods defined here:
- __init__(self, data=None, target_columns=None, include_first=False, window_size=10, data_sequence_column=None, data_partition_column=None, data_order_column=None)
- DESCRIPTION:
The SimpleMovAvg function computes the simple moving average of points in a
series.
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)
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
window_size:
Optional Argument.
Specifies the number of previous values to include in the computation
of the simple moving average.
Default Value: 10
Types: int
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 SimpleMovAvg.
Output teradataml DataFrames can be accessed using attribute
references, such as SimpleMovAvgObj.<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")
# Compute the simple moving average for "stockprice".
SimpleMovAvg_out = SimpleMovAvg(data = ibm_stock,
data_partition_column = ["name"],
data_order_column = ["period"],
target_columns = ["stockprice"],
include_first = True,
window_size = 10
)
# Print the results
print(SimpleMovAvg_out)
- __repr__(self)
- Returns the string representation for a SimpleMovAvg 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.
|