[英]Is it possible to specify minimum and maximum weight values in encog?
I tried to specify the minimum and maximum weight constraints of a BasicNetwork, but I simply can't find a way to do it. 我试图指定BasicNetwork的最小和最大重量限制,但是我根本找不到解决方法。 Is it possible to set these constraints?
是否可以设置这些约束?
You could do something like this, the following code clamps the weights to between -10 and +10. 您可以执行以下操作,以下代码将权重限制在-10到+10之间。 You could place this right into the HelloWorldXOR example.
您可以将此权限放入HelloWorldXOR示例中。 The flat.getWeights is just a 1D array of the weights, so you can modify them as you wish.
flat.getWeights只是权重的一维数组,因此您可以根据需要修改它们。
VectorAlgebra va = new VectorAlgebra();
FlatNetwork flat = network.getFlat();
do {
train.iteration();
va.clampComponents(flat.getWeights(), 5);
System.out.println("Epoch #" + epoch + " Error:" + train.getError());
epoch++;
} while(train.getError() > 0.01);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.