K-Means and Gaussian Mixtures are two different approaches, which can be applied to clustering problems. K-Means searchs for the best distribution of K clusters, in order to minimize the loss function among all points in dataset. Gaussian Mixtures work on different conception, it searchs for best probability distribution, along K gaussian distributions, each one with its own mean and variance.

We will analyze their outcomes on different cases. We start with a 2 dimensional random dataset, to compare both techniques, with different cluster numbers.

Next, we apply both techniques to real world countries data, in order to separate into clusters and analyze them. For this we will apply two features, in a 2-D dimension dataset, but we will try to analyze different clusters conceptions.

1- Functions Definition

We start by declaring the functions and classes used.
We build classes for K-Means and Gaussian Mixtures and calculate all their mathematics.
For our mixture models, we define their mean, variance and weight components.
We also define a function to create the animations and the other plotting functions.

2- Random Points with K = 2

We start with a random dataset of 2-D dimension, for simplicity. This is easier to visualize and interpret.

2.1- K-Means: K = 2 Cluters

Our first approach will be applying K-Means with K = 2 clusters on this dataset.

2.2- Mixture Gaussians: K = 2 Distributions

For K = 2, both techniques are very similar. They search for the best distribution and representation of the points.

3- Random Points with K = 4

3.1- K-Means: K = 4 Clusters

3.2- Gaussian Mixtures: K = 4 Distributions

With K = 4, we see a difference between the two techniques. While K-Means tries to distribute evenly the points, among all clusters, Gaussian Mixture foccuses on explaining better the points and their density, and we can have overlapping distributions, each with their own mean and variance. Sometimes Gaussian Mixtures can explain better real problems.

4- World Data 2D: 2 Clusters

We now proceed to analyze real world data. We will use 2 features, GDP (gross domestic product) and population, of 87 countries, from 2020. These data were obtained from Kaggle.

4.1- K-Means: K = 2 Clusters

4.2- Gaussian Mixtures: K = 2 Distributions

4.3- World hemispheres

As stated before, K-Means and Gaussian Mixtures show similar clustering when K equals 2.
By separating the data into two clusters, one interpretation we can make is dividing the globe into north and south hemispheres. Below we show both models representation, as well as real hemisphere distributions.

By looking at the pictures above, we can make some assumptions.
Both techniques group the dataset in two clusters, by similarities: one at the top right and one at the bottom left.
By looking at the real hemispheres division, both are spread over the values. However the blue cluster spreads more over extreme sides, while the red cluster is smaller and concentrate more in the center.

For a better visualization, we can plot these points in a world map, by their geographic location.

We can also plot the models outcome in the world map. By analyzing the clusterings outcome, we make interesting insights. Although we did not give information about geographic location, we see that clearly there are similarities between countries in the south hemisphere, as well between countries in the north hemisphere.

Overall, we know that countries in the north are more developed and richer, like USA, European and Asian countries. On the other side, south countries are poorer, like South America and African countries. And we can see this represented by the clusters outcome.

By looking at it we can also see some details. Although Australia is located in the south hemisphere, it is more developed and have similar features of the north hemisphere group. Also there are some mixed countries in South/Central America and Africa. This mean that, althouth, they are located in the south hemisphere, they may show features closer to north hemisphere group.

5- World Data 2D: 5 Clusters

We investigate further and now apply 5 clusters to our algorithms.

5.1- K-Means: K = 5 Clusters

5.2- Gaussian Mixtures: K = 5 Distributions

5.3- World Continents

Now that we have 5 clusters, we can analyze if the model outcomes correspond to real world continents. We start by plotting the models outcome.

We can see that both techniques have different distributions over the data. In the Gaussian Mixtures the top group has only 4 points, more isolated from the others.
But how do they correspond to real continents? Let's check in the world map.

These results are very interesting. First we shall say that the Gaussian Mixtures showed a better outcome, closer to the real continents. Since it represents all data with gaussian distributions, this method cluster better similar and closer points. The outcome of K-Means technique showed more mixed countries, all over America, Africa and Europe.

Also we can see that many African countries share similarities between themselves, same as European countries. Gaussian Mixtures classified both USA and Australia belonging to the European group, which is understandable, due to both being developed.

It is very important to emphasize here that we are investigating clustering techniques and their information. We are not applying proper classification algorithms, neither training or predicting on different datasets. We are using our ground truth variables only to correlate to achieved outcomes. In real problems we may not have the ground truth clusters and it may be very hard to find real groups or their meaning.

Concluding, it was very interesting to discover all these real similarities, in this study case, based only on two features. For future works we could analyze more features, and their representation by applying clustering on PCA components.