If the number of classes is given, but not their values , it is possible to determine them in an optimal way. This classification problem can be defined as
The idea is to minimize the cost function alternatively with respect to and with respect to . The minimization with respect to consists of classifying the image, while the minimization with respect to is obtained straightforward by the mean of the image in each class:
The unsupervised classification algorithm is then as follows:
If the number of classes is not given, we can add a penalization term `` '' in the cost function (2.38), measuring the number of classes. The minimization with respect to provides the optimal number of classes. The number of classes is clearly related to the choice of the weighting coefficient .