Learning and optimizing set functions