本文整理汇总了C#中IExampleInterface类的典型用法代码示例。如果您正苦于以下问题:C# IExampleInterface类的具体用法?C# IExampleInterface怎么用?C# IExampleInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IExampleInterface类属于命名空间,在下文中一共展示了IExampleInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Execute
public void Execute(IExampleInterface app)
{
//placed a try catch in case something bugs.
try
{
//lets check the lenght of the input from the console.
if (app.Args.Length < 1)
{
Console.WriteLine(@"MarketPredict [generate/train/prune/evaluate] [PathToFile]");
Console.WriteLine(@"e.g csvMarketPredict [generate/train/prune/evaluate] c:\\EURUSD.csv");
}
//looks like we are fine.
else
{
//save the files in the directory where the consoleexample.exe is located.
FileInfo dataDir = new FileInfo(@"c:\");
//we generate the network , by calling the CSVloader.
if (String.Compare(app.Args[0], "generate", true) == 0)
{
Console.WriteLine("Generating your network with file:" + app.Args[1]);
MarketBuildTraining.Generate(app.Args[1]);
}
//train the network here.
else if (String.Compare(app.Args[0], "train", true) == 0)
{
MarketTrain.Train(dataDir);
}
//Evaluate the network that was built and trained.
else if (String.Compare(app.Args[0], "evaluate", true) == 0)
{
MarketEvaluate.Evaluate(dataDir,app.Args[1]);
}
//Lets prune the network.
else if (String.Compare(app.Args[0], "prune", true) == 0)
{
MarketPrune.Incremental(dataDir);
}
else
{
Console.WriteLine("Didnt understand the command you typed:" + app.Args[0]);
}
}
}
catch (Exception ex)
{
Console.WriteLine("Error Message:"+ ex.Message);
Console.WriteLine("Error Innerexception:" + ex.InnerException);
Console.WriteLine("Error stacktrace:" + ex.StackTrace);
Console.WriteLine("Error source:" + ex.Source);
}
}
开发者ID:Romiko,项目名称:encog-dotnet-core,代码行数:60,代码来源:mytests.cs
示例2: Execute
/// <summary>
/// Program entry point.
/// </summary>
/// <param name="app">Holds arguments and other info.</param>
public void Execute(IExampleInterface app)
{
BasicNetwork network = CreateNetwork();
IMLTrain train;
if (app.Args.Length > 0 && String.Compare(app.Args[0], "anneal", true) == 0)
{
train = new NeuralSimulatedAnnealing(
network, new PilotScore(), 10, 2, 100);
}
else
{
train = new NeuralGeneticAlgorithm(
network, new FanInRandomizer(),
new PilotScore(), 500, 0.1, 0.25);
}
int epoch = 1;
for (int i = 0; i < 50; i++)
{
train.Iteration();
Console.WriteLine(@"Epoch #" + epoch + @" Score:" + train.Error);
epoch++;
}
Console.WriteLine(@"\nHow the winning network landed:");
network = (BasicNetwork) train.Method;
var pilot = new NeuralPilot(network, true);
Console.WriteLine(pilot.ScorePilot());
EncogFramework.Instance.Shutdown();
}
开发者ID:tonyc2a,项目名称:encog-dotnet-core,代码行数:37,代码来源:LunarLander.cs
示例3: Execute
/// <summary>
/// Program entry point.
/// </summary>
/// <param name="app">Holds arguments and other info.</param>
public void Execute(IExampleInterface app)
{
var network = new FlatNetwork(2, 4, 0, 1, false);
network.Randomize();
IMLDataSet trainingSet = new BasicMLDataSet(XORInput, XORIdeal);
var train = new TrainFlatNetworkResilient(network, trainingSet);
int epoch = 1;
do
{
train.Iteration();
Console.WriteLine(@"Epoch #" + epoch + @" Error:" + train.Error);
epoch++;
} while (train.Error > 0.01);
var output = new double[1];
// test the neural network
Console.WriteLine(@"Neural Network Results:");
foreach (IMLDataPair pair in trainingSet)
{
double[] input = pair.Input.Data;
network.Compute(input, output);
Console.WriteLine(input[0] + @"," + input[1] + @":" + output[0]);
}
}
开发者ID:tonyc2a,项目名称:encog-dotnet-core,代码行数:33,代码来源:XORFlat.cs
示例4: Execute
/// <summary>
/// Program entry point.
/// </summary>
/// <param name="app">Holds arguments and other info.</param>
public void Execute(IExampleInterface app)
{
IMLDataSet trainingSet = new BasicMLDataSet(XORInput, XORIdeal);
FlatNetwork network = CreateNetwork();
Console.WriteLine(@"Starting Weights:");
DisplayWeights(network);
Evaluate(network, trainingSet);
var train = new TrainFlatNetworkResilient(
network, trainingSet);
for (int iteration = 1; iteration <= ITERATIONS; iteration++)
{
train.Iteration();
Console.WriteLine();
Console.WriteLine(@"*** Iteration #" + iteration);
Console.WriteLine(@"Error: " + train.Error);
Evaluate(network, trainingSet);
Console.WriteLine(@"LastGrad:"
+ FormatArray(train.LastGradient));
Console.WriteLine(@"Updates :"
+ FormatArray(train.UpdateValues));
DisplayWeights(network);
}
}
开发者ID:tonyc2a,项目名称:encog-dotnet-core,代码行数:34,代码来源:XORDisplay.cs
示例5: Execute
public void Execute(IExampleInterface app)
{
if (app.Args.Length != 2)
{
Console.WriteLine("Usage: AnalystExample [iris/forest] [data directory]");
Console.WriteLine("Data directory can be any empty directory. Raw files will be downloaded to here.");
return;
}
String command = app.Args[0].Trim().ToLower();
var dir = new FileInfo(app.Args[1].Trim());
var example = new AnalystExample();
if (String.Compare(command, "forest", true) == 0)
{
example.ForestExample(dir);
}
else if (String.Compare(command, "iris", true) == 0)
{
example.IrisExample(dir);
}
else
{
Console.WriteLine("Unknown command: " + command);
}
}
开发者ID:fxmozart,项目名称:encog-dotnet-core,代码行数:26,代码来源:AnalystExample.cs
示例6: Execute
public void Execute(IExampleInterface app)
{
// create a neural network, without using a factory
var svm = new SupportVectorMachine(1,true); // 1 input, & true for regression
// create training data
IMLDataSet trainingSet = new BasicMLDataSet(RegressionInput, RegressionIdeal);
// train the SVM
IMLTrain train = new SVMSearchTrain(svm, trainingSet);
int epoch = 1;
do
{
train.Iteration();
Console.WriteLine(@"Epoch #" + epoch + @" Error:" + train.Error);
epoch++;
} while (train.Error > 0.01);
// test the SVM
Console.WriteLine(@"SVM Results:");
foreach (IMLDataPair pair in trainingSet)
{
IMLData output = svm.Compute(pair.Input);
Console.WriteLine(pair.Input[0]
+ @", actual=" + output[0] + @",ideal=" + pair.Ideal[0]);
}
}
开发者ID:Romiko,项目名称:encog-dotnet-core,代码行数:29,代码来源:RegressionSVM.cs
示例7: TrainElmhanNetwork
public static void TrainElmhanNetwork(ref IExampleInterface app)
{
BasicMLDataSet set = CreateEval.CreateEvaluationSetAndLoad(app.Args[1], CONFIG.STARTING_YEAR,
CONFIG.TRAIN_END,
CONFIG.INPUT_WINDOW,
CONFIG.PREDICT_WINDOW);
//create our network.
BasicNetwork network =
(BasicNetwork)CreateEval.CreateElmanNetwork(CONFIG.INPUT_WINDOW, CONFIG.PREDICT_WINDOW);
//Train it..
double LastError = CreateEval.TrainNetworks(network, set);
Console.WriteLine("NetWork Trained to :" + LastError);
SuperUtils.SaveTraining(CONFIG.DIRECTORY, CONFIG.TRAINING_FILE, set);
SuperUtils.SaveNetwork(CONFIG.DIRECTORY, CONFIG.NETWORK_FILE, network);
Console.WriteLine("Network Saved to :" + CONFIG.DIRECTORY + " File Named :" +
CONFIG.NETWORK_FILE);
Console.WriteLine("Training Saved to :" + CONFIG.DIRECTORY + " File Named :" +
CONFIG.TRAINING_FILE);
MakeAPause();
}
开发者ID:jongh0,项目名称:MTree,代码行数:25,代码来源:marketpredict.cs
示例8: Execute
public void Execute(IExampleInterface app)
{
for (int i = 1; i < 16; i++)
{
Perform(i);
}
}
开发者ID:JDFagan,项目名称:encog-dotnet-core,代码行数:7,代码来源:ThreadCount.cs
示例9: Execute
public void Execute(IExampleInterface app)
{
if (app.Args.Length < 3)
{
Console.WriteLine(@"MarketPredict [data dir] [generate/train/prune/evaluate] PathToFile");
Console.WriteLine(@"e.g csvMarketPredict [data dir] [generate/train/prune/evaluate] c:\\EURUSD.csv");
}
else
{
FileInfo dataDir = new FileInfo(Environment.CurrentDirectory);
if (String.Compare(app.Args[0], "generate", true) == 0)
{
MarketBuildTraining.Generate(app.Args[1]);
}
else if (String.Compare(app.Args[0], "train", true) == 0)
{
MarketTrain.Train(dataDir);
}
else if (String.Compare(app.Args[0], "evaluate", true) == 0)
{
MarketEvaluate.Evaluate(dataDir,app.Args[1]);
}
else if (String.Compare(app.Args[0], "prune", true) == 0)
{
{
MarketPrune.Incremental(dataDir);
}
}
}
}
开发者ID:adnmaster,项目名称:encog-dotnet-core,代码行数:30,代码来源:marketpredict.cs
示例10: Execute
public void Execute(IExampleInterface app)
{
if (app.Args.Length != 2)
{
Console.WriteLine(@"Note: This example assumes that headers are present in the CSV files.");
Console.WriteLine(@"NormalizeFile [input file] [target file]");
}
else
{
var sourceFile = new FileInfo(app.Args[0]);
var targetFile = new FileInfo(app.Args[1]);
var analyst = new EncogAnalyst();
var wizard = new AnalystWizard(analyst);
wizard.Wizard(sourceFile, true, AnalystFileFormat.DecpntComma);
DumpFieldInfo(analyst);
var norm = new AnalystNormalizeCSV();
norm.Analyze(sourceFile, true, CSVFormat.English, analyst);
norm.ProduceOutputHeaders = true;
norm.Normalize(targetFile);
EncogFramework.Instance.Shutdown();
}
}
开发者ID:johannsutherland,项目名称:encog-dotnet-core,代码行数:25,代码来源:NormalizeFile.cs
示例11: Execute
public void Execute(IExampleInterface app)
{
this.app = app;
// Create the neural network.
BasicLayer hopfield;
var network = new HopfieldNetwork(4);
// This pattern will be trained
bool[] pattern1 = {true, true, false, false};
// This pattern will be presented
bool[] pattern2 = {true, false, false, false};
IMLData result;
var data1 = new BiPolarMLData(pattern1);
var data2 = new BiPolarMLData(pattern2);
var set = new BasicMLDataSet();
set.Add(data1);
// train the neural network with pattern1
app.WriteLine("Training Hopfield network with: "
+ FormatBoolean(data1));
network.AddPattern(data1);
// present pattern1 and see it recognized
result = network.Compute(data1);
app.WriteLine("Presenting pattern:" + FormatBoolean(data1)
+ ", and got " + FormatBoolean(result));
// Present pattern2, which is similar to pattern 1. Pattern 1
// should be recalled.
result = network.Compute(data2);
app.WriteLine("Presenting pattern:" + FormatBoolean(data2)
+ ", and got " + FormatBoolean(result));
}
开发者ID:JDFagan,项目名称:encog-dotnet-core,代码行数:34,代码来源:HopfieldSimple.cs
示例12: Execute
public void Execute(IExampleInterface app)
{
// build the bayesian network structure
BayesianNetwork network = new BayesianNetwork();
BayesianEvent BlueTaxi = network.CreateEvent("blue_taxi");
BayesianEvent WitnessSawBlue = network.CreateEvent("saw_blue");
network.CreateDependency(BlueTaxi, WitnessSawBlue);
network.FinalizeStructure();
// build the truth tales
BlueTaxi.Table.AddLine(0.85, true);
WitnessSawBlue.Table.AddLine(0.80, true, true);
WitnessSawBlue.Table.AddLine(0.20, true, false);
// validate the network
network.Validate();
// display basic stats
Console.WriteLine(network.ToString());
Console.WriteLine("Parameter count: " + network.CalculateParameterCount());
EnumerationQuery query = new EnumerationQuery(network);
//SamplingQuery query = new SamplingQuery(network);
query.DefineEventType(WitnessSawBlue, EventType.Evidence);
query.DefineEventType(BlueTaxi, EventType.Outcome);
query.SetEventValue(WitnessSawBlue, false);
query.SetEventValue(BlueTaxi, false);
query.Execute();
Console.WriteLine(query.ToString());
}
开发者ID:Romiko,项目名称:encog-dotnet-core,代码行数:27,代码来源:BayesianTaxi.cs
示例13: Execute
public void Execute(IExampleInterface app)
{
if (app.Args.Length < 2)
{
Console.WriteLine(@"MarketPredict [data dir] [generate/train/prune/evaluate]");
}
else
{
var dataDir = new FileInfo(app.Args[0]);
if (String.Compare(app.Args[1], "generate", true) == 0)
{
MarketBuildTraining.Generate(dataDir);
}
else if (String.Compare(app.Args[1], "train", true) == 0)
{
MarketTrain.Train(dataDir);
}
else if (String.Compare(app.Args[1], "evaluate", true) == 0)
{
MarketEvaluate.Evaluate(dataDir);
}
else if (String.Compare(app.Args[1], "prune", true) == 0)
{
{
MarketPrune.Incremental(dataDir);
}
}
}
}
开发者ID:JDFagan,项目名称:encog-dotnet-core,代码行数:29,代码来源:MarketPredict.cs
示例14: Execute
public void Execute(IExampleInterface app)
{
this.app = app;
if (this.app.Args.Length < 1)
{
this.app.WriteLine("Must specify command file. See source for format.");
}
else
{
// Read the file and display it line by line.
StreamReader file =
new System.IO.StreamReader(this.app.Args[0]);
while ((line = file.ReadLine()) != null)
{
ExecuteLine();
}
file.Close();
}
}
开发者ID:OperatorOverload,项目名称:encog-cs,代码行数:26,代码来源:ImageNeuralNetwork.cs
示例15: 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]);
}
}
开发者ID:johannsutherland,项目名称:encog-dotnet-core,代码行数:38,代码来源:XORHelloWorld.cs
示例16: Execute
public void Execute(IExampleInterface app)
{
GetForexPairData();
EvaluateEnd = EvaluateStart + 100;
NormalizeForexPair(-1, 1);
var network = (BasicNetwork)CreateElmanNetwork(WindowSize);
IMLDataSet training = GenerateTraining();
Train(network, training);
Predict(network);
}
开发者ID:johannsutherland,项目名称:encog-dotnet-core,代码行数:10,代码来源:ForexMarketTrain.cs
示例17: Execute
public void Execute(IExampleInterface app)
{
IMLDataSet trainingData = GenerateTraining(InputOutputCount, Compl);
IMLMethod method = EncogUtility.SimpleFeedForward(InputOutputCount,
HiddenCount, 0, InputOutputCount, false);
var train = new LevenbergMarquardtTraining((BasicNetwork) method, trainingData);
EncogUtility.TrainToError(train, 0.01);
EncogFramework.Instance.Shutdown();
}
开发者ID:JDFagan,项目名称:encog-dotnet-core,代码行数:10,代码来源:FahlmanEncoder.cs
示例18: Execute
public void Execute(IExampleInterface app)
{
PredictSP500 predict = new PredictSP500();
if (app.Args.Length > 0 && app.Args[0].Equals("full"))
predict.run(true);
else
predict.run(false);
Console.ReadKey();
}
开发者ID:JDFagan,项目名称:encog-dotnet-core,代码行数:11,代码来源:PredictSP500.cs
示例19: Execute
public void Execute(IExampleInterface app)
{
this.app = app;
IMLDataSet trainingSet = new BasicMLDataSet(XOR_INPUT, XOR_IDEAL);
BasicNetwork network = EncogUtility.SimpleFeedForward(2, 6, 0, 1, false);
EncogUtility.TrainToError(network, trainingSet, 0.01);
double error = network.CalculateError(trainingSet);
EncogDirectoryPersistence.SaveObject(new FileInfo(FILENAME), network);
double error2 = network.CalculateError(trainingSet);
app.WriteLine("Error before save to EG: " + Format.FormatPercent(error));
app.WriteLine("Error before after to EG: " + Format.FormatPercent(error2));
}
开发者ID:JDFagan,项目名称:encog-dotnet-core,代码行数:12,代码来源:PersistEncog.cs
示例20: Execute
public void Execute(IExampleInterface app)
{
this.app = app;
Console.WriteLine("Waiting for connections on port " + PORT);
IndicatorServer server = new IndicatorServer();
server.AddListener(this);
server.AddIndicatorFactory(new MyFactory());
server.Start();
}
开发者ID:framirezh,项目名称:encog-dotnet-core,代码行数:12,代码来源:RemoteEMA.cs
注:本文中的IExampleInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论