Skip to content

monad.ai


monad.ai / updateAdaptiveWeights

Function: updateAdaptiveWeights()

updateAdaptiveWeights(reward, breakdown, optionsOrLearningRate?): void

Defined in: kernel/adaptiveWeights.ts:366

Applies one online gradient step to the globally learned weights.

Δweight = learningRate × reward × contribution

Scorers with high contribution to a good outcome get heavier; scorers that pushed a bad decision get lighter. The update is idempotent with respect to sign: a series of failures will keep driving a weight toward WEIGHT_MIN but can never push it below that floor.

NaN and zero rewards are ignored (no-ops).

Parameters

reward

number

Continuous reward signal in [−1, 1]; from correlateOutcome.

breakdown

Record<string, ScorerBreakdown>

Per-scorer contributions from the decision being evaluated.

optionsOrLearningRate?

number | AdaptiveWeightUpdateOptions

Either a legacy numeric learning rate, or an options object with namespace and/or learningRate.

Returns

void