knnnode properties
Last updated: Feb 11, 2025
The k-Nearest Neighbor (KNN) node associates a new case with the category
or value of the k objects nearest to it in the predictor space, where k is an integer.
Similar cases are near each other and dissimilar cases are distant from each other.
Example
node = stream.create("knn", "My node")
# Objectives tab
node.setPropertyValue("objective", "Custom")
# Settings tab - Neighbors panel
node.setPropertyValue("automatic_k_selection", False)
node.setPropertyValue("fixed_k", 2)
node.setPropertyValue("weight_by_importance", True)
# Settings tab - Analyze panel
node.setPropertyValue("save_distances", True)
Properties |
Values | Property description |
---|---|---|
|
|
|
|
|
|
|
flag | |
|
flag | Check box to enable next option. |
|
field | |
|
flag | Check box to enable next option. |
|
field | |
|
flag | |
|
integer | Enabled only if is . |
|
integer | Enabled only if is . |
|
integer | |
|
|
|
|
flag | |
|
|
|
|
flag | |
|
[field1 ... fieldN] | |
|
flag | |
|
integer | |
|
number | |
|
flag | |
|
integer | Enabled only if is
|
|
flag | |
|
number | |
|
field | Enabled only if is
|
|
flag | |
|
flag | |
|
flag | |
|
flag | |
|
|
Was the topic helpful?
0/1000