O'Reilly logo

Practical Machine Learning Cookbook by Atul Tripathi

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

K-means clustering - foodstuff

Nutrients in the food we consume can be classified by the role they play in building body mass. These nutrients can be divided into either macronutrients or essential micronutrients. Some examples of macronutrients are carbohydrates, protein, and fat while some examples of essential micronutrients are vitamins, minerals, and water.

Getting ready

Let's get started with the recipe.

Step 1 - collecting and describing data

In order to perform K-means clustering we shall be using a dataset collected on various food items and their respective Energy, Protein, Fat, Calcium, and Iron content. The numeric variables are:

  • Energy
  • Protein
  • Fat
  • Calcium
  • Iron

The non-numeric variable is:

  • Food

How to do it...

Let's get into the details.

Step 2 ...

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