Firstly, sorry if the question is confusing, it was hard to phrase the question without properly explaining what I want to achieve. To make the problem statement more understandable, I made-up the following scenario (please bear with me):

I am in a factory that makes muffins in batches. They get the muffin mixture from a supplier, but due to variation, the muffin mixture is sometimes short of certain ingredients. The lead baker must add or remove ingredients from the mixture to ensure the best flavor and quality.

For each batch of muffins, a sample is taken and analysed. The results give you a breakdown of the ingredients contained in the sample muffin. Suppose that for a batch of chocolate muffins, the results for the sample muffin are as follows:

  • Sugar: 40g
  • Chocolate chips: 10g
  • Peanut Butter: 0g
  • Cocoa Powder: 5g
  • Flour: 80g
  • Other: 5g

For each of these ingredients/"features", there's an ideal value that it should have. In this sample, there is not enough chocolate chips; it is out of the ideal weight by 5g (i.e there should have been 15g of chocolate chips) . The lead baker decides to add 1 kg of chocolate chips to the next batch of chocolate muffin mixture, leaving all other ingredients the same since they are in their ideal range. Now, in the next batch, due to the baker's adjustment, the results obtained for the sample are as follows:

  • Sugar: 41g
  • Chocolate chips: 17g
  • Peanut Butter: 0g
  • Cocoa Powder: 5g
  • Flour: 78g
  • Other: 5g

So, the baker adjusts the ingredients when needed to get the ideal muffin. He/she is making sure to record any changes he/she makes. The results for each batch are also recorded somewhere.

Now the goal: I want to predict what proportion of our own ingredients to add to get the best possible muffin mixture.

To summarize, the input data is as follows:

(Ingredients before lead-baker adjustment)

 - Datetime: 202001010900
 - Sugar: 40g
 - Chocolate chips: 10g
 - Peanut Butter: 0g
 - Cocoa Powder: 5g
 - Flour: 80g
 - Other: 5g

(Lead-baker adjustment)

 - Datetime: 202001011000
 - Chocolate: 1 kg

(Ingredients after most recent lead-baker adjustment)

 - Datetime: 202001011100
 - Sugar: 41g
 - Chocolate chips: 17g
 - Peanut Butter: 0g
 - Cocoa Powder: 5g
 - Flour: 78g
 - Other: 5g

(Lead-baker adjustment)

 - Datetime: 202001011200 
 - Sugar: -100 g

+++hundreds of other similar entries.

After learning the effect of several adjustments, the algorithm should have predicted that, in the first example, the best adjustment to make would have been to add 800 g of chocolate to the mix(which in theory would give us the ideal value of 15g of chocolate chips for each muffin).

What ML algorithm can actually achieve this ? I have worked on a few ML/Deep learning problems,but none of them are like this, where we have unlabeled data, we want to determine a relationship between the features and predict feature values as the output. I have tried going over many more examples, but none seem to remotely fit a problem type like this.

  • $\begingroup$ Isn't there a mistake in your example? the ingredients before and after are exactly the same. $\endgroup$
    – Erwan
    Jun 13, 2020 at 13:39
  • $\begingroup$ As a first attempt you could just try to train an independent regression model for every output variable, e.g. one model predicts the amount of chocolate to add based on the ingredients before adjustment, another one predicts the amount of sugar, etc. $\endgroup$
    – Erwan
    Jun 13, 2020 at 13:47
  • $\begingroup$ Hi Erwan, yes, that's a mistake, thanks for picking it up. Would a separate model for each output variable be better than one model with multiple output variables, considering that outputs could be linked (e.g. adding chocolate could also add some slight sugar?)Also, I was thinking of using the difference between the before and after adjustment as the features corresponding to the adjustment, not just the reading before the adjustment. $\endgroup$ Jun 15, 2020 at 7:11
  • $\begingroup$ I don't think it would be better but it's usually a good idea to start with the most simple option and then improve from it. $\endgroup$
    – Erwan
    Jun 15, 2020 at 13:41

1 Answer 1


You can frame your problem as a denoising task. That is, for a given input list of "noisy" ingredient quantities, output a list of adjusted ingredient quantities. I would proceed as follow.

  • Make a dataset of adjusted ingredient batches
  • Make a dataset of "noisy" ingredient batches. To do so, you can use your data of ingredient batches before adjustement by baker, and augment this dataset by randomly add noise to adjusted ingredient batches
  • Train your model at predicting the adjusted batch given a corresponding noisy one.

Denoising autoencoder is a popular model for this, especially in natural language processing, for tasks like spelling-mistakes auto-correction. Though the original statement of your problem is a regression task, you can convert it into a classification problem by binning your ingredient quantities. Here is an example on how to do this.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.