docs: public static DiscreteFactor createIndicatorFeatureTensor(VariableNumMap vars, int featureVarNum,
        TableFactorBuilder initialWeights) {
      // The "name" of an indicator feature is the assignment that it indicates.
      List<List<Object>> features = Lists.newArrayList();
      Iterator<Assignment> assignmentIterator = initialWeights != null ?
          initialWeights.assignmentIterator() : new AllAssignmentIterator(vars);
      while (assignmentIterator.hasNext()) {
        features.add(assignmentIterator.next().getValues());
      }
      DiscreteVariable featureVariable = new DiscreteVariable("indicator features", features);
      VariableNumMap featureVarMap = VariableNumMap.singleton(featureVarNum, "features-" + featureVarNum,
          featureVariable);
  
      TableFactorBuilder featureValueBuilder = new TableFactorBuilder(vars.union(featureVarMap),
          SparseTensorBuilder.getFactory());
      for (List<Object> featureValues : features) {
        Assignment newAssignment = vars.outcomeToAssignment(featureValues)
            .union(featureVarMap.outcomeArrayToAssignment(featureValues));
        featureValueBuilder.setWeight(newAssignment, 1.0);
      }
      return featureValueBuilder.build().cacheWeightPermutations();
    }