What is the difference between classification and clustering?

Answer

Classification is a supervised learning task — the model is trained on labeled data where each example has a known class, and it learns to assign classes to new examples. Clustering is an unsupervised learning task — the model discovers natural groupings in unlabeled data based on similarity, without any predefined class labels. In classification, the number and nature of classes is known in advance. In clustering, the number of groups may itself be a hyperparameter to determine. The same algorithm (e.g., neural network) can be adapted for both paradigms.