powerset construction algorithm for machine learning