code: public static DiscreteLogLinearFactor createIndicatorFactor(VariableNumMap vars,
        TableFactorBuilder initialWeights) {
      Preconditions.checkArgument(vars.size() == vars.getDiscreteVariables().size());
  
      int featureVarNum = Ints.max(vars.getVariableNumsArray()) + 1;
  
      DiscreteFactor featureValues = createIndicatorFeatureTensor(vars, featureVarNum, initialWeights);
      VariableNumMap featureVarMap = featureValues.getVars().intersection(featureVarNum);
  
      TableFactor initialWeightFactor = (initialWeights != null) ? initialWeights.build() : null;
      return new DiscreteLogLinearFactor(vars, featureVarMap, featureValues, initialWeightFactor);
    }
docs: Creates and returns a {@code DiscreteLogLinearFactor} over {@code vars}
  which is parameterized by indicator functions. The returned factor has one
  indicator feature for every possible assignment to {@code vars}.
  {@code initialWeights} determines the sparsity pattern of the factors
  created by the returned parametric factor; pass {@code null} to create a
  dense factor.
  <p>
  {@code vars} must contain only {@link DiscreteVariable}s.
  
  @param vars
  @param initialWeights
  @return