# NOT RUN {
X1=matrix(c(1,0,0,0,0, 0,1,0,0,0, 0,0,1,1,0, 0,0,0,0,1, 1,0,0,0,0),byrow=TRUE,nrow=5,ncol=5)
X2=matrix(c(0,1,0,1,1, 1,0,0,1,0, 0,1,0,1,1, 0,0,0,0,1, 0,0,1,0,0),byrow=TRUE,nrow=5,ncol=5)
X2_=matrix(c(0,1,0,1,1, 1,0,0,1,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,1,0,0),byrow=TRUE,nrow=5,ncol=5)
X=list(t(X1),t(X2),t(X2_))
N=nrow(X1)
Xs=list()
for(s in 1:length(X)){
aa=which(X[[s]]==1,arr.ind=TRUE)
Xs[[s]]=Matrix::sparseMatrix(x=rep(1,nrow(aa)),i=aa[,1],j=aa[,2],dims=c(N,N))
}
print(Xs)
rf=rescal(Xs,2)
A=rf$A
R=rf$R
tmp=rescal_01(Xs,A,R,scale_fact=1.5)#generate 1.5*original number of triples
print(sprintf('Precision:%.4f, Recall:%.4f',tmp$tp/(tmp$tp+tmp$fp),tmp$tp/(tmp$tp+tmp$fn)))
# }
Run the code above in your browser using DataCamp Workspace