Using clustering algorithms as transformers