use of com.tencent.angel.ml.matrix.psf.update.base.PartitionUpdateParam in project angel by Tencent.
the class GeneralInitParam method split.
@Override
public List<PartitionUpdateParam> split() {
MatrixMeta meta = PSAgentContext.get().getMatrixMetaManager().getMatrixMeta(matrixId);
PartitionKey[] parts = meta.getPartitionKeys();
KeyValuePart[] splits = RouterUtils.split(meta, 0, nodeIds, features);
assert parts.length == splits.length;
List<PartitionUpdateParam> partParams = new ArrayList<>(parts.length);
for (int i = 0; i < parts.length; i++) {
if (splits[i] != null && splits[i].size() > 0) {
partParams.add(new GeneralPartUpdateParam(matrixId, parts[i], splits[i]));
}
}
return partParams;
}
use of com.tencent.angel.ml.matrix.psf.update.base.PartitionUpdateParam in project angel by Tencent.
the class UpdateParamWithKeyIds method split.
@Override
public List<PartitionUpdateParam> split() {
List<PartitionKey> parts = PSAgentContext.get().getMatrixMetaManager().getPartitions(matrixId);
int size = parts.size();
List<PartitionUpdateParam> partParams = new ArrayList<>(size);
int nodeIndex = 0;
for (PartitionKey part : parts) {
// include start
int start = nodeIndex;
while (nodeIndex < keyIds.length && keyIds[nodeIndex] < part.getEndCol()) {
nodeIndex++;
}
// exclude end
int end = nodeIndex;
if (end - start > 0) {
partParams.add(getPartitionParam(part, start, end));
}
}
return partParams;
}
use of com.tencent.angel.ml.matrix.psf.update.base.PartitionUpdateParam in project angel by Tencent.
the class MFUpdateParam method split.
@Override
public List<PartitionUpdateParam> split() {
List<PartitionKey> partList = PSAgentContext.get().getMatrixMetaManager().getPartitions(matrixId);
int size = partList.size();
List<PartitionUpdateParam> partParams = new ArrayList<>(size);
for (PartitionKey part : partList) {
if (Utils.withinPart(part, rowIds)) {
partParams.add(new MFPartitionUpdateParam(matrixId, part, rowIds, func));
}
}
if (partParams.isEmpty()) {
System.out.println("Rows must in same partition.");
}
return partParams;
}
use of com.tencent.angel.ml.matrix.psf.update.base.PartitionUpdateParam in project angel by Tencent.
the class QuantifyDoubleParam method split.
@Override
public List<PartitionUpdateParam> split() {
List<PartitionKey> partList = PSAgentContext.get().getMatrixMetaManager().getPartitions(matrixId, rowId);
int size = partList.size();
List<PartitionUpdateParam> partParams = new ArrayList<>(size);
for (PartitionKey part : partList) {
if (rowId < part.getStartRow() || rowId >= part.getEndRow()) {
throw new RuntimeException("Wrong rowId!");
}
partParams.add(new QuantifyDoublePartUParam(matrixId, part, rowId, (int) part.getStartCol(), (int) part.getEndCol(), array, numBits));
}
return partParams;
}
use of com.tencent.angel.ml.matrix.psf.update.base.PartitionUpdateParam in project angel by Tencent.
the class InitHyperLogLogParam method split.
@Override
public List<PartitionUpdateParam> split() {
MatrixMeta matrixMeta = PSAgentContext.get().getMatrixMetaManager().getMatrixMeta(matrixId);
PartitionKey[] parts = matrixMeta.getPartitionKeys();
KeyPart[] keyParts = RouterUtils.split(matrixMeta, 0, nodes);
List<PartitionUpdateParam> params = new ArrayList<>(parts.length);
for (int i = 0; i < parts.length; i++) {
if (keyParts[i] != null && keyParts[i].size() > 0) {
params.add(new InitHyperLogLogPartParam(matrixId, parts[i], keyParts[i], p, sp, seed));
}
}
return params;
}
Aggregations