knnClassification {pRoloc} | R Documentation

## knn classification

### Description

Classification using for the k-nearest neighbours algorithm.

### Usage

    knnClassification(object, assessRes, scores = c("prediction", "all",
      "none"), k, fcol = "markers", ...)

### Arguments

`object` | An instance of class `"MSnSet"`.
`assessRes` | An instance of class `"GenRegRes"`, as generated by `knnOptimisation`.
`scores` | One of `"prediction"`, `"all"` or `"none"` to report the score for the predicted class only, for all classes or none.
`k` | If `assessRes` is missing, a `k` must be provided.
`fcol` | The feature meta-data containing marker definitions. Default is `markers`.
`...` | Additional parameters passed to `knn` from package `class`.

### Value

An instance of class `"MSnSet"` with `knn` and `knn.scores` feature variables storing the classification results and scores respectively.

### Author(s)

Laurent Gatto

### Examples

    library(pRolocdata)
    data(dunkley2006)
    ## reducing parameter search space and iterations
    params <- knnOptimisation(dunkley2006, k = c(3, 10), times = 3)
    params
    plot(params)
    f1Count(params)
    levelPlot(params)
    getParams(params)
    res <- knnClassification(dunkley2006, params)
    getPredictions(res, fcol = "knn")
    getPredictions(res, fcol = "knn", t = 0.75)
    plot2D(res, fcol = "knn")

[Package pRoloc version 1.34.0 Index]