本文整理汇总了C#中Encog.Neural.Networks.BasicNetwork.CalculateError方法的典型用法代码示例。如果您正苦于以下问题:C# BasicNetwork.CalculateError方法的具体用法?C# BasicNetwork.CalculateError怎么用?C# BasicNetwork.CalculateError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encog.Neural.Networks.BasicNetwork
的用法示例。
在下文中一共展示了BasicNetwork.CalculateError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EvaluateMPROP
public double EvaluateMPROP(BasicNetwork network, IMLDataSet data)
{
var train = new ResilientPropagation(network, data);
long start = DateTime.Now.Ticks;
Console.WriteLine(@"Training 20 Iterations with MPROP");
for (int i = 1; i <= 20; i++)
{
train.Iteration();
Console.WriteLine("Iteration #" + i + " Error:" + train.Error);
}
//train.finishTraining();
long stop = DateTime.Now.Ticks;
double diff = new TimeSpan(stop - start).Seconds;
Console.WriteLine("MPROP Result:" + diff + " seconds.");
Console.WriteLine("Final MPROP error: " + network.CalculateError(data));
return diff;
}
示例2: Evaluate
public double Evaluate(BasicNetwork network, IMLDataSet training)
{
var rprop = new ResilientPropagation(network, training);
double startingError = network.CalculateError(training);
for (int i = 0; i < ITERATIONS; i++)
{
rprop.Iteration();
}
double finalError = network.CalculateError(training);
return startingError - finalError;
}
示例3: Train
public void Train()
{
TrainingErrorData.Clear();
TestingIdealData.Clear();
TestingResultsData.Clear();
_network = ConstructNetwork(TrainingSet.InputSize,TrainingSet.IdealSize);
//var trainer = new Backpropagation(_network, TrainingSet, LearningRate, Momentum);
var trainer = new ResilientPropagation(_network, TrainingSet);
double[] resultsArray = new double[TrainingSet.Count];
double[] errorArray = new double[NumberOfIterations];
IsBusy = true;
for (int iteration = 0; iteration < numberOfIterations; iteration++)
{
trainer.Iteration();
TrainingErrorData.Add(new Tuple<int,double>(iteration, trainer.Error));
}
IsBusy = false;
for(int i = 0; i < TrainingSet.Count; i++)
{
resultsArray[i] = _network.Classify(TrainingSet[i].Input);
}
TrainingErrorValue = _network.CalculateError(TrainingSet);
Stage = Stage.Trained;
}