encog(二)神经网络的训练

Encog中有很多的训练方法。

EncogUtility是一个功能辅助类,提供了很多方便的函数

Modifier and TypeMethod and Description
static doublecalculateClassificationError(MLClassification method, MLDataSet data)
Calculate the classification error.
static doublecalculateRegressionError(MLRegression method, MLDataSet data) 
static voidconvertCSV2Binary(File csvFile, CSVFormat format, File binFile, int[] input, int[] ideal, boolean headers) 
static voidconvertCSV2Binary(File csvFile, File binFile, int inputCount, int outputCount, boolean headers)
Convert a CSV file to a binary training file.
static voidconvertCSV2Binary(String csvFile, String binFile, int inputCount, int outputCount, boolean headers)
Convert a CSV file to a binary training file.
static voidevaluate(MLRegression network, MLDataSet training)
Evaluate the network and display (to the console) the output for every value in the training set.
static voidexplainErrorMSE(MLRegression method, MatrixMLDataSet training) 
static voidexplainErrorRMS(MLRegression method, MatrixMLDataSet training) 
static StringformatNeuralData(MLData data)
Format neural data as a list of numbers.
static MLDataSetloadCSV2Memory(String filename, int input, int ideal, boolean headers, CSVFormat format, boolean significance)
Load CSV to memory.
static MLDataSetloadEGB2Memory(File filename) 
static voidsaveCSV(File targetFile, CSVFormat format, MLDataSet set) 
static voidsaveEGB(File f, MLDataSet data)
Save a training set to an EGB file.
static BasicNetworksimpleFeedForward(int input, int hidden1, int hidden2, int output, boolean tanh)
Create a simple feedforward neural network.
static voidtrainConsole(BasicNetwork network, MLDataSet trainingSet, int minutes)
Train the neural network, using SCG training, and output status to the console.
static voidtrainConsole(MLTrain train, BasicNetwork network, MLDataSet trainingSet, int minutes)
Train the network, using the specified training algorithm, and send the output to the console.
static voidtrainToError(MLMethod method, MLDataSet dataSet, double error)
Train the method, to a specific error, send the output to the console.
static voidtrainToError(MLTrain train, double error)
Train to a specific error, using the specified training method, send the output to the console.

BasicTraining类是所有训练方法类的父类

构造函数
BasicTraining()
Used for serialization.
BasicTraining(TrainingImplementationType implementationType) 

 

返回值成员函数
voidaddStrategy(Strategy strategy)
Training strategies can be added to improve the training results.
voidfinishTraining()
Should be called after training has completed and the iteration method will not be called any further.
doublegetError()
TrainingImplementationTypegetImplementationType() 
intgetIteration() 
List<Strategy>getStrategies() 
MLDataSetgetTraining() 
booleanisTrainingDone() 
voiditeration(int count)
Perform the specified number of training iterations.
voidpostIteration()
Call the strategies after an iteration.
voidpreIteration()
Call the strategies before an iteration.
voidsetError(double error) 
voidsetIteration(int iteration)
Set the current training iteration.
voidsetTraining(MLDataSet training)
Set the training object that this strategy is working with.

 

Backpropagation类是propagation类的子类

构造函数
Backpropagation(ContainsFlat network, MLDataSet training)
Create a class to train using backpropagation.

Backpropagation(ContainsFlat network, MLDataSet training, double theLearnRate, double theMomentum) 

第一个参数:将被训练的网络

第二个参数: 训练集

第三个参数:学习率

第四个参数: 梯度下降法中一种常用的加速技术。momentum是加速系数,momentum=0表示无加速,值越大表示加速越快。

 

返回值成员函数
booleancanContinue()
double[]getLastDelta() 
doublegetLearningRate() 
doublegetMomentum() 
voidinitOthers()
Perform training method specific init.
booleanisValidResume(TrainingContinuation state)
Determine if the specified continuation object is valid to resume with.
TrainingContinuationpause()
Pause the training.
voidresume(TrainingContinuation state)
Resume training.
voidsetLearningRate(double rate)
Set the learning rate, this is value is essentially a percent.
voidsetMomentum(double m)
Set the momentum for training.
doubleupdateWeight(double[] gradients, double[] lastGradient, int index)
Update a weight.

 

转载于:https://www.cnblogs.com/codeDog123/p/6754391.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值