Description Usage Arguments Details Value References Examples
View source: R/CompressedQDA.R
A wrapper function for the various QDA implementations available in this package.
Generates class predictions for TestData
.
1 2 |
TrainData |
A (n x p) numeric matrix without missing values consisting of n training samples each with p features. |
TrainCat |
A vector of length n consisting of group labels of the n training samples in |
TestData |
A (m x p) numeric matrix without missing values consisting of m training samples each with p features. The number of features must equal the number of features in |
Method |
A string of characters which determinds which version of QDA to use. Must be either "Full", "Compressed", or "Subsampled". |
Mode |
A string of characters which determines how the reduced sample paramters will be inputted for each method. Must be either "Research", "Interactive", or "Automatic". Default is "Automatic". |
m1 |
The number of class 1 compressed samples to be generated. Must be a positive integer. |
m2 |
The number of class 2 compressed samples to be generated. Must be a positive integer. |
m |
The number of total compressed samples to be generated. Must be a positive integer. |
s |
The sparsity level used in compression. Must satify 0 < s < 1. |
gamma |
A numeric value for the stabilization amount gamma * I added to the covariance matrixed used in the LDA decision rule. Default amount is 1E-5. Cannot be negative. |
Function which handles all implementations of LDA.
Predictions |
(m x 1) Vector of predicted class labels for the data points in |
Lapanowski, Alexander F., and Gaynanova, Irina. “Compressing large sample data for discriminant analysis” arXiv preprint arXiv:2005.03858 (2020).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | TrainData <- QDA_Data$TrainData
TrainCat <- QDA_Data$TrainCat
TestData <- QDA_Data$TestData
plot(TrainData[,2]~TrainData[,1], col = c("blue","orange")[as.factor(TrainCat)])
#----- Full QDA -------
QDA(TrainData = TrainData,
TrainCat = TrainCat,
TestData = TestData,
Method = "Full",
gamma = 1E-5)
#----- Compressed QDA -------
m1 <- 700
m2 <- 300
s <- 0.01
QDA(TrainData = TrainData,
TrainCat = TrainCat,
TestData = TestData,
Method = "Compressed",
Mode = "Research",
m1 = m1,
m2 = m2,
s = s,
gamma = 1E-5)
QDA(TrainData = TrainData,
TrainCat = TrainCat,
TestData = TestData,
Method = "Compressed",
Mode = "Automatic",
gamma = 1E-5)
#----- Sub-sampled QDA ------
m1 <- 700
m2 <- 300
QDA(TrainData = TrainData,
TrainCat = TrainCat,
TestData = TestData,
Method = "Subsampled",
Mode = "Research",
m1 = m1,
m2 = m2,
gamma = 1E-5)
QDA(TrainData = TrainData,
TrainCat = TrainCat,
TestData = TestData,
Method = "Subsampled",
Mode = "Automatic",
gamma = 1E-5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.