def select(partition, model, train):
    """Select a group to split from current partition."""
    candidates = [g for g in partition if g.all_same is False]
    if len(candidates) == 0: return None
    candidates.sort(key=lambda c:c.err, reverse=True)
    #del candidates[5:]
    return candidates[0]