Description Usage Arguments Value Details Author(s) Examples
A function for performing leaveoneout crossvalidation for a given embedding model, that allows users to determine the optimal number of embedding dimensions for
their algorithmofchoice. This function produces foldwise crossvalidated misclassification rates for standard embedding techniques across a specified selection of
embedding dimensions. Optimal embedding dimension is selected as the dimension with the lowest average misclassification rate across all folds.
Users can optionally specify custom embedding techniques with proper configuration of alg.*
parameters and hyperparameters.
Optional classifiers implementing the S3 predict
function can be used for classification, with hyperparameters to classifiers for
determining misclassification rate specified in classifier.*
.
1 2 3 4 
X 

Y 

rs 

alg 
the algorithm to use for embedding. Should be a function that accepts inputs 
sets 
a userdefined crossvalidation set. Defaults to

alg.dimname 
the name of the parameter accepted by 
alg.opts 
the hyperparameter options to pass to your algorithm as a keyworded list. Defaults to 
alg.embedding 
the attribute returned by

alg.structured 
a boolean to indicate whether the embedding matrix is structured. Provides performance increase by not having to compute the embedding matrix

classifier 
the classifier to use for assessing performance. The classifier should accept 
classifier.opts 
any extraneous options to be passed to the classifier function, as a list. Defaults to an empty list. 
classifier.return 
if the return type is a list,

k 
the crossvalidated method to perform. Defaults to

rank 
whether to force the training set to lowrank. Defaults to

... 
trailing args. 
Returns a list containing:

the results, as a dataframe, of the perfold classification accuracy. 

the results, as a dataframe, of the average classification accuracy for each 

the classification error of the optimal 
.

the optimal number of embedding dimensions from 
.

the model trained on all of the data at the optimal number of embedding dimensions. 

the classifier trained on all of the data at the optimal number of embedding dimensions. 
For more details see the help vignette:
vignette("xval", package = "lolR")
For extending crossvalidation techniques shown here to arbitrary embedding algorithms, see the vignette:
vignette("extend_embedding", package = "lolR")
For extending crossvalidation techniques shown here to arbitrary classification algorithms, see the vignette:
vignette("extend_classification", package = "lolR")
Eric Bridgeford
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  # train model and analyze with loo validation using lda classifier
library(lolR)
data < lol.sims.rtrunk(n=200, d=30) # 200 examples of 30 dimensions
X < data$X; Y < data$Y
# run crossvalidation with the nearestCentroid method and
# leaveoneout crossvalidation, which returns only
# prediction labels so we specify classifier.return as NaN
xval.fit < lol.xval.optimal_dimselect(X, Y, rs=c(5, 10, 15), lol.project.lol,
classifier=lol.classify.nearestCentroid,
classifier.return=NaN, k='loo')
# train model and analyze with 5fold validation using lda classifier
data < lol.sims.rtrunk(n=200, d=30) # 200 examples of 30 dimensions
X < data$X; Y < data$Y
xval.fit < lol.xval.optimal_dimselect(X, Y, rs=c(5, 10, 15), lol.project.lol, k=5)
# pass in existing crossvalidation sets
sets < lol.xval.split(X, Y, k=2)
xval.fit < lol.xval.optimal_dimselect(X, Y, rs=c(5, 10, 15), lol.project.lol, sets=sets)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.