contribution

fun contribution(peer: ReplicaId, sampleCount: Long, localWeights: List<Double>, epoch: Long = 1): FedAvg

Build a single peer's contribution to a FedAvg round.

Stores (sampleCount × localWeights[i]) per coordinate internally, so the merge across peers is pure addition with no division until weights is read.

Parameters

peer

the contributing replica — must be globally unique.

sampleCount

the number of training examples (must be positive).

localWeights

the locally-trained weight vector (same dimension across all peers).

epoch

monotone round counter — increment to supersede a prior contribution. Defaults to 1L (single-round FedAvg).

Throws