VectorDistance Example 2: Nondefault Thresholds - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.ditaval
dita:id
lmf1502735330121
Product Category
Teradata Vantage

This example uses the MaxDistance argument to limit the output to target vectors within the specified distances for each measure.

SQL Call

SELECT * FROM VectorDistance (
  ON target_mobile_data AS target PARTITION BY UserID
  ON ref_mobile_data AS ref DIMENSION
  USING
  TargetIDColumns ('UserID')
  TargetFeatureColumn ('Feature')
  TargetValueColumn ('value1')
  DistanceMeasure ('Cosine', 'Euclidean', 'Manhattan')
  MaxDistance (0.03, 0.8, 1.0)
) AS dt ORDER BY target_userid;

Output

Only UserID 2 and UserID 3 meet the threshold criteria.

target_userid ref_userid type distance
2 5 cosine 0.0260892301077248
2 5 euclidean 0.524309064791334
2 5 manhattan 0.729999989271164
3 5 cosine 0.0241505454220814
3 5 euclidean 0.452658810804166
3 5 manhattan 0.669999986886978