Skip to content

compute variance #404

@willwheelera

Description

@willwheelera

evaluate and return variance of accumulators in accumulator.avg() methods, and accumulate the variance in vmc and dmc.

  1. in each accumulator object, the avg() method currently computes the mean over all configs of the values for each key k. in addition, compute the variance and store in the key f"{k}_var"
  2. In vmc, where steps are accumulated in each block, initialize block mean and variance to zero. First increment the variance as var = i/(i+1) *(var + (v - avg)**2 / (i+1)), then increment the mean as avg += 1/(i+1) (v - avg) where i is the step number.
  3. In dmc, averages are not accumulated at each step, but we will implement that. Initialize block mean, block variance, and block weight to zero. At step i, increment the weight average as wavg += (w - wavg)/i (w is the current weight). Define S = wavg*i. Then increment the variance as var = (1 - w/S) *(var + (v - avg)**2 * w/S), then increment the mean as avg += (v - avg) * w/S where i is the step number.
  4. Write tests that verify the variance is evaluated correctly (final variance roughly matches the variance estimated from the mean values of each block)

At the end of a VMC or DMC calculation, the variance can be evaluated as var(X) = mean(X_var) + var(X_mean) over the values saved for each block.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions