TD_KNN Syntax Elements - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905
IDColumn
[Required] Specify the column name that uniquely identifies a data object in the training and the test table. Each entry in the column must be unique, or else an error is displayed.
InputColumns
[Required] Specify the training table column names that the function uses to compute the distance between a test object and a training object. The test table must also have the same training table column names.
ModelType
[Optional] Specify the model type for the KNN function.
Accepted Values: Regression, Classification, or Neighbors.
Default Value: Classification
K
[Optional] Specify the number of nearest neighbors to use in the algorithm. Select any positive integer value greater than 0 or less than or equal to 100.
Default Value: 5
Accumulate
[Optional] Specify the test table column names to copy to the output table.
ResponseColumn
[Required for the Regression or Classification model type] Specify the training table column name that contains the numeric response variable values used for prediction in KNN-based regression or classification.
The class labels under the Response column must be numeric.
Invalid for the Neighbors model type.
VotingWeight
[Optional for the Regression or Classification model type] Specify the voting weight of the training object to determine the test object class as a function of the distance between the training and the test object.
The weighted voting score is calculated as w=1/power(distance, voting_weight), where distance is the distance between the test object and the training object. The voting_weight value must be a non-negative real number.
Default Value: 0
Tolerance
[Optional] Specify the tolerance value to define the smallest distance.
The weight (w=1/POWER(distance, voting_weight)) is undefined if the distance is zero and a non-zero voting_weight is used.
For any distance less than the specified tolerance, the weight is calculated as w=1/POWER(tolerance, voting_weight).
Default Value: 0.0000001
OutputProb
[Optional for the Classification model type] Specify whether you want to return the probability of each response specified in the Responses argument. If the Responses argument is not specified, then the function returns the probability of the predicted response when it is set to True.
Default Value: False
Invalid for the Regression or the Neighbors model type
Responses
[Optional when the OutputProb argument is True] Specify the class labels for returning probabilities. The class labels is transformed to integer values only.
The max value is 1000.
EmitNeighbors
[Optional for the Classification or Regression model type] Specify whether to display neighbors in the output. The default value is True for the Neighbors model type, or you can manually set the value to True. However, you cannot set the value to False for the Neighbors model type.
The default value for the Classification or the Regression model type is False.
EmitDistances
[Optional] Specify whether to display the neighbor distances in the output.
Default value: False