Recipe/Example/Petit Beurre
In an ingredient list often the amount (fraction) of ingredients is not specified. Knowing this is useful to get a better handle on various score. The question is now how we could estimate these fractions using the information that we have (nutritional values of separate ingredients from Ciqual and the total values for a product (a recipe).
A recipe consists of N ingredients, numbered i=0 to N-1.
A recipe has M nutrients j=0 to M-1.
Each ingredient contributes yij to nutrient j.
In a recipe an ingredient has a fraction xi.
The total values for a nutrient Ycalculatedj = SUMi=0N-1 xiyij. We know Yproductj from the pruduct.
We kind try to find the values for xi by finding the minimum for the squared distances:
Min SUMjM-1(Yproductj - Ycalculatedj)2