Exemple #1
0
def CompletionDistance_CP_Everystep(Y,Observed,rank_estimate,Ls,alpha):
    """
    EM-ALS CP分解/損失関数にラプラシアン
    """
    N = Y.ndim
    R = rank_estimate
    I = alg.createUnitTensor(N,R)
    updater = lambda X,G,As:(I,alg.CPDistanceStep(As,X,R=rank_estimate,Ls=Ls,alpha=alpha))
    return newalg.CompletionStep(Y,Observed,Y,updater)
Exemple #2
0
def CompletionTuckerProd_EveryStep(Y,Observed,rank_estimate,L,alpha):
    """
    EM-ALS Tucker分解/Kronecker積バージョン
    """
    assert(isinstance(L,list))
    assert(isinstance(rank_estimate,list))

#X,As->G,AS
    updater = lambda X,G,As:alg.HOOIProdstep(G,As,X,Rs=rank_estimate,alpha=alpha,Ls=L)
    return newalg.CompletionStep(Y,Observed,Y,updater)
Exemple #3
0
def CompletionKS_Tucker_EveryStep(Y,Observed,rank_estimate,L,alpha):
    """
    EM-ALS Tucker分解/全体に対する正則化
    """
    assert(isinstance(L,list))
    assert(isinstance(rank_estimate,list))

    Ps,Ds = DecomposeLaplacians(L)
#X,As->G,AS
    updater = lambda X,G,As:alg.TuckerKsumStep(G,As,X,Rs=rank_estimate,Ls=L,Ps=Ps,Ds=Ds,alpha=alpha)
    return newalg.CompletionStep(Y,Observed,Y,updater)
Exemple #4
0
def CompletionKP_Tucker_EveryStep(Y,Observed,rank_estimate,Ls,alpha):
    """
    EM-ALS Tucker分解/全体に対する正則化/Kronecker積バージョン
    """
    assert(isinstance(Ls,list))
    assert(isinstance(rank_estimate,list))

    Ws,Ds = InitializeDiagAndSimilarity(Y,Ls)
    PWs,DWs = DecomposeLaplacians(Ws)

#X,As->G,AS
    updater = lambda X,G,As:alg.TuckerKprodStep(G,As,X,Rs=rank_estimate,Ds=Ds,Ws=Ws,PWs=PWs,DWs=DWs,alpha=alpha)
    return newalg.CompletionStep(Y,Observed,Y,updater)
Exemple #5
0
def CompletionKP_CP_EveryStep(Y,Observed,rank_estimate,Ls,alpha):
    """
    EM-ALS CP分解/全体に対する正則化/Kronecker積バージョン
    """
    assert(isinstance(Ls,list))

    N = Y.ndim
    R = rank_estimate
    Ws,Ds = InitializeDiagAndSimilarity(Y,Ls)
    PWs,DWs = DecomposeLaplacians(Ws)
    I = alg.createUnitTensor(N,R)

    updater = lambda X,G,As:(I,alg.CPKprodStep(As=As,X=X,R=rank_estimate,Ds=Ds,Ws=Ws,PWs=PWs,DWs=DWs,alpha=alpha))
    return newalg.CompletionStep(Y,Observed,Y,updater)
Exemple #6
0
def CompletionKS_CP_EveryStep(Y,Observed,rank_estimate,Ls,alpha):
    """
    EM-ALS CP分解/全体に対する正則化
    """
    N = Y.ndim
    R = rank_estimate
#X,As->Xnew
    if Ls == None:
        Ls = [None for i in xrange(N)]
    Ps,Ds = DecomposeLaplacians(Ls)

    I = alg.createUnitTensor(N,R)

    updater = lambda X,G,As:(I,alg.CPKsumStep(As=As,X=X,R=rank_estimate,Ls=Ls,Ps=Ps,Ds=Ds,alpha=alpha))
    return newalg.CompletionStep(Y,Observed,Y,updater)
Exemple #7
0
def CompletionCPProd_EveryStep(Y,Observed,rank_estimate,Ls,alpha,beta):
    """
    EM-ALS CP分解/Kronecker積バージョン
    """
    assert(isinstance(Ls,list))
    assert(not isinstance(rank_estimate,list))
    N = Y.ndim
    R = rank_estimate
#X,As->Xnew
    if Ls == None:
        Ls = [None for i in xrange(N)]

    I = alg.createUnitTensor(N,R)

    updater = lambda X,G,As:(I,alg.RRMFCPProdstep(As=As,X=X,R=rank_estimate,beta=beta,Ls=Ls,alpha=alpha))
    return newalg.CompletionStep(Y,Observed,Y,updater)
Exemple #8
0
def CompletionCP_EveryStep(Y,Observed,rank_estimate,Ls,alpha,beta):
    """
    EM-ALS CP分解
    """
    assert(isinstance(Ls,list))
    assert(not isinstance(rank_estimate,list))
    N = Y.ndim
    R = rank_estimate
#X,As->Xnew
    if Ls == None:
        Ls = [None for i in xrange(N)]

    Ps,Ds = DecomposeLaplacians(Ls)

    I = alg.createUnitTensor(N,R)

    updater = lambda X,G,As:(I,alg.RRMFCPstep(As=As,X=X,R=rank_estimate,beta=beta,Ls=Ls,Ps=Ps,Ds=Ds,alpha=alpha))
    return newalg.CompletionStep(Y,Observed,Y,updater)
Exemple #9
0
def CompletionDistance_Tucker_EveryStep(Y,Observed,rank_estimate,Ls,alpha):
    """
    EM-ALS Tucker分解/損失関数にラプラシアン
    """
    updater = lambda X,G,As:alg.TuckerDistanceStep(G,As,X,Rs=rank_estimate,Ls=Ls,alpha=alpha)
    return newalg.CompletionStep(Y,Observed,Y,updater)