machine-learning - Encog查询分类

标签 machine-learning neural-network encog

我正在尝试处理 this dataset使用Encog。为了做到这一点,我将输出合并为一个(似乎无法弄清楚如何使用多个预期输出,即使我没有成功地尝试手动训练具有 4 个输出神经元的神经网络),其值为:“disease1”, “疾病2”、“无”和“两者”。

从这里开始,使用 CSV 中的分析向导,自动过程使用预期输出训练神经网络。文件中的峰值:

"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 使用单独的网络,但我真的很想知道是否可以将它们合并为一个。

最佳答案

您是对的,您需要将输出列合并为单个值。 Encog 分析师将仅分类到单个输出列。该输出列可以有许多不同的值。因此,将两个输出列规范化为“无”、“第一”、“第二”、“两者”都会起作用。如果直接使用底层神经网络,您实际上可以训练两个输出,每个输出进行独立的分类。但对于这次讨论,我假设我们正在与分析师打交道。

您是使用工作台还是在代码中查询网络?默认情况下,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());
}

关于machine-learning - Encog查询分类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23844676/

相关文章:

machine-learning - 图像上的文本检测

machine-learning - ROC曲线形状

python - 如何让keras+theano使用>1个核心

artificial-intelligence - 人工神经网络的真实用途

python - scikit-neuralnetwork 中神经网络的反向传播和结构

neural-network - 如何在无监督学习中使用 Encog NEAT 网络?

java - Encog,保存到经过训练的网络文件

tensorflow - 联结主义时间分类 (CTC) 空白标签

python - 在 Tensorflow 中使用您自己的数据

c# - 教 ANN 如何添加