public IndependentDistribution createDiscrete(String headVar){
  CategoricalTable.Builder probs=new CategoricalTable.Builder(headVar);
  double incr=1.0 / samples.size();
  for (  Assignment sample : samples) {
    Value val=sample.getValue(headVar);
    probs.incrementRow(val,incr);
  }
  return probs.build();
}

public IndependentDistribution createDiscrete ( String headVar ) { CategoricalTable . Builder probs = new CategoricalTable . Builder ( headVar ) ; double incr = 1.0 / samples . size ( ) ; for ( Assignment sample : samples ) { Value val = sample . getValue ( headVar ) ; probs . incrementRow ( val , incr ) ; } return probs . build ( ) ; }
creates a categorical table with the defined head variable given the samples
