Skip to content

Main content

Log Probability Weight Centering Offset Tool

Calculate log probability weight centering offset from explicit caller-supplied inputs.

Loading tool…

Description

For a nonempty finite logWeights list take offset=max(logWeights) and return centered values logWeights-offset.

Products of small probabilities can round to zero in floating-point arithmetic. Natural logarithms turn products into sums, and centering or expm1-based expressions can reduce avoidable numerical loss. A finite log weight is different from a raw probability and cannot directly represent an exact zero probability.

For a nonempty finite logWeights list take offset=max(logWeights) and return centered values logWeights-offset.

When to use this tool

Use Log Probability Weight Centering Offset when you need the stated natural-log contribution or stable conversion between a finite log representation and an ordinary value.

How to use the tool and how it works

  1. Enter logWeights. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read centered, offset. Use the output convention below.

For a nonempty finite logWeights list take offset=max(logWeights) and return centered values logWeights-offset.1

Input fieldMeaning and unitsAccepted input
logWeightsLog WeightsRequired. Array of finite number; maximum items 256.
Output fieldInterpretationReturned shape
centeredCenteredRequired. Array of finite number; maximum items 256.
offsetOffsetRequired. Finite number.
json
{
  "input": {
    "logWeights": [
      1000,
      998,
      999
    ]
  },
  "output": {
    "centered": [
      0,
      -2,
      -1
    ],
    "offset": 1000
  }
}

Limitations and assumptions

  • Centering preserves relative weights but does not normalize probabilities. Inputs and differences must remain finite; negative-infinity log weights are unsupported.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Signed zero is exported as zero.

Alternative or Complementary methods

Keep long products or normalizations in the log domain when feasible. Check whether exact zeros need a separate flag and whether the final ordinary-scale result is representable.

References

  1. Calculation and input contract: probability/log-probability-weight-centering-offset — tool.io

Similar or alternative tools