top | item 46658430

(no title)

AgentMatt | 1 month ago

Great article!

I think there's a small problem with intermediate values in this code snippet:

  const maxValue = Math.max(...samplingVector)

  samplingVector = samplingVector.map((value) => {
    value = x / maxValue; // Normalize
    value = Math.pow(x, exponent);
    value = x * maxValue; // Denormalize
    return value;
  })
Replace x by value.

discuss

order

alexharri|1 month ago

Just pushed a fix, should be live in a minute or two, thanks again!

Aaron2222|1 month ago

This loop is similarly suspect:

  let maxValue = value;
  for (const externalIndex of AFFECTING_EXTERNAL_INDICES[i]) {
    maxValue = Math.max(value, externalSamplingVector[externalIndex]);
  }

alexharri|1 month ago

Good catch, thanks! I’ll push a fix once I’m home