DIFFRAC: a discriminative and flexible framework for clustering