Encog:在没有理想数据的情况下如何计算? [英] Encog: How do I compute without ideal data?
问题描述
这里是我的代码示例,仅用于解释我的问题. (我的代码不是XOR示例,它包含更多数据):
Here is an example of my code just to explain my question. (My code is not the XOR example and it has much more data):
public static double XOR_INPUT[][] = { { 0.0, 0.0 }, { 1.0, 0.0 }, { 0.0, 1.0 }, { 1.0, 1.0 } };
public static double XOR_IDEAL[][] = { { 0.0 }, { 1.0 }, { 1.0 }, { 0.0 } };
...
MLDataSet trainingSet = new BasicMLDataSet(XOR_INPUT, XOR_IDEAL);
...
for(MLDataPair pair: trainingSet ) {
final MLData output = network.compute(pair.getInput());
System.out.println(pair.getInput().getData(0) + "," + pair.getInput().getData(1)
+ ", actual=" + output.getData(0) + ",ideal=" + pair.getIdeal().getData(0));
}
在评估情况下(我知道理想的输出),这很好.
In an evaluation situation (where I know the ideal output) this works fine.
但是在实际情况下,经过训练的神经网络以及当我不知道理想的输出时:在这种情况下,该采取什么方法?我是否必须整理"理想的数据?
But in a real situation, with my neural network trained and when I don't know the ideal output: What is the approach in this case? Do I have to "make up" the ideal data?
可以通过工作台进行此计算吗?
Can this computation be made through the workbench?
推荐答案
请注意,当查询输出时,以上循环仅使用pair.getInput().这只是数据集的输入一半,您无需提供理想/期望值.以下代码显示了如何在没有理想值的情况下执行此操作.只需将输入包装在BasicMLData对象中,就可以了:
Notice how when it queries the output the above loop just uses pair.getInput(). This is just the input half of the dataset, you do not need to provide ideal/expected. The following code shows how to do it with no ideal values at all. Just wrap the input in a BasicMLData object and you are fine:
System.out.println("Neural Network Results:");
for(int i=0;i<XOR_INPUT.length;i++ ) {
MLData inputData = new BasicMLData(XOR_INPUT[i]);
final MLData output = network.compute(inputData);
System.out.println(inputData
+ ":" + output.toString());
}
这篇关于Encog:在没有理想数据的情况下如何计算?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!