function mdl = fitcknn(X,Y,varargin)
%FITCKNN Fit KNN classification model
%   MDL = FITCKNN(TBL,RESPONSEVARNAME)
%   MDL = FITCKNN(TBL,FORMULA)
%   MDL = FITCKNN(TBL,Y)
%   MDL = FITCKNN(X,Y)
%   MDL = FITCKNN(___,'PARAM1',val1,'PARAM2',val2,...)
%
%   Limitations:
%   1. The 'kdtree' nearest neighbor search algorithm is unsupported. By
%      default, the 'exhaustive' algorithm is used. You can specify the
%      name-value argument 'NSMethod' only as 'exhaustive'.
%   2) You cannot specify the name-value argument 'Distance' as a function
%      handle.
%
%   See also FITCKNN, GPUARRAY.

%   Copyright 2020-2022 The MathWorks, Inc.

% Validate the inputs.
narginchk(2,inf);
[X,Y,varargin{:}] = validateInputsForClassificationFitFunction(X,Y,varargin);

% Call underlying toolbox function.
mdl = parallel.internal.array.callToolboxFunction("stats/classreg/fitcknn", X, Y, varargin{:});
end