简体   繁体   English

找到产生最佳输出的最佳输入组合

[英]Finding the optimal combination of inputs that produce the optimal outputs

I am working on a project that involves 10 inputs (X1, X2,..., X10) and predicts 3 outputs (Y1, Y2, Y3).我正在从事一个涉及 10 个输入(X1、X2、...、X10)并预测 3 个输出(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.我在 Python 中使用 Keras package,后端为 Tensorflow。我已经构建了一个 ANN,经过训练并显示了不错的预测。

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.但是,现在我需要确定 10 个输入的哪种组合会产生最低的 Y1 值、最高的 Y2 值和最低的 Y3 值。 In essence, I need to find the 10 input values to yield the optimal output.本质上,我需要找到 10 个输入值以产生最佳的 output。

I have read that G.netic Algorithm may be a way to accomplish this, but I am not sure how to implement this.我读过 G.netic 算法可能是实现此目的的一种方法,但我不确定如何实现它。 Any suggestions, insight, or examples would be greatly appreciated.任何建议、见解或示例将不胜感激。

G.netic Algorithms G.netic算法

A G.netic algorithm could be used to accomplish this.可以使用 G.netic 算法来完成此操作。
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:请注意,GA 会最大化适应度 function,因此如果您尝试使用 GA 来最小化某些东西,则您的适应度 function 需要与预期的 output 成反比:

A possible example fitness function for your stated problem assuming domain of (0, inf)假定域为(0, inf)的适用性示例 function

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.这将为 Y1 和 Y3 建立相同的优先级,并且为了使三个数字的乘积最大化,Y1 和 Y3 都必须尽可能接近 0,并且 Y2 必须最大化。

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.为澄清起见,上述适应度 function 可能不适合您的用例,但用于演示适应度 function 必须如何对每个参数应用权重。

Here is a link to a good GA walkthrough.这是一个很好的 GA 演练的链接。 Solving the Traveling Salesman using a GA . 使用 GA 解决旅行商问题

Particle Swarm Optimization粒子群优化

Alternatively you can use Particle Swarm Optimization (PSO) which does something similar to a GA, but finds the parameters that minimize a function.或者,您可以使用粒子群优化(PSO) ,它执行类似于 GA 的操作,但会找到使 function最小化的参数。

Stochastic Gradient Descent (SGD)随机梯度下降 (SGD)

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.如果您对输出有域限制,您还可以使用自定义损失 function(或 MSE、欧几里得距离等)来衡量域限制与实际 output 之间的损失,或者只使用与您使用的相同的适应度 function对于早期的方法。
You could then backpropagate through your.network to identify which input variable has the largest impact on the output loss and use SGD.然后,您可以通过 your.network 进行反向传播,以确定哪个输入变量对 output 损失的影响最大,并使用 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.假设域限制,我希望这种方法能给出最好的结果,否则,它们的性能应该大致相同,并且在很大程度上取决于您使用的适应性 function。

Monte Carlo蒙特卡洛

You could also possibly entertain a Monte Carlo approach.您也可以采用蒙特卡罗方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM