# Predicting the Energy Value of Meals and Designing a Healthier Alternative with AI

*English translation by SOTA – AI Community of the Slovak original, [energia_jedlo.pdf](https://ai-olympiada.sk/wp-content/uploads/sites/91/2026/08/energia_jedlo.pdf), from the Olympiáda v umelej inteligencii (Slovak Olympiad in Artificial Intelligence), 2025/26, home round. The original task belongs to its authors. Organisers who would like this translation removed can email sota.ai.community@gmail.com.*

*[Figure: see the original statement.]*

In today's world there is more information about food and nutrition than ever before. New tips, miracle diets and recommendations, which often contradict one another, appear on social media every day. Nevertheless, the number of people with a poor lifestyle, obesity or a lack of physical activity keeps growing. It is becoming ever clearer that the biggest problem is not a lack of data, but a lack of the ability to analyse and use these data correctly.

And this is exactly where artificial intelligence methods come onto the scene. Today they can help in medicine, in autonomous vehicles and in the energy sector. So why could they not also help us with one of our most personal decisions: what shall I put on my plate today?

In this task you will work with the large nutrition dataset FoodData Central, which contains thousands of foods together with their nutritional values (calories, proteins, fats, carbohydrates and others).

Your task is to create a system based on artificial intelligence (machine learning) methods that:

- predicts the energy value of a meal, i.e. the total calorific value of its ingredients;
- proposes a healthier alternative of the meal, with a lower calorie content, a lower carbohydrate content and a higher proportion of protein.

## Data preparation

- Download the zip file of the [nutrition dataset](https://fdc.nal.usda.gov/fdc-datasets/FoodData_Central_foundation_food_csv_2025-04-24.zip) from the FoodData Central website and load the data from the tables of this dataset, **food.csv**, **nutrient.csv** and **food_nutrient.csv**, into your program (or use the attached notebook that loads these data).
- Remove the rows with incomplete or severely missing values from the data (e.g. foods without stated kcal, proteins or sugars).
- Create new auxiliary attributes (features), e.g.:\
  ratio (proteins / calories),\
  ratio (carbohydrates / calories),\
  ratio (fats / calories),\
  food category (e.g. cereals, dairy products, meat, vegetables), if available.

## Predicting the calories of a meal

- Each meal consists of several ingredients; each ingredient is a food from the dataset together with an amount in grams. For example, the input to the program has the form:\
  **150 g apples, 30 g lettuce, 50 g bananas**\
  The names of all available foods are in the table **food.csv.**

- Compute the "true" energy value of the input meal: for each ingredient, find its kcal / 100 g in the dataset, convert it according to the weight in grams, and add the values up (the calorie data are in the tables **nutrient.csv** and **food_nutrient.csv**).

- Create your own dataset with at least 50 meals (each meal has at least 3 and at most 10 ingredients). For each meal, store: ingredients + amounts + the true energy value of the meal (calories) in kcal.

- Split the data: a training part for the model (e.g. 80 %) and a test part (20 %).

- Train at least three machine learning models (e.g. linear regression, random forest, neural networks) to predict the true energy value of a meal (its calories) on the basis of the dataset you created.

- Evaluate their performance using metrics such as MAE (Mean Absolute Error) and RMSE (Root Mean Square Error).

- Create a plot that compares the true and the predicted calorie values for the test set.

## Designing a healthier alternative of a meal

- Choose three meals that you have already used in the previous part, or completely new ones (e.g. popular Slovak dishes).

- For each meal, design (program) an alternative that:
  - has at least 25 % fewer calories than the original meal,
  - has a lower carbohydrate content,
  - has a higher proportion of protein than the original meal.

- In your design you may:
  - replace ingredients with healthier variants (e.g. white flour vs. wholemeal flour, quark cream vs. low-fat quark, cream yoghurt vs. low-fat yoghurt),
  - adjust the amounts of the ingredients (e.g. less oil),
  - add an ingredient with a high protein content (e.g. tofu, Greek yoghurt).

- Create a comparison table (original meal vs. alternative) with the following data: calories, carbohydrates, proteins, fats, percentage change.

## What to submit

1. The code you created that handles both tasks (.py or .ipynb),
2. Documentation (a README file or comments in the code) explaining the steps you used in your solution,
3. Optionally, any further materials you consider appropriate.

## Scoring

0–100 points; the following are taken into account:

- the quality of the result,
- the originality of the solution,
- the clarity and value of the commentary on the solution.
