knnregressorpredict
Predicts target values for the test data points using parameters computed by knnregressorfit function.
Attention: Available only with Twin Activate commercial edition.
Syntax
predictions = knnregressorpredict(parameters,X)
Inputs
- parameters
- Output of knnregressorfit function.
- X
- Test data.
Outputs
- predictions
- Predictions for the test data.
Example
Usage of knnregressorpredict
X = [0; 1; 2; 3];
y = [0; 0; 1; 1];
options = struct;
options.n_neighbors = 2;
parameters = knnregressorfit(X, y, options);
predictions = knnregressorpredict(parameters, [1.5]);
disp(predictions);
0.5
Comments
It performs regression based on K Nearest Neighbors algorithm. Once the neighbors are found, target is predicted using aggregation of nearest neighbors.