# knn

## Purpose

Creates a K-nearest-neighbour classifier.

## Synopsis

    net = knn(nin, nout, k, tr_in, tr_targets)

## Description

`net = knn(nin, nout, k, tr_in, tr_targets)` creates a KNN model `net` with input dimension `nin`, output dimension `nout` and `k` neighbours. The training data is also stored in the data structure and the targets are assumed to be using a 1-of-N coding.

The fields in `net` are

      type = 'knn'
      nin = number of inputs
      nout = number of outputs
      tr_in = training input data
      tr_targets = training target data

## See Also

`kmeans`, `knnfwd`

Pages: Index

Copyright (c) Ian T Nabney (1996-9)