O'Reilly logo

Mastering Numerical Computing with NumPy by Mert Cuhadaroglu, Umit Mert Cakmak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Modifying our algorithm

Now you have understood the internal of k-means on a single variable, you can extend this implementation to multiple variables and apply it to a more realistic dataset.

The dataset to be used in this section is from the UCI Machine Learning Repository (https://archive.ics.uci.edu/ml/datasets/wholesale+customers), and it includes the client information of wholesales distributor. There 440 customers with eight features. In the following list, first six features are related to annual spending for corresponding products, seventh feature shows the channel that this product is bought and the eighth feature shows the region:

  • FRESH
  • MILK
  • GROCERY
  • FROZEN
  • DETERGENTS_PAPER
  • DELICATESSEN
  • CHANNEL
  • REGION

First download the dataset ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required