Teradata R Package Function Reference | 17.00 - 17.00 - ChangePointDetectionRT - Teradata R Package

Teradata® R Package Function Reference

prodname
Teradata R Package
vrm_release
17.00
created_date
September 2020
category
Programming Reference
featnum
B700-4007-090K

Description

The RtChangePointDetection function detects change points in a stochastic process or time series, using real-time change-point detection, implemented with these algorithms:

  1. Search algorithm: sliding window

  2. Segmentation algorithm: normal distribution

Usage

  td_changepoint_detection_rt_mle (
      data = NULL,
      data.partition.column = NULL,
      data.order.column = NULL,
      value.column = NULL,
      accumulate = NULL,
      segmentation.method = "normal_distribution",
      window.size = 10,
      threshold = 10,
      output.option = "CHANGEPOINT",
      data.sequence.column = NULL
  )

Arguments

data

Required Argument.
Specifies tbl_teradata object defining the input time series data.

data.partition.column

Required Argument.
Specifies Partition By columns for "data".
Values to this argument can be provided as a vector, if multiple columns are used for partition.
Types: character OR vector of Strings (character)

data.order.column

Required Argument.
Specifies Order By columns for "data".
Values to this argument can be provided as a vector, if multiple columns are used for ordering.
Types: character OR vector of Strings (character)

value.column

Required Argument.
Specifies the name of the input tbl_teradata column that contains the time series data.
Types: character

accumulate

Optional Argument.
Specifies the names of the input tbl_teradata columns to copy to the output tbl_teradata.
Note: To identify change points in the output tbl_teradata, specify the columns that appear in "data.partition.column" and "data.order.column".
Types: character OR vector of Strings (character)

segmentation.method

Optional Argument.
Specifies the segmentation method, normal distribution (in each segment, the data is in a normal distribution).
Default Value: "normal_distribution"
Permitted Values: normal_distribution
Types: character

window.size

Optional Argument.
Specifies the size of the sliding window. The ideal window size depends heavily on the data. You might need to experiment with this value.
Default Value: 10
Types: integer

threshold

Optional Argument.
Specifies a numeric value that the function compares to ln(L1)-ln(L0). The definition of Log(L1) and Log(L0) are in td_changepoint_detection_mle. They are the logarithms of L1 and L2.
Default Value: 10
Types: numeric

output.option

Optional Argument.
Specifies the output tbl_teradata columns.
Default Value: "CHANGEPOINT"
Permitted Values: changepoint, segment, verbose
Types: character

data.sequence.column

Optional Argument.
Specifies the vector 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: character OR vector of Strings (character)

Value

Function returns an object of class "td_changepoint_detection_rt_mle" which is a named list containing object of class "tbl_teradata".
Named list member can be referenced directly with the "$" operator using the name: result.

Examples

    # Get the current context/connection
    con <- td_get_context()$connection
    
    # Load example data.
    loadExampleData("changepointdetectionrt_example", "cpt")

    # Create object(s) of class "tbl_teradata".
    cpt <- tbl(con, "cpt")

    # Example 1: ChangePointThreshold 10, Window Size 3, Default Output.
    td_changepoint_detection_rt_out1 <- td_changepoint_detection_rt_mle(data = cpt ,
                                                                 data.partition.column = c("sid"),
                                                                 data.order.column = c("id"),
                                                                 value.column = "val",
                                                                 accumulate = c("sid","id"),
                                                                 window.size = 3,
                                                                 threshold = 10
                                                                 )

    # Example 2: ChangePointThreshold 20, Window Size 3, VERBOSE Output.
    td_changepoint_detection_rt_out2 <- td_changepoint_detection_rt_mle(data = cpt,
                                                                 data.partition.column = c("sid"),
                                                                 data.order.column = c("id"),
                                                                 value.column = "val",
                                                                 accumulate = c("sid","id"),
                                                                 window.size = 3,
                                                                 threshold = 20,
                                                                 output.option = "verbose"
                                                                 )