csv - Encog 使用自定义网络加载 CSV 文件

标签 csv encog

我想像这样从 CSV 文件加载数据:

var format = new CSVFormat('.', ' '); 
IVersatileDataSource source = new CSVDataSource(filename, false, format);
var data = new VersatileMLDataSet(source); ...

那么我有两个选择:

使用 EncogModel
var model = new EncogModel(data);
model.SelectMethod(data, MLMethodFactory.TypeFeedforward); ...

建立自己的网络
var network = new BasicNetwork();
network.AddLayer(new BasicLayer(null, true, 11));
network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 8));
network.AddLayer(new BasicLayer(new ActivationTANH(), true, 5)); 
...
IMLDataSet trainingSet = new BasicMLDataSet(input, output);

我不知道如何使用第一个选项(Encog 模型)设置层数、神经元和激活函数。我得到的只是一些只有一个隐藏层的默认前馈网络。

我不知道如何从 VersatileMLDataSet 轻松地为我自己的网络(第二个选项)分别获取输入和输出数组。我可以获得整个数组(输入 + 输出),但必须有一种方法如何只获取输入数组或输出数组。

最佳答案

我在文档(Encog Method & Training Factories,第 75 页)中找到了答案,使用 EncogModel 可以像这样自定义网络:

var methodFactory = new MLMethodFactory();
var method = methodFactory . Create(
MLMethodFactory .TYPEFEEDFORWARD,
”?:B−>SIGMOID−>4:B−>SIGMOID−>?”,
2,
1);

The above code creates a neural network with two input neurons and one output neuron. There are four hidden neurons. Bias neurons are placed on the input and hidden layers. As is typical for neural networks, there are no bias neurons on the output layer. The sigmoid activation function is used between both the input and hidden neuron, as well between the hidden and output layer. You may notice the two question marks in the neural network architecture string. These will be filled in by the input and output layer sizes specified in the create method and are optional. You can hard-code the input and output sizes. In this case the numbers specified in the create call will be ignored.

关于csv - Encog 使用自定义网络加载 CSV 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39521796/

相关文章:

android - Encog 在 Android 上运行速度太慢,该怎么办?

java - 如何加载和保存 NeuralDataSet 对象 - Encog Java

java - 使用 Hopfield 网络结果不佳

C++:读取由 ; 分隔的 CSV 文件与\n

python - 使用 stdout 时,如何阻止 Python 的 csv.DictWriter.writerows 在 Windows 中的行之间添加空行?

python - 在 Python 中连接数据帧时出现内存错误

python-3.x - 处理巨大 .csv 的最佳方法

xml - Powershell 将 xml 值解析为 csv

java - Encog - 使用交叉验证方法训练神经网络并验证训练

java - 时间序列预测 encog 3 java 从 CSV 读取