Training: Training

Description Usage Arguments Details Value See Also Examples

View source: R/Training.R

Description

This function trains a shrinkage discriminant analysis (sda) classifier using James-Stein-type shrinkage estimation. It returns the trained model and a data.frame describing the features used for the model.

Usage

1
Training(abt, labs, feats, n_max = 200, diag = FALSE, verb = FALSE)

Arguments

abt

num matrix containing training data with rows as observations and columns as features

labs

vector defining class labels of rows in training data

feats

data.frame with columns name and value which identifies the features (columns) of abt with chr values

n_max

int (=200) maximum number of features to use for the model. Features will be chosen by correlation adjusted t scores.

diag

bool (=FALSE) if true DDA instead of LDA is done

verb

bool (=FALSE) verbose, if true sda training messages will be printed

Details

The sda package is used for training and ranking of a sda classifier. Shrinkage intensity for correlation matrix, variances, and frequencies is estimated from the data. With diag set to TRUE only the diagonal of the covariance matrix is used. This speeds up the process and uses less memory.

A maximum number of features for the model can be set with n_max. This can also be used to set a limit to speed and memory for the process. Features are ranked by correlation adjusted t scores and only the top n_max will be used for the model.

Value

list of 2 objects

See Also

Other machine learning: CV, Convert, FeatureExtraction, Prediction

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
abt1 <- matrix(sample(0:1, 1000*100, replace = TRUE), 1000, 100)
feats1 <- data.frame(name = "test", value = 1:100)
labs1 <- sample(0:1, 1000, replace = TRUE)
model <- Training(abt1, labs1, feats1, n_max = 20)
str(model)
abt2 <- matrix(sample(0:1, 1000*100, replace = TRUE), 1000, 100)
feats2 <- data.frame(name = "test", value = 100:1)
labs2 <- sample(0:1, 1000, replace = TRUE)
pred <- Prediction(model$Model, abt2, feats2, model$FeatureList)
str(pred)
sum(pred$class == labs2)

mRcSchwering/abacus documentation built on May 21, 2019, 9:18 a.m.