Search in sources :

Example 1 with ScalarPartitionAggrResult

use of com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarPartitionAggrResult in project angel by Tencent.

the class LikelihoodFunc method partitionGet.

@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
    PartitionKey pkey = partParam.getPartKey();
    pkey = psContext.getMatrixMetaManager().getMatrixMeta(pkey.getMatrixId()).getPartitionMeta(pkey.getPartitionId()).getPartitionKey();
    int ws = pkey.getStartRow();
    int es = pkey.getEndRow();
    LikelihoodParam.LikelihoodPartParam param = (LikelihoodParam.LikelihoodPartParam) partParam;
    float beta = param.getBeta();
    double lgammaBeta = Gamma.logGamma(beta);
    double ll = 0;
    for (int w = ws; w < es; w++) {
        ServerRow row = psContext.getMatrixStorageManager().getRow(pkey, w);
        ll += likelihood(row, beta, lgammaBeta);
    }
    return new ScalarPartitionAggrResult(ll);
}
Also used : ScalarPartitionAggrResult(com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarPartitionAggrResult) PartitionKey(com.tencent.angel.PartitionKey) ServerRow(com.tencent.angel.ps.impl.matrix.ServerRow)

Aggregations

PartitionKey (com.tencent.angel.PartitionKey)1 ScalarPartitionAggrResult (com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarPartitionAggrResult)1 ServerRow (com.tencent.angel.ps.impl.matrix.ServerRow)1