knnclassifierpredict
Predicts target values for the test data points using parameters computed by knnClassifierFit function.
Attention: Available only with Twin Activate commercial edition.
Syntax
predictions = knnclassifierpredict(parameters,X)
predictions = knnclassifierpredict(parameters,X)
Inputs
- parameters
- Output of knnClassifierFit function.
- X
- Test data.
Outputs
- predictions
- Predictions for the test data.
Example
Usage of knnclassifierpredict
data = dlmread('digits.csv', ',');
X = data(:, 1:end-1);
y = data(:, end);
parameters = knnclassifierfit(X, y);
predictions = knnclassifierpredict(parameters, X);
> mean(predictions == y')
ans = 0.990539789