Description
The VectorDistance function takes a tbl_teradata object of target vectors and a tbl_teradata object of reference vectors and returns the distance between each target-reference pair present in the two objects.
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,
target.data.order.column = NULL,
ref.data.order.column = NULL
)
Arguments
target.data |
Required Argument. |
target.data.partition.column |
Required Argument. |
target.data.order.column |
Optional Argument. |
ref.data |
Required Argument. |
ref.data.order.column |
Optional Argument. |
target.id |
Required Argument. |
target.feature |
Required Argument. |
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. |
ref.data.sequence.column |
Optional Argument. |
Value
Function returns an object of class "td_vector_distance_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("vectordistance_example", "target_mobile_data", "ref_mobile_data")
# Create object(s) of class "tbl_teradata".
target_mobile_data <- tbl(con, "target_mobile_data")
ref_mobile_data <- tbl(con, "ref_mobile_data")
# Example 1 - 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 2 - 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)
)