docs: public static DiscreteFactor getVariances(Collection<DiscreteFactor> featureFactors,
        int featureVariableNum) {
      DiscreteFactor means = getMeans(featureFactors, featureVariableNum);
      
      DiscreteFactor sumSquares = null;
      int numEntries = 0;
      for (DiscreteFactor featureFactor : featureFactors) {
        VariableNumMap nonFeatureVars = featureFactor.getVars().removeAll(featureVariableNum);
        numEntries += nonFeatureVars.getNumberOfPossibleAssignments();
  
        DiscreteFactor factorSumSquares = featureFactor.product(featureFactor)
            .marginalize(nonFeatureVars);
        if (sumSquares == null) {
          sumSquares = factorSumSquares;
        } else {
          sumSquares = sumSquares.add(factorSumSquares);
        }
      }
      
      return sumSquares.add(means.product(means).product(-1.0 * numEntries))
          .product(1.0 / numEntries);
    }