data(plane)
# Build the training data
Mirage <- plane$plane1[, 1:25, 1, drop = FALSE]
Eurofighter <- plane$plane3[, 1:25, 1, drop = FALSE]
trainingData <- list(group1 = Mirage,
group2 = Eurofighter)
# Build the test data
Mirage.t <- plane$plane1[, 26:30, 1, drop = FALSE]
Eurofighter.t <- plane$plane3[, 26:30, 1, drop = FALSE]
testData <- abind::abind(Mirage.t, Eurofighter.t, along = 2)
# Transform the data into distSpace
Result <- distSpace(trainingData = trainingData, testData = testData, type="fbd")
# Plot the results
plotColors <- c(rep("orange", dim(Mirage)[2]),
rep("blue", dim(Eurofighter)[2]),
rep("green3", dim(testData)[2]))
plot(Result[, 1:2, ],
col = plotColors, pch=16,
xlab = "distance to Mirage", ylab = "distance to Eurofighter",
main = "distSpace representation of Mirage and Eurofighter")
legend("bottomleft", legend = c("Mirage","Eurofighter", "test data"), pch = 16,
col = c("orange","blue", "green3"))
Run the code above in your browser using DataLab