本文整理汇总了C#中Encog.Neural.Networks.BasicNetwork.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# BasicNetwork.Reset方法的具体用法?C# BasicNetwork.Reset怎么用?C# BasicNetwork.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encog.Neural.Networks.BasicNetwork
的用法示例。
在下文中一共展示了BasicNetwork.Reset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
//create a neural network withtout using a factory
var network = new BasicNetwork();
network.AddLayer(new BasicLayer(null, true, 2));
network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 2));
network.AddLayer(new BasicLayer(new ActivationSigmoid(), false, 1));
network.Structure.FinalizeStructure();
network.Reset();
IMLDataSet trainingSet = new BasicMLDataSet(XORInput, XORIdeal);
IMLTrain train = new ResilientPropagation(network, trainingSet);
int epoch = 1;
do
{
train.Iteration();
Console.WriteLine($"Epoch #{epoch} Error: {train.Error}");
epoch++;
} while (train.Error > 0.01);
train.FinishTraining();
Console.WriteLine("Neural Network Results:");
foreach (IMLDataPair iPair in trainingSet)
{
IMLData output = network.Compute(iPair.Input);
Console.WriteLine($"{iPair.Input[0]}, {iPair.Input[0]}, actual={output[0]}, ideal={iPair.Ideal[0]}");
}
EncogFramework.Instance.Shutdown();
Console.ReadKey();
}
示例2: Main
static void Main(string[] args)
{
var network = new BasicNetwork();
network.AddLayer(new BasicLayer(null, true, 2));
network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 3));
network.AddLayer(new BasicLayer(new ActivationSigmoid(), false, 1));
network.Structure.FinalizeStructure();
network.Reset();
var trainingSet = new BasicMLDataSet(XORInput, XORIdeal);
var train = new ResilientPropagation(network, trainingSet);
var epoch = 1;
do
{
train.Iteration();
} while (train.Error > 0.01);
train.FinishTraining();
foreach (var pair in trainingSet)
{
var output = network.Compute(pair.Input);
Console.WriteLine(pair.Input[0] + @", " + pair.Input[1] + @" , actual=" + output[0] + @", ideal=" + pair.Ideal[0]);
}
EncogFramework.Instance.Shutdown();
Console.ReadLine();
}
示例3: BenchmarkEncog
public static long BenchmarkEncog(double[][] input, double[][] output)
{
BasicNetwork network = new BasicNetwork();
network.AddLayer(new BasicLayer(null, true,
input[0].Length));
network.AddLayer(new BasicLayer(new ActivationSigmoid(), true,
HIDDEN_COUNT));
network.AddLayer(new BasicLayer(new ActivationSigmoid(), false,
output[0].Length));
network.Structure.FinalizeStructure();
network.Reset();
IMLDataSet trainingSet = new BasicMLDataSet(input, output);
// train the neural network
IMLTrain train = new Backpropagation(network, trainingSet, 0.7, 0.7);
Stopwatch sw = new Stopwatch();
sw.Start();
// run epoch of learning procedure
for (int i = 0; i < ITERATIONS; i++)
{
train.Iteration();
}
sw.Stop();
return sw.ElapsedMilliseconds;
}
示例4: Execute
/// <summary>
/// Program entry point.
/// </summary>
/// <param name="app">Holds arguments and other info.</param>
public void Execute(IExampleInterface app)
{
// create a neural network, without using a factory
var network = new BasicNetwork();
network.AddLayer(new BasicLayer(null, true, 2));
network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 3));
network.AddLayer(new BasicLayer(new ActivationSigmoid(), false, 1));
network.Structure.FinalizeStructure();
network.Reset();
// create training data
IMLDataSet trainingSet = new BasicMLDataSet(XORInput, XORIdeal);
// train the neural network
IMLTrain train = new ResilientPropagation(network, trainingSet);
int epoch = 1;
do
{
train.Iteration();
Console.WriteLine(@"Epoch #" + epoch + @" Error:" + train.Error);
epoch++;
} while (train.Error > 0.01);
// test the neural network
Console.WriteLine(@"Neural Network Results:");
foreach (IMLDataPair pair in trainingSet)
{
IMLData output = network.Compute(pair.Input);
Console.WriteLine(pair.Input[0] + @"," + pair.Input[1]
+ @", actual=" + output[0] + @",ideal=" + pair.Ideal[0]);
}
}
示例5: Preprocessing_Completed
private void Preprocessing_Completed(object sender, RunWorkerCompletedEventArgs e)
{
worker.ReportProgress(0, "Creating Network...");
BasicNetwork Network = new BasicNetwork();
Network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, DataContainer.NeuralNetwork.Data.InputSize));
Network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 50));
Network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, DataContainer.NeuralNetwork.Data.IdealSize));
Network.Structure.FinalizeStructure();
Network.Reset();
DataContainer.NeuralNetwork.Network = Network;
ResilientPropagation training = new ResilientPropagation(DataContainer.NeuralNetwork.Network, DataContainer.NeuralNetwork.Data);
worker.ReportProgress(0, "Running Training: Epoch 0");
for(int i = 0; i < 200; i++)
{
training.Iteration();
worker.ReportProgress(0, "Running Training: Epoch " + (i+1).ToString() + " Current Training Error : " + training.Error.ToString());
if(worker.CancellationPending == true)
{
completed = true;
return;
}
}
completed = true;
}
示例6: CreateNetwork
/// <summary>
/// Metodo responsavel por criar a rede neural
/// </summary>
/// <param name="source">FileInfo com o path do network</param>
private static void CreateNetwork(FileInfo source)
{
var network = new BasicNetwork();
network.AddLayer(new BasicLayer(new ActivationLinear(), true, 4));
network.AddLayer(new BasicLayer(new ActivationTANH(), true, 6));
network.AddLayer(new BasicLayer(new ActivationTANH(), false, 2));
network.Structure.FinalizeStructure();
network.Reset();
EncogDirectoryPersistence.SaveObject(source, (BasicNetwork)network);
}
示例7: generateNetwork
public BasicNetwork generateNetwork()
{
BasicNetwork network = new BasicNetwork();
network.AddLayer(new BasicLayer(MultiThreadBenchmark.INPUT_COUNT));
network.AddLayer(new BasicLayer(MultiThreadBenchmark.HIDDEN_COUNT));
network.AddLayer(new BasicLayer(MultiThreadBenchmark.OUTPUT_COUNT));
network.Structure.FinalizeStructure();
network.Reset();
return network;
}
示例8: Create
public void Create(int inputnodes,int hiddennodes)
{
network = new BasicNetwork();
network.AddLayer(new BasicLayer(null, true, inputnodes));
network.AddLayer(new BasicLayer(new ActivationTANH(), true, hiddennodes));
network.AddLayer(new BasicLayer(new ActivationLinear(), false, 1));
network.Structure.FinalizeStructure();
network.Reset();
this.hiddennodes = hiddennodes;
}
示例9: generateNetwork
public BasicNetwork generateNetwork()
{
var network = new BasicNetwork();
network.AddLayer(new BasicLayer(INPUT_COUNT));
network.AddLayer(new BasicLayer(HIDDEN_COUNT));
network.AddLayer(new BasicLayer(OUTPUT_COUNT));
network.Structure.FinalizeStructure();
network.Reset();
return network;
}
示例10: CreateNetwork
public static void CreateNetwork(FileOps fileOps)
{
var network = new BasicNetwork();
network.AddLayer(new BasicLayer(new ActivationLinear(),true,4));
network.AddLayer(new BasicLayer(new ActivationTANH(), true, 6));
network.AddLayer(new BasicLayer(new ActivationTANH(), true, 2));
network.Structure.FinalizeStructure();
network.Reset();
EncogDirectoryPersistence.SaveObject(fileOps.TrainedNeuralNetworkFile, network);
}
示例11: CreateNetwork
private static BasicNetwork CreateNetwork()
{
var network = new BasicNetwork();
network.AddLayer(new BasicLayer(null, true, 2));
network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 2));
network.AddLayer(new BasicLayer(new ActivationSigmoid(), false, 1));
network.Structure.FinalizeStructure();
network.Reset();
return network;
}
示例12: createElliott
public static BasicNetwork createElliott()
{
BasicNetwork network = new BasicNetwork();
network.AddLayer(new BasicLayer(null, true, INPUT_OUTPUT));
network.AddLayer(new BasicLayer(new ActivationElliottSymmetric(), true, HIDDEN));
network.AddLayer(new BasicLayer(new ActivationElliottSymmetric(), false, INPUT_OUTPUT));
network.Structure.FinalizeStructure();
network.Reset();
return network;
}
示例13: PSO
public PSO()
{
network = new BasicNetwork();
network.AddLayer(new BasicLayer(5));
network.AddLayer(new BasicLayer(1));
network.AddLayer(new BasicLayer(1));
network.Structure.FinalizeStructure();
network.Reset();
IMLDataSet dataSet = new BasicMLDataSet();
dataSet.Add(new BasicMLData(new double[] { 1.0, 4.0, 3.0, 4.0, 5.0}) , new BasicMLData(new double[] { 2.0, 4.0, 6.0 , 8.0, 10} ));
train = new NeuralPSO(network, new RangeRandomizer(0, 10), new TrainingSetScore(dataSet),5);
}
示例14: Generate
public IMLMethod Generate()
{
BasicLayer layer;
BasicLayer layer2;
BasicNetwork network = new BasicNetwork();
if ((0 != 0) || (0 == 0))
{
network.AddLayer(layer2 = new BasicLayer(this._x2a5a4034520336f3, true, this._xcfe830a7176c14e5));
}
network.AddLayer(layer = new BasicLayer(this._x2a5a4034520336f3, true, this._xdf89f9cf9fc3d06f));
network.AddLayer(new BasicLayer(null, false, this._x8f581d694fca0474));
layer2.ContextFedBy = layer;
network.Structure.FinalizeStructure();
network.Reset();
return network;
}
示例15: Experiment
public static void Experiment()
{
BasicNetwork net = new BasicNetwork();
net.AddLayer(
new BasicLayer(new ActivationLinear(), false, 3));
net.AddLayer(
new BasicLayer(new ActivationTANH(), true, 3));
net.AddLayer(
new BasicLayer(new ActivationLinear(), false, 2));
net.Structure.FinalizeStructure();
//Задание случайных весов?
net.Reset();
}