def partition_entropy_by(inputs, attribute):
 partitions = partition_by(inputs, attribute)
 return partition_entropy(partitions.values())

def partition_entropy_by ( inputs , attribute ) : partitions = partition_by ( inputs , attribute ) return partition_entropy ( partitions . values ( ) )
computes the entropy corresponding to the given partition .