Structured kNN
Structured k-nearest neighbours (SkNN) is a machine learning algorithm that generalizes k-nearest neighbors (k-NN).[src] k-NN supports binary classification, multiclass classification, and regression, whereas SkNN allows training of a classifier for general structured output.[src] For instance, a data sample might be a natural language sentence, and the output could be an annotated parse tree.[src] Training a classifier consists of showing many instances of ground truth sample-output pairs.[src] After training, the SkNN model is able to predict the corresponding output for new, unseen sample instances; that is, given a natural language sentence, the classifier can produce the most likely parse tree.[src]
Structured k-nearest neighbours (SkNN) is a machine learning algorithm that generalizes k-nearest neighbors (k-NN).[src] k-NN supports binary classification, multiclass classification, and regression, whereas SkNN allows training of a classifier for general structured output.[src] For instance, a data sample might be a natural language sentence, and the output could be an annotated parse tree.[src] Training a classifier consists of showing many instances of ground truth sample-output pairs.[src] After training, the SkNN model is able to predict the corresponding output for new, unseen sample instances; that is, given a natural language sentence, the classifier can produce the most likely parse tree.[src] ==Training== As a training set, SkNN accepts sequences of elements with class labels.[src] The type of element does not matter; the only requirement is a defined metric function that gives a distance between each pair of elements of a set.[src] SkNN is based on idea of creating a graph, with each node representing a class label.[src] There is an edge between a pair of nodes if there is a sequence of two elements in the training set with corresponding classes.[src] The first step of SkNN training is the construction of such a graph from training sequences.[src] There are two special nodes in the graph corresponding to sentence beginnings and ends: if a sequence starts with class C, the edge between node START and node C should be created.[src] Like regular k-NN, the second part of SkNN training consists of storing the elements of a training sequence in a certain way.[src] Each element of the training sequences is stored in the node related to the class of the previous element in the sequence.[src] Every first element is stored in the START node.[src] ==Inference== Labelling input sequences by SkNN consists of finding the sequence of transitions in the graph, starting from node START.[src] Each transition corresponds to a single element of the input sequence.[src] As a result, the label of each element is determined as the target node label of the transition.[src] The cost of the path is defined as the sum of all transitions, with the cost of transition from node A to node B being the distance from the current input sequence element to the nearest element of class B, stored in node A.[src] Determining an optimal path may be performed using a modified Viterbi algorithm (where the sum of the distances is minimized, unlike the original algorithm which maximizes the product of probabilities).[src] ==References== ==External links== Implementation examples[src]
25 sentences · 25 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Structured kNN." encyclopegia.org, 2025, https://encyclopegia.org/wiki/structured-knn. Accessed 27 November 2026.
Chicago
"Structured kNN." encyclopegia.org. Accessed November 27, 2026. https://encyclopegia.org/wiki/structured-knn.
APA
encyclopegia.org. (2025). Structured kNN. Retrieved November 27, 2026, from https://encyclopegia.org/wiki/structured-knn
Accessed November 27, 2026 · CC BY-SA 4.0 · citation page · JSON