multiAdaSampling: multi Adaptive Sampling function

Description Usage Arguments Value Author(s) Examples

View source: R/multiAdaSampling.R

Description

Performs multiple adaptive sampling to train a classifier model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
multiAdaSampling(
  data,
  label,
  reducedDimName = NULL,
  classifier = "svm",
  percent = 1,
  L = 10,
  prob = FALSE,
  balance = TRUE,
  iter = 3
)

Arguments

data

A dimension reduced matrix from matPCs.

label

A vector of label information for each sample.

reducedDimName

A name of the reducedDim to use. This must be specified if data is a SingleCellExperiment object.

classifier

Base classifier model, either "SVM" (svm) or "RF" 'rf' is supported.

percent

Percentage of samples to select at each iteration.

L

Number of ensembles. Default to 10.

prob

logical flag to return sample's probabilities to each class.

balance

logical flag to if the cell types are balanced. If FALSE, down sample large cell types classes to the median of all class sizes.

iter

A number of iterations to perform adaSampling.

Value

A final prediction, probabilities for each cell type and the model are returned as a list.

Author(s)

Pengyi Yang, Taiyun Kim

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(SingleCellExperiment)

# Loading the data
data("gse87795_subset_sce")

mat.expr <- gse87795_subset_sce
cellTypes <- gse87795_subset_sce$cellTypes

# Get dimension reduced matrix. We are using `logNorm` assay from `mat.expr`.
reducedDim(mat.expr, "matPCs") <- matPCs(mat.expr, assay = "logNorm")

# Here we are using Support Vector Machine as a base classifier.
result <- multiAdaSampling(mat.expr, cellTypes, reducedDimName = "matPCs", 
classifier = "svm", percent = 1, L = 10)

SydneyBioX/scReClassify documentation built on Oct. 6, 2021, 5:34 a.m.