问题描述
我想像这样从CSV文件加载数据:
I want to load data from CSV file like this:
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模型)设置层数,神经元和激活功能.我得到的只是一些默认的前馈网络,该网络仅具有一个隐藏层.
I don't know how to set number of layers, neurons and activation functions with first option (Encog Model). All I get is some default feedforward network with one hidden layer only.
我不知道如何从VersatileMLDataSet轻松为我自己的网络(第二个选项)分别获取输入和输出数组.我可以获得整个数组(输入+输出),但是必须有一种方法仅获取输入数组或输出数组.
I don't know how can get easily input and output arrays separately for my own network (second option) from VersatileMLDataSet. I can get whole array (input + output), but there must be a way how to get only input array or output array.
推荐答案
我在文档( Encog方法和培训工厂,第75页)中找到了答案,使用EncogModel可以像这样自定义网络:
I found answer in documentation (Encog Method & Training Factories, page 75), with EncogModel is possible customize network like this:
var methodFactory = new MLMethodFactory();
var method = methodFactory . Create(
MLMethodFactory .TYPEFEEDFORWARD,
"?:B−>SIGMOID−>4:B−>SIGMOID−>?",
2,
1);
这篇关于使用自定义网络Encog加载CSV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!