Skip to content

Train Regressor (K-Nearest Neighbours) Node

AI/ML/Regression

Fit a K-Nearest-Neighbours regressor that averages the target of the nearest training rows. Non-parametric and instance based: the fitted model embeds a verbatim copy of the whole training set instead of learned coefficients, so every training row (and any personal data in it) travels with the model, is written into every saved model file and can be reconstructed by anyone holding it. Treat the model with the same care as the source table.

fit_knn_regressorml
Inputs4
Outputs2
Security exposure3/10
Packageml

Ratings

Scores range from 0 to 10. Higher values mean more impact, exposure, or operational weight.

SecurityAttack surface and exposure impact.
3/10Low
PrivacyPotential sensitivity of processed data.
2/10Low
PerformanceRuntime or resource pressure.
4/10Medium
GovernancePolicy, audit, or compliance impact.
2/10Low
ReliabilityOperational stability considerations.
7/10High
CostExternal or compute cost impact.
4/10Medium

Input Pins

4

Input

Execution
exec_in

Execution trigger that begins KNN training

Data Source

String
source

Choose which backend supplies the training data

Default Database
Database

Neighbours (k)

Integer
k

How many nearest training rows are averaged for each prediction. Must be at least 1 and cannot exceed the number of training rows. Larger values smooth the response.

Default 5
Range 1 to 1000

Distance Weighted

Boolean
distance_weighted

Weight each neighbour by the inverse of its distance instead of taking a plain mean. Reduces the pull of distant neighbours when k is large.

Default false

Output Pins

2

Done

Execution
exec_out

Activated once the training set has been validated and embedded

Model

Struct
model

Thread-safe handle to the trained KNN regressor. Contains a full copy of the training set.

NodeMLModelNodeMLModel1 fields
model_refstringrequired
Schema enforced

Node Info

Internal name
fit_knn_regressor
Category
AI/ML/Regression