# Draw some data
X1 <- matrix(rnorm(1000), ncol = 10)
X2 <- matrix(rnorm(1000, mean = 0.5), ncol = 10)
y1 <- rbinom(100, 1, 1 / (1 + exp(1 - X1 %*% rep(0.5, 10))))
y2 <- rbinom(100, 1, 1 / (1 + exp(1 - X2 %*% rep(0.7, 10))))
X1 <- data.frame(X = X1, y = y1)
X2 <- data.frame(X = X2, y = y2)
if(requireNamespace("rpart", quietly = TRUE)) {
# Calculate all three similarity measures (without tuning the trees due to runtime)
NKT(X1, X2, "y", method = 1, tune = FALSE)
NKT(X1, X2, "y", method = 2, tune = FALSE)
NKT(X1, X2, "y", method = 3, tune = FALSE)
}
Run the code above in your browser using DataLab