Teradata R Package Function Reference - 16.20 - Attribution - Teradata R Package

Teradata® R Package Function Reference

prodname
Teradata R Package
vrm_release
16.20
created_date
February 2020
category
Programming Reference
featnum
B700-4007-098K

Description

The Attribution td_attribution_sqle function is used in web page analysis, where it lets companies assign weights to pages before certain events, such as buying a product.

Usage

  td_attribution_sqle (
      data = NULL,
      data.optional = NULL,
      conversion.data = NULL,
      excluding.data = NULL,
      optional.data = NULL,
      model1.type = NULL,
      model2.type = NULL,
      event.column = NULL,
      timestamp.column = NULL,
      window.size = NULL,
      data.partition.column = NULL,
      data.optional.partition.column = NULL,
      data.order.column = NULL,
      data.optional.order.column = NULL,
      conversion.data.order.column = NULL,
      excluding.data.order.column = NULL,
      optional.data.order.column = NULL,
      model1.type.order.column = NULL,
      model2.type.order.column = NULL
  )

Arguments

data

Required Argument.
Specifies the tbl_teradata that contains the click stream data, which the function uses to compute attributions.

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)

data.optional

Optional Argument.
Specifies the tbl_teradata that contains the click stream data, which cogroup attributes from all specified tbl_teradata.

data.optional.partition.column

Optional Argument. Required if data.optional is specified.
Specifies Partition By columns for data.optional.
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.optional.order.column

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

conversion.data

Required Argument.
Specifies the conversion events. Each conversion.event is a string or integer.

conversion.data.order.column

Optional Argument.
Specifies Order By columns for conversion.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)

excluding.data

Optional Argument.
Specifies the names of the input tbl_teradata that contains one varchar column (excluding.events) containing values of excluding cause event.

excluding.data.order.column

Optional Argument.
Specifies Order By columns for excluding.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)

optional.data

Optional Argument.
Specifies the names of the input tbl_teradata contains one varchar column (optional.events) containing values of optional cause event.

optional.data.order.column

Optional Argument.
Specifies Order By columns for optional.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)

model1.type

Required Argument.
Specifies the tbl_teradata that defines the type and distributions of the first model.
For example:
model1.data ("EVENT_REGULAR", "email:0.19:LAST_CLICK:NA", "impression:0.81:WEIGHTED:0.4,0.3,0.2,0.1")

model1.type.order.column

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

model2.type

Optional Argument.
Specifies the tbl_teradata that defines the type and distributions of the second model.
For example:
model2.data ("EVENT_OPTIONAL", "OrganicSearch:0.5:UNIFORM:NA", "Direct:0.3:UNIFORM:NA", "Referral:0.2:UNIFORM:NA")

model2.type.order.column

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

event.column

Required Argument.
Specifies the name of the input column that contains the clickstream events.
Types: character

timestamp.column

Required Argument.
Specifies the name of the input column that contains the timestamps of the clickstream events.
Types: character

window.size

Required Argument.
Specifies how to determine the maximum window size for the attribution calculation:

  • rows:K: Considers the maximum number of events to be attributed, excluding events of types specified in excluding_event_table, which means assigning attributions to atmost K effective events before the current impact event.

  • seconds:K: Consider the maximum time difference between the current impact event and the earliest effective event to be attributed.

  • rows:K&seconds:K2: Consider both constraints and comply with the stricter one.

Types: character

Value

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

Examples

    # Get the current context/connection
    con <- td_get_context()$connection
    
    # Load the data to run the example
    loadExampleData("attribution_example", "attribution_sample_table1", "attribution_sample_table2" , "conversion_event_table", "optional_event_table", "model1_table", "model2_table")
    
    # Create remote tibble objects.
    attribution_sample_table1 <- tbl(con, "attribution_sample_table1")
    attribution_sample_table2 <- tbl(con, "attribution_sample_table2")
    conversion_event_table <- tbl(con, "conversion_event_table")
    optional_event_table <- tbl(con, "optional_event_table")
    model1_table <- tbl(con, "model1_table")
    model2_table <- tbl(con, "model2_table")
    
    # This example uses models to assign attribution weights to events (conversion,           
    # optional and excluding).
    td_attribution_out <- td_attribution_sqle(data=attribution_sample_table1,
                             data.partition.column="user_id",
                             data.order.column="time_stamp",
                             data.optional=attribution_sample_table2,
                             data.optional.partition.column='user_id',
                             data.optional.order.column='time_stamp',
                             event.column="event",
                             conversion.data=conversion_event_table,
                             optional.data=optional_event_table,
                             timestamp.column = "time_stamp",
                             window.size = "rows:10&seconds:20",
                             model1.type=model1_table,
                             model2.type=model2_table
                             )