The minimum number of classes in the case of overlapping classes I've a set of elements that should be grouped in the minimum number of groups, each element belongs to overlapping classes, for eg:


*

*a belongs to the classes x , y , z;

*b belongs to the classes x , y;

*c belongs to the classes x;

*d belongs to the classes z;


So the minimum number of groups that could cover the whole data set are 2, (a, b, c) to x and (d) to z.
l'm looking for the algorithm or the statistical method to apply in this problem.
 A: This seems to be the Set-Cover Problem, which is known to be NP complete. You are therefore very unlikely to find an algorithm that both has reasonable running time and solves the problem optimally.
Fortunately, there are still some things to do:


*

*The greedy algorithm  - whereby at each step you choose the set covering the largest number of elements not yet covered by a previously chosen set - runs in polynomial time, and is at most logarithmically times the optimal solution. It is very likely that this is optimal, in some sense.

*If each element appears in at most $k$ sets, then there is an efficient algorithm that is at most $k$ times the optimal solution. This is better than the previous solution when $k < \log(n)$, where $n$ is the number of elements.
A: You have elements with known class membership. You want the minimum number of classes that includes all elements. 
Count how many elements belong to each class (counts X = 3, Y = 2, Z = 2). Class X has the most elements so we will assign all elements that are members of X to class X (elements a, b, c). Remove these elements and count how many of remaining elements belong to each class (counts X = 0, Y = 0, Z = 1). Class Z has the most elements so we will assign all elements that are members of Z to class Z (element d). Repeat until all elements are assigned a class. 
However, it is not clear that there is a unique solution to your problem. There may be multiple ways to group the elements that results in the same number of classes.
Breaking ties is also a challenge. One idea would be to randomly break ties and repeat the algorithm several times.
