knntlClassification {pRoloc} | R Documentation

## knn transfer learning classification

### Description

Classification using a variation of the KNN implementation of Wu and Dietterich's transfer learning schema

### Usage

    knntlClassification(primary, auxiliary, fcol = "markers", bestTheta, k,
      scores = c("prediction", "all", "none"), seed)

### Arguments

`primary` | An instance of class `"MSnSet"`.
`auxiliary` | An instance of class `"MSnSet"`.
`fcol` | The feature meta-data containing marker definitions. Default is `markers`.
`bestTheta` | Best theta vector as output from `knntlOptimisation`, see `knntlOptimisation` for details
`k` | Numeric vector of length 2, containing the best `k` parameters to use for the primary and auxiliary datasets. If k `k` is not specified it will be calculated internally.
`scores` | One of `"prediction"`, `"all"` or `"none"` to report the score for the predicted class only, for all classes or none.
`seed` | The optional random number generator seed.

### Value

A character vector of the classifications for the unknowns

### Author(s)

Lisa Breckels

### See Also

`knntlOptimisation`

### Examples

    library(pRolocdata)
    data(andy2011)
    data(andy2011goCC)
    ## reducing calculation time of k by pre-running knnOptimisation
    x <- c(andy2011, andy2011goCC)
    k <- lapply(x, function(z)
                knnOptimisation(z, times=5,
                                fcol = "markers.orig",
                                verbose = FALSE))
    k <- sapply(k, function(z) getParams(z))
    k
    ## reducing parameter search with theta = 1,
    ## weights of only 1 or 0 will be considered
    opt <- knntlOptimisation(andy2011, andy2011goCC,
                             fcol = "markers.orig",
                             times = 2,
                             by = 1, k = k)
    opt
    th <- getParams(opt)
    plot(opt)
    res <- knntlClassification(andy2011, andy2011goCC,
                               fcol = "markers.orig", th, k)
    res

[Package pRoloc version 1.22.2 Index]