Encog: How do I compute without ideal data?

依然范特西╮ 提交于 2020-02-23 07:41:06

问题


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?


回答1:


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());
    } 


来源:https://stackoverflow.com/questions/44889634/encog-how-do-i-compute-without-ideal-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!