knntlClassification: knn transfer learning classification

Description Usage Arguments Value Author(s) See Also Examples

View source: R/machinelearning-functions-knntl.R

Description

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

Usage

1
2
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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

pRoloc documentation built on Nov. 8, 2020, 6:26 p.m.