def sampling_density(expr, given_condition=None, numsamples=1, **kwargs):
 results = {}
 for result in sample_iter(expr, given_condition, numsamples=numsamples, **kwargs):
  results[result] = (results.get(result, 0) + 1)
 return results

def sampling_density ( expr , given_condition = None , numsamples = 1 , ** kwargs ) : results = { } for result in sample_iter ( expr , given_condition , numsamples = numsamples , ** kwargs ) : results [ result ] = ( results . get ( result , 0 ) + 1 ) return results
sampling version of density see also density sampling_p sampling_e .