Description Usage Arguments Value Author(s) See Also Examples
gets the best reconstruction of a CP-factorization by trying different thresholds on the result. If the size of the tensor is too big sampling is done to get estimates of TP, FP.
1 2 3 |
X |
the original tensor as sptensor list(subs,vals,size,nnz) |
P |
a LIST containing the CP transformation |
pthr |
list of threshold values to be tried |
cntNnz |
If |X| is the number of non-zeros in data X, the sampled locations will be cntNnz*|X| of 0s. |
startSize |
if size of tensor < startSize all values are calculated, default 1e7. |
A LIST containing the TP, FP, FN and threshold value also the result of best threshold
Abdelmoneim Amer Desouki
cp_apr
serial_parCube
rescal
rescal_01
cp_nmu
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | trp=rbind(
cbind('Alex', 'loves', 'Don'),
cbind('Alex', 'loves', 'Elly'),
cbind('Alex', 'hates', 'Bob'),
cbind('Don', 'loves', 'Alex'),
cbind('Don', 'hates', 'Chris'),
cbind('Chris', 'hates', 'Bob'),
cbind('Bob', 'hates', 'Chris'),
cbind('Elly', 'hates', 'Chris'),
cbind('Elly', 'hates', 'Bob'),
cbind('Elly', 'loves', 'Alex')
)
######
# form tensor as a set of frontal slices (Predicate mode)
tnsr=getTensor(trp)
subs=getTnsrijk(tnsr$X)
X=list(subs=subs,vals=rep(1,nrow(subs)),size=c(5,2,5))
normX=sqrt(sum(X$vals))
set.seed(123)
# NMU decomposition with rank 2
P1=cp_nmu(X,2)
res=CP_R01(X,P1[[1]])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.