Difference between revisions of "Recipe/Theory/Statistics exploration"
Line 17: | Line 17: | ||
This simplifies the relation (1) to a simple multiplication for products with one nutrient. And in that case '''ε''' = 0. | This simplifies the relation (1) to a simple multiplication for products with one nutrient. And in that case '''ε''' = 0. | ||
+ | |||
+ | Relation (1) could be extended with a term β<sub>0</sub>, which designates the intercept. In the recipe case this is 0, i.e. if there are no nutrients in the ingredient, then there are also nu nutrients in the product. In a mathematic approach it might be necessary to retain the β<sub>0</sub> though. | ||
== Complicating things == | == Complicating things == | ||
Clearly we need a more complicated approach that supports multiple ingredients and multiple nutrients. | Clearly we need a more complicated approach that supports multiple ingredients and multiple nutrients. |
Revision as of 14:12, 21 January 2025
Finding the recipe of a product based on the list of ingredients and nutritional values, is a statistical problem of Linear regression for which a lot of theory exists. The recipe fitting problem is very specific and it is a bit difficult to find the right statistical approach in all the dense wikipedia pages.
Simple regression
We are not used to the terminology used in linear regression statistics, so some translation is needed:
- dependent variables / observed values (y) - these comparable to a nutrient of the product. Usually there are many values y observed (n dimensions);
- regressors / independent variable (x) - this is a nutrient in an ingredient. This independent variable kan have multiple dimensions p;
- regression coefficients (β) - the recipe fraction. In a general situation β can have p values for each observation (making a matrix);
- error term (ε) - the deviation from the fit for each observation;
This gives the relation:
(1) y = X β + ε
The recipe estimation is much simpler:
- there is only one product, so only 1 observed value, so n = 1;
- but also p = 1, as there is only one percentage per ingredient;
This simplifies the relation (1) to a simple multiplication for products with one nutrient. And in that case ε = 0.
Relation (1) could be extended with a term β0, which designates the intercept. In the recipe case this is 0, i.e. if there are no nutrients in the ingredient, then there are also nu nutrients in the product. In a mathematic approach it might be necessary to retain the β0 though.
Complicating things
Clearly we need a more complicated approach that supports multiple ingredients and multiple nutrients.