A Joint Gradient and Loss Based Clustered Federated Learning Design