1.0 - 8.00 - VectorDistance Example 2: Nondefault Thresholds - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Release Date
May 2019
Content Type
Programming Reference
Publication ID
B700-4003-098K
Language
English (United States)

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