gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 01:57:10 25 4
gpt4 key购买 nike

我想像这样从 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com