RDFTensor (version 1.3)

rescal_Trp_Val: RESCAL scores of triples

Description

Calculate score values corresponding to triples in tensor from RESCAL factorization.

Usage

rescal_Trp_Val(R, A, ntnsr, Sl_ix = NULL, verbose = 1)

Arguments

R

core tensor resulting from RESCAL factorization (r by r by m ).

A

Embedding matrix part resulting from RESCAL factorization.

ntnsr

sparse tensor containing the triples to be reconstructed (i.e. to calculate scores for).

Sl_ix

Optional: indexes of slices to be processed.

verbose

the level of messages to be displayed, 0 is minimal.

Value

Returns a data frame containing four columns:

Subj

index(es) of subject(s)

P

index(es) of predicate

Obj

index(es) of object(s)

val

the score resuling from A[Subj,]%*% R_p * A[Obj,].

See Also

rescal scRescal RescalReconstructBack

Examples

Run this code
# NOT RUN {
  library(RDFTensor)
  data('umls_tnsr')
  ntnsr=umls_tnsr
   
   #Calculate RECAL Factorization
    tt=rescal(ntnsr$X,rnk=10,ainit='nvecs',verbose=2,lambdaA=0,epsilon=1e-4,lambdaR=0)
    A=tt$A
    R=tt$R
    
    #Calculate scores
    res=rescal_Trp_Val(tt$R,tt$A,ntnsr)
    
    <!-- % plot(density(res[,'val']),main='RESCAL Factorization rank=10, density of triples of UMLS') -->
    print(summary(res[,'val']))
# }

Run the code above in your browser using DataLab