2

我正在尝试使用 Encog处理这个数据集。为此,我将输出合并为一个(似乎无法弄清楚如何使用多个预期输出,即使我尝试手动训练具有 4 个输出神经元的 NN 失败),其值为:“disease1”, “disease2”、“none”和“both”。

从那里开始,使用 CSV 中的分析向导,自动过程训练了具有预期输出的 NN。文件中的一个峰值:

"field:1","field:2","field:3","field:4","field:5","field:6","field:7","Output:field:7"
40.5,yes,yes,yes,yes,no,both,both
41.2,no,yes,yes,no,yes,second,second

现在我的问题是:我如何查询它?我尝试了分类,但据我所知,结果只给了我值 {0,1,2},所以有两个类我无法区分(都是 0)。

同样的问题也适用于 wiki 中的 Iris 示例。此外,Encog 如何从输出神经元值推断 0/1/2 结果?

编辑:我发现的解决方案是为疾病 1 和疾病 2 使用单独的网络,但我真的很想知道是否可以将它们组合成一个。

4

1 回答 1

2

你是对的,你需要将输出列组合成一个值。Encog 分析师只会分类到单个输出列。该输出列可以有许多不同的值。因此,将两个输出列标准化为 none,first,second,both 都可以。如果您直接使用底层神经网络,您实际上可以训练两个输出,每个输出进行独立分类。但是对于这个讨论,我假设我们正在与分析师打交道。

您是使用工作台还是在代码中查询网络?默认情况下,Encog 分析师使用等边编码对神经网络进行编码。这导致输出神经元的数量等于 n-1,其中 n 是类的数量。如果您在分析向导中选择 n 之一编码,则 BasicNetwork 上的常规分类方法将起作用,因为它仅设计用于 n 之一。

如果您想使用等边查询(在代码中),那么您可以使用类似于以下的方法。我将此添加到下一个版本的 Encog。

/**
 * Used to classify a neural network that has been encoded using equilateral encoding.
 * This is the default for the Encog analyst. Equilateral encoding uses an output count
 * equal to the number of classes minus one.  
 * @param input The input to the neural network.
 * @param high The high value of the activation range, usually 1.
 * @param low The low end of the normalization range, usually -1 or 0. 
 * @return The class that the input belongs to.
 */
public int classifyEquilateral(final MLData input,double high, double low) {
    MLData result = this.compute(input);
    Equilateral eq = new Equilateral(getOutputCount()+1,high,low);
    return eq.decode(result.getData());
}
于 2014-05-29T15:59:34.053 回答