View source: R/ordinalFunctions.R
genDat | R Documentation |
Given the parameters, the function creates a dataset for testing the ordinal functionality of the package. The data is samples from multivariate Gaussians with different means, where the mean varies along a sinusoidal curve w.r.t. the class label.
genDat(numClasses, numObsPerClass, mu, sigma)
numClasses |
Positive integer specifying the number of classes for the dataset. |
numObsPerClass |
Number of observations sampled per class. |
mu |
Mean of the first class. |
sigma |
2 by 2 covariance matrix |
This function is used to demonstrate the usage of the ordinal classifier.
genDat
Returns a list with the following attributes:
A matrix with two columns and numObsPerClass
*numClasses
rows.
Labels for the rows of X
.
Gudmundur Einarsson
ordASDA
set.seed(123)
# You can play around with these values to generate some 2D data to test one
numClasses <- 15
sigma <- matrix(c(1,-0.2,-0.2,1),2,2)
mu <- c(0,0)
numObsPerClass <- 5
# Generate the data, can access with train$X and train$Y
train <- accSDA::genDat(numClasses,numObsPerClass,mu,sigma)
test <- accSDA::genDat(numClasses,numObsPerClass*2,mu,sigma)
# Visualize it, only using the first variable gives very good separation
plot(train$X[,1],train$X[,2],col = factor(train$Y),asp=1,main="Training Data")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.