# NOT RUN {
## Predictions for homogeneous networks
data(proteinInteraction)
idnew <- sample(nrow(Kmat_y2h_sc), 20)
trainY <- proteinInteraction[-idnew,-idnew]
trainK <- Kmat_y2h_sc[-idnew,-idnew]
testK <- Kmat_y2h_sc[idnew, - idnew]
mod <- tskrr(trainY, trainK, lambda = 0.1)
# Predict interaction between test vertices
predict(mod, testK, testK)
# Predict interaction between test and train vertices
predict(mod, testK)
predict(mod, g = testK)
## Predictions for heterogeneous networks
data("drugtarget")
idnewK <- sample(nrow(targetSim), 10)
idnewG <- sample(ncol(drugSim), 10)
trainY <- drugTargetInteraction[-idnewK, -idnewG]
trainK <- targetSim[-idnewK, -idnewK]
trainG <- drugSim[-idnewG, -idnewG]
testK <- targetSim[idnewK, -idnewK]
testG <- drugSim[idnewG, -idnewG]
mod <- tskrr(trainY, trainK, trainG, lambda = 0.01)
# Predictions for new targets on drugs in model
predict(mod, testK)
# Predictions for new drugs on targets in model
predict(mod, g = testG)
# Predictions for new drugs and targets
predict(mod, testK, testG)
# }
Run the code above in your browser using DataLab