kmeanspredict

Predicts target values for the test data points using parameters computed by kmeansFit function.

Syntax

predictions = kmeanspredict(parameters,X)

Inputs

X
Test data.
Type: double
Dimension: vector | matrix
parameters
Output of kmeansFit function.
Type: struct

Outputs

predictions
Predictions for the test data.
Type: double
Dimension: vector | matrix

Example

Usage of kmeanspredict with options

rand('seed', 2);
XTrain = rand(14, 5);
XTest 	= rand(2, 5);

options = struct;
options.n_clusters = 2;
parameters = kmeansfit(XTrain, options);
predictions = kmeanspredict(parameters, XTest);
> predictions
predictions = [Matrix] 1 x 2
1  1