Asso_approximate: Asso: Boolean Matrix Factorization

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/Asso2R.R

Description

Given binary matrix S (m x n), and a scalar k (number of factors), Asso finds two matrices A (m x r), B (r x n) such taht S~= A * B

Usage

1
Asso_approximate(S, k, opti)

Arguments

S

input matrix to be factorized

k

number of factors (rank)

opti

options : list containing components verbose:control of showing messages , threshold:precision limit,penalty_overcovered,bonus_covered.

Value

LIST of three components

B

k x n factor matrix

O

n x k factor matrix

D

n x n matrix, the result from calculate_association

Author(s)

Abdelmoneim Amer Desouki

References

Miettinen, P., Mielikaeinen, T., Gionis, A., Das, G., & Mannila, H. (2008). The discrete basis problem. IEEE transactions on knowledge and data engineering, 20(10), 1348-1362.

See Also

See Also topFiberM

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(DBLP)
X=DBLP
Xb=X==1
Res=Asso_approximate(Xb,7,list(threshold=0.5,penalty_overcovered=1,bonus_covered=1,verbose=0))

    X_=Res$O %*% Res$B
    X_=as(X_,'TsparseMatrix')
    X=as(X,'TsparseMatrix')
			li=X@i[X@x==1]+1
			lj=X@j[X@x==1]+1
			tp=sum(X_[cbind(li,lj)]>0)
			fn=sum(X)-tp#sum(!X_[cbind(li,lj)])
			fp=sum(X_@x>0)-tp
			cv=1-(fp+fn)/(tp+fn)
print(sprintf("tp:%d, fp:%d,fn:%d, Error:%d, covered=%.3f",tp,fp,fn,fn+fp,cv))

rBMF documentation built on Jan. 16, 2021, 5:31 p.m.