predictClass: Class prediction

Description Usage Arguments Value Author(s) Examples

View source: R/predictClass.R

Description

Use rosetta model to validate external dataset or reclassify the current dataset.

Usage

1
predictClass(dt, rules, discrete=FALSE, normalize = TRUE, normalizeMethod="rss", validate = FALSE, defClass)

Arguments

dt

A data frame of table where columns are features and rows are samples. Table should contain the same set of features as rules.

rules

A data frame of rule table in a form of main rosetta output.

discrete

Logical. If TRUE the dataset is discrete. Default is FALSE.

normalize

Logical. If FALSE normalization of votes is not performed. Default is TRUE.

normalizeMethod

A character containing votes normalization method: median, mean, max, rss (root sum square), rulnum (rule number). Default is rss.

validate

Logical. If TRUE, the accuracy is calculated. Default is FALSE.

defClass

A character vector containing known outcome. Required for accuracy calculation. Only if validate is TRUE.

Value

decisions$out

A data frame containing names of the objects, votes for each decision and predicted outcome.

decisions$accuracy

A numeric value containing the model accuracy. Only if validate is TRUE.

Author(s)

Mateusz Garbulowski

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(R.ROSETTA)
set.seed(1)

out <- rosetta(autcon)
rules <- out$main

# default settings
decisions <- predictClass(autcon, rules)

# change normalization method
decisions <- predictClass(autcon, rules, normalize = TRUE, normalizeMethod = "median")

# calculate accuracy if the decision is known
autconClass <- autcon$decision
decisions <- predictClass(autcon, rules, validate = TRUE, defClass = autconClass)

mategarb/R.ROSETTA documentation built on Aug. 20, 2020, 5:21 a.m.