Description
The VectorDistance (td_vector_distance_mle
) function takes a tbl_teradata of target vectors
and a tbl_teradata of reference vectors and returns a tbl_teradata
that contains the distance between each target-reference pair.
Usage
td_vector_distance_mle ( target.data = NULL, ref.data = NULL, target.id = NULL, target.feature = NULL, target.value = NULL, ref.id = NULL, ref.feature = NULL, ref.value = NULL, reftable.size = "small", distance.measure = "cosine", ignore.mismatch = TRUE, replace.invalid = "positiveinfinity", top.k = 2147483647, max.distance = NULL, target.data.sequence.column = NULL, ref.data.sequence.column = NULL, target.data.partition.column = NULL )
Arguments
target.data |
Required Argument. |
target.data.partition.column |
Required Argument. |
ref.data |
Required Argument. |
target.id |
Required Argument. |
target.feature |
Required Argument.
Specifies the name of the column that contains the target vector
feature name (for example, the axis of a 3-D vector). |
target.value |
Optional Argument. |
ref.id |
Optional Argument. |
ref.feature |
Optional Argument. |
ref.value |
Optional Argument. |
reftable.size |
Optional Argument. |
distance.measure |
Optional Argument. |
ignore.mismatch |
Optional Argument. |
replace.invalid |
Optional Argument. |
top.k |
Optional Argument. |
max.distance |
Optional Argument. |
target.data.sequence.column |
Optional Argument. Specifies the vector of column(s) that uniquely identifies each row of the input argument "target.data". The argument is used to ensure deterministic results for functions which produce results that vary from run to run. |
ref.data.sequence.column |
Optional Argument. |
Value
Function returns an object of class "td_vector_distance_mle" 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 example data. loadExampleData("vectordistance_example", "target_mobile_data", "ref_mobile_data") # Create remote tibble objects. target_mobile_data <- tbl(con, "target_mobile_data") ref_mobile_data <- tbl(con, "ref_mobile_data") # Example - Using the default ("cosine") distance measure with no threshold. td_vector_distance_out <- td_vector_distance_mle(target.data = target_mobile_data, target.data.partition.column = c("userid"), ref.data = ref_mobile_data, target.id = c("userid"), target.feature = "feature", target.value = "value1" ) # Example - Using three distance measures with corresponding thresholds (max.distance). td_vector_distance_out1 <- td_vector_distance_mle(target.data = target_mobile_data, target.data.partition.column = c("userid"), ref.data = ref_mobile_data, target.id = c("userid"), target.feature = "feature", target.value = "value1", distance.measure = c("Cosine","Euclidean","Manhattan"), max.distance = c(0.03,0.8,1.0) )