Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »


This is a UCI data set from 2014 about clients' spending at a wholesale distrubutor. Every row represents how many monetary units within a category of item the given client bought in a year. 440 clients' spendings on each category were recorded. There are 8 attributes: channel (e.g. the client type: "1" for hotel/restaurant and "2" for retail such as a supermarket), region (Lisbon, Porto, or other, numbered 1-3), fresh products, milk products, grocery products, frozen products, detergents/paper products, and delicatessen (deli products like cold cuts). The numbers under the product types represent monetary units (m.u.), which is a substitute for measuring in regular currency. Wikipedia defines it as "the change in the utility from an increase in the consumption of that good or service". I will be working with this data by observing relationships between certain features, performing clustering, and doing a PCA analysis.

Problem Statement

As I mentioned before, this data set is from the UCI site, and it was donated in 2014. Based on the region names, this seems to be data collected in Portugal. The main questions I seek to answer are, in general terms, "Is there a relationship between the kind of client and the type of goods of which the most were purchased?", "Is there a relationship between certain product types, whether it be positive or negative correlation?", and "Can we cluster the data into groups based on similar number of products purchased in certain categories?"


Linear regression


Kmeans clustering


show the visualizations and analysis results

Blue is the channel 1, or client type hotel/restaurant, and yellow is for retail. It seems that retail as a whole buys less while some hotel/restaurant clients buy a lot.

In the next picture, we can see that there is a higher rate of fresh foods than of frozen being bought by clients.

In the next picture, I've plotted the frozen foods vs the deli meats vs the toiletries-type products. The yellow, which is retail, seems to buy a lot more toiletries than restaurants or hotels...which makes sense because the customers are not at hotels or restaurants to get those kinds of things. Meanwhile, the restaurants/hotels, in blue, as mentioned before, seem to buy more frozen foods. Perhaps this is because customers are leaning toward fresher foods these days while at restaurants/hotels, they cannot see how the food was before eating it? And then the deli meats seem to be bought about equally, except for some outliers in restaurant/hotels that may perhaps be actual delis or sub shops and therefore need a lot.

Also, the regions seem to have an impact on the kinds of products bought, as well. In the picture below, blue is Lisbon, yellow is Porto, and gray is other. Lisbon is a southern coastal city (the largest in Portugal), while Port is a northern coastal city (the second largest). Porto seems to buy a lot more or everything in general, and it also has the most outliers, which makes sense because it has the most clients.

 As the PCA analysis of all of the features below shows, the first two eigenvectors are the most important ones as they make up 90% of the variation in the data. The chief feature in the first one is the client type while the chief feature in the second is the region. Looking at the colors of the previous plots, the reason behind this variation is clear; we can see that these two features have a large impact on the amount of various items clients buy.
The two pictures below show the kmeans clustering result for all of the features except region and client type. We can see that the result of clustering this data has produced similar results in relation to the third picture. By leaving out the two biggest sources of variation and observing the clustering, it is clear that they are still similarly divided into clusters as if the cluster colors were still based off of region/client type.

Compare these two clustering results to the plot of the data before clustering, colored by client type and sized by region:

This plot shows the original clients (blue is restaurant/hotel and yellow is retail). Those that buy the most of frozen food, for example, are usually restaurants/hotels, as we can see from this result. But the clustering result has a few of these same points colored differently (assuming brown is restaurant/hotel and green is retail). Therefore, the clustering results are imperfect, as they are showing some inaccuracies.




Thank you to my high school buddy John for explaining some economics things

  • No labels