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);
}
Aggregations