This question already has an answer here:

I have electric machine, which parameters I measure by 10 sensors. 8 of them measures "input" values and 2 of them result (output). I've got tons of historical data of all of these sensors. I built a Neural Network and train it to aproximate 2 outputs given these 8 inputs (simple multilayer perceptron). It works very well (Error is very small). But the question is: I have got trained model of my process. Can I now somehow train this model to give it 2 outputs as inputs and train it to give me the best combination of input values? I thought about autoencoders. I built some of them to recognize anomallies in this system, but I don't actually see how I can implement them to optimize my input values.

Has anybody done something before?

Maybe I should build some kind of generative model, like GAN? to learn network the distribution of particular input values?



marked as duplicate by Sycorax, mdewey, kjetil b halvorsen, Alexis, gung Mar 25 at 13:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ What prevents you from training a similar model on your historical data, just using the two "output" variables as inputs and "input" variables as outputs? $\endgroup$ – Jan Kukacka Mar 13 at 9:23
  • $\begingroup$ Possible duplicate of Optimization when Cost Function Slow to Evaluate -- there doesn't seem to be a particular need to use a neural network in this problem because there are a number of other strategies to solve it more directly. $\endgroup$ – Sycorax Mar 13 at 17:11

Finding the best configuration of inputs to maximize the output is an optimization task. In this case, you don't know what function maps inputs to outputs, so you also have to make inferences about the function. Even so, this is all well-trod territory: you can adopt a flexible model such as a gaussian process to model the unknown function and make probabilistic inference about the location of the maximum. A key paper on this topic is Jones 1998, "Efficient Global Optimization of Expensive Black-Box Functions."

Additional relevant literature is discussed in Optimization when Cost Function Slow to Evaluate


You can in theory use your network to find the optimal input(basically by performing gradient ascent/descent of your optimisation function on the input values rather than the weight). There are lots of papers trying to interpret CNNs based on this approach - eg finding the optimal input that triggers object class.

In the statistical literature the general approach is called Response surface methodology

However, you need to do causal inference rather than prediction based on correlations in your training data. ie you are asking "what would happen if my input was x instead of what I trained it on, y". the problem is that, observational data, which is I assume what you have, will have lots of spurious correlations, based on eg your current operating procedures. What you need is to run experiments. eg systematically/randomly running through grids of values of your sensor inputs.

Bayesian Optimisation methods (as mentioned in comments and answers) aim to run the experiments as you go, modelling the uncertainty in different areas of the input space to prioritise where to do the next experiment.


Take this is answer with a grain of salt - as it is more of a wild idea than an true and tested response based on experience.

You might want to try Bayesian Optimization. Typically BO is used to find the best hyper-parameters (i.e. numbers of layers, activation functions, etc...) of a neural network model for a given set of inputs. But it might be possible to reverse the approach so that you have a fixed set of hyper-parameters and are searching for inputs, instead of fixed inputs and searching for hyper-parameters.


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