Skip to content

Instantly share code, notes, and snippets.

Last active April 6, 2020 05:54
What would you like to do?
# Define targets and augment data
target <- model.matrix(~0+species)
targetTrain <-"rbind", lapply(1:(dim(Xtrain)[1]/length(fnamesTrain)),
function(x) target[-c(valIdx, testIdx),]))
targetVal <-"rbind", lapply(1:(dim(Xval)[1]/length(fnamesVal)),
function(x) target[valIdx,]))
targetTest <-"rbind", lapply(1:(dim(Xtest)[1]/length(fnamesTest)),
function(x) target[testIdx,]))
# Assemble Xs and Ys
train <- list(X = Xtrain, Y = targetTrain)
val <- list(X = Xval, Y = targetVal)
test <- list(X = Xtest, Y = targetTest)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment