data(qspr.data)
smis <- paste(qspr.data[,1])
ty <- qspr.data[,c(2,5)]
trainidx <- sample(1:nrow(qspr.data), 5000)
testidx <- (1:nrow(qspr.data))[-trainidx][1:100]
data(qsprpred_EG_5k)
## same as run => qsprpred_EG_5k <-
#-----arguments
#smis: SMILES string set (character vector) for training
#y: property sets (matrix) for training
#v_ymin: minimum value of target properties
#v_ymax: maximum value of target properties
#v_descriptor: function transforming SMILES strings to feature matrix
#v_fpnames: character vectors indicating finger print used in the descriptor
#w0: matrix representing prior mean of coeffients in linear regression model
#V0_inv: matrix representing the prior variance of coeffients in linear regression model
#a0: numeric value representing the location parameter in gamma prior
#b0: numeric value representing the shape parameter in gamma prior
#------
predictions <- qsprpred_EG_5k$qspr_predx(smis[testidx])
par(mfrow=c(1,2))
plot(predictions[[1]][1,], ty[testidx,1])
plot(predictions[[1]][2,], ty[testidx,2])
#computing the probability which the properties of test structures is in the target range
# set the minimal values in 2-d target properties
qsprpred_EG_5k$ymin <- c(100, 4)
# set the maximum values in 2-d target properties
qsprpred_EG_5k$ymin <- c(200, 5.5)
# method inverse_predx returns the probability that input SMILES has property in target range
qsprpred_EG_5k$inverse_predx("c1ccccc1O")
Run the code above in your browser using DataLab