How to maximize number of clusters that respect a given constrain

Hi I am currently facing a challenge regarding clustering for which I have not found an answer in other topics.

I have a set of points each with a common set of specific attributes (att1, att2, att3…) I would like to:

  1. cluster them based on their reciprocal distance for att1
  2. maximize the number of clusters while ensure that each cluster includes points that have at least n different values for att2

So far I have solved point 1) by using a Hierarchical Clustering Assigner flow but I am a bit stuck on how to impose the constrain of point 2)

Any advice you can share on how to proceed would be really helpful


Hi there!

Sry for a late response to this topic.

I have seen you got recommendation to try DBSCAN as an aternative in this forum topic: Clustering with restrictions - wondering did it work or you managed to find another way for your problem?

If you use Hierarchical Clustering Assigner inside a loop and in each iteration change number of clusters and calculate number of different values for att2 per cluster you could get something but got a feeling this is not the best approach…