I am working on a project that involves 10 inputs (X1, X2,..., X10) and predicts 3 outputs (Y1, Y2, Y3). I am using the Keras package in Python with the backend of Tensorflow. I have built an ANN, trained, and shown decent predictions.
However, now I need to determine what combination of the 10 inputs will produce the lowest value of Y1, highest of Y2, and lowest of Y3. In essence, I need to find the 10 input values to yield the optimal output.
I have read that Genetic Algorithm may be a way to accomplish this, but I am not sure how to implement this. Any suggestions, insight, or examples would be greatly appreciated.
A Genetic algorithm could be used to accomplish this.
Note that GAs maximize a fitness function, so if you are attempting to use a GA to minimize something, your fitness function needs to be inversely proportional to your expected output:
A possible example fitness function for your stated problem assuming domain of (0, inf)
def fitness(Y1, Y2, Y3):
return ( 1 / Y1 ) * (Y2) * (1 / Y3)
This would establish equal priority for Y1 and Y3 and for the product of the three numbers to be maximized, both Y1 and Y3 would have to be as close to 0 as possible and Y2 would have to be maximized.
For clarification, the above fitness function would likely not be ideal for your use case, but serves to demonstrate how a fitness function would have to apply weight to each parameter.
Here is a link to a good GA walkthrough. Solving the Traveling Salesman using a GA.
Alternatively you can use Particle Swarm Optimization (PSO) which does something similar to a GA, but finds the parameters that minimize a function.
If you have domain restrictions on your outputs, you could also use a custom loss function (or MSE, Euclidean distance, etc.) that measures the loss between your domain limits and your actual output or just use the same fitness function you would have used for the earlier methods.
You could then backpropagate through your network to identify which input variable has the largest impact on the output loss and use SGD.
Assuming domain resitrictions, I would expect this method to give the best results, otherwise, they should all perform about equally and are largely dependent on what you use as a fitness function.
You could also possibly entertain a Monte Carlo approach.