Description
The HMMSupervisedLearner function is available on SQL-Graph platform. The function can produce multiple HMM models simultaneously, where each model is learned from a set of sequences and where each sequence represents a vertex.
Usage
td_hmm_supervised_mle (
vertices = NULL,
model.key = NULL,
sequence.key = NULL,
observed.key = NULL,
state.key = NULL,
skip.key = NULL,
batch.size = NULL,
vertices.sequence.column = NULL,
vertices.partition.column = NULL,
vertices.order.column = NULL
)
Arguments
vertices |
Required Argument. |
vertices.partition.column |
Required Argument. 1. This argument must contain the name of the column
specified in "sequence.key" argument. 2. This argument should contain the name of the column
specified in "model.key", if "model.key" argument is
used, and it must be the first column followed by the
name of the column specified in "sequence.key". |
vertices.order.column |
Required Argument. |
model.key |
Optional Argument. |
sequence.key |
Required Argument. |
observed.key |
Required Argument. |
state.key |
Required Argument. |
skip.key |
Optional Argument. |
batch.size |
Optional Argument. |
vertices.sequence.column |
Optional Argument. |
Value
Function returns an object of class "td_hmm_supervised_mle" which is a
named list containing objects of class "tbl_teradata".
Named list members can be referenced directly with the "$" operator
using following names:
output.initialstate.table
-
output.statetransition.table
output.emission.table
output
Examples
# Get the current context/connection
con <- td_get_context()$connection
# Load example data.
loadExampleData("hmmsupervised_example", "customer_loyalty")
# Create object(s) of class "tbl_teradata".
customer_loyalty <- tbl(con, "customer_loyalty")
# Example 1 - Train a td_hmm_supervised_mle() function on the customer loyalty dataset
td_hmm_supervised_out <- td_hmm_supervised_mle(vertices = customer_loyalty,
vertices.partition.column = c("user_id", "seq_id"),
vertices.order.column = c("user_id", "seq_id",
"purchase_date"),
model.key = "user_id",
sequence.key = "seq_id",
observed.key = "observation",
state.key = "loyalty_level"
)