Data Driven Flexible Grouping