KnnClassifier constructor
KnnClassifier(})
Parameters:
trainData
Labelled observations. Must contain targetName
column.
targetName
A string that serves as a name of the column containing
outcomes.
k
A number of nearest neighbours to be found among trainData
kernel
A kernel function that will be used to predict an outcome for a
new observation
distance
A way to measure a distance between two observation vectors
dtype
A data type for all the numeric values, used by the algorithm.
Default value is DType.float32
Implementation
factory KnnClassifier(
DataFrame trainData,
String targetName,
int k, {
KernelType kernel = KernelType.gaussian,
Distance distance = Distance.euclidean,
String classLabelPrefix = 'Class label',
DType dtype = dTypeDefaultValue,
}) =>
initKnnClassifierModule().get<KnnClassifierFactory>().create(
trainData,
targetName,
k,
kernel,
distance,
classLabelPrefix,
dtype,
);