public AddAnalystListener ( IAnalystListener listener ) : void | ||
listener | IAnalystListener | The listener to add. |
Результат | void |
public void TestClassification() { FileInfo rawFile = TEMP_DIR.CreateFile("simple.csv"); FileInfo egaFile = TEMP_DIR.CreateFile("simple.ega"); FileInfo outputFile = TEMP_DIR.CreateFile("simple_output.csv"); FileUtil.CopyResource("Encog.Resources.simple.csv", rawFile); FileUtil.CopyResource("Encog.Resources.simple-c.ega", egaFile); EncogAnalyst analyst = new EncogAnalyst(); analyst.AddAnalystListener(new ConsoleAnalystListener()); analyst.Load(egaFile); analyst.ExecuteTask("task-full"); ReadCSV csv = new ReadCSV(outputFile.ToString(), true, CSVFormat.English); while (csv.Next()) { Assert.AreEqual(csv.Get(3), csv.Get(4)); } Assert.AreEqual(4, analyst.Script.Fields.Length); Assert.AreEqual(3, analyst.Script.Fields[3].ClassMembers.Count); csv.Close(); }
public void TestClassification() { FileInfo rawFile = TEMP_DIR.CreateFile("simple.csv"); FileInfo egaFile = TEMP_DIR.CreateFile("simple.ega"); FileInfo outputFile = TEMP_DIR.CreateFile("simple_output.csv"); FileUtil.CopyResource("Encog.Resources.simple.csv", rawFile); FileUtil.CopyResource("Encog.Resources.simple-c.ega", egaFile); EncogAnalyst analyst = new EncogAnalyst(); analyst.AddAnalystListener(new ConsoleAnalystListener()); analyst.Load(egaFile); analyst.ExecuteTask("task-full"); ReadCSV csv = new ReadCSV(outputFile.ToString(), true, CSVFormat.English); while (csv.Next()) { Assert.AreEqual(csv.Get(3), csv.Get(4)); } Assert.AreEqual(4, analyst.Script.Fields.Length); Assert.AreEqual(3, analyst.Script.Fields[3].ClassMembers.Count); csv.Close(); }
public void Process(double maxError) { int cycles = 0; double e; EncogAnalyst.AddAnalystListener(new ConsoleAnalystListener()); do { EncogAnalyst.ExecuteTask("task-full"); e = CalculateError(); cycles++; Debug.WriteLine(cycles + ": Error = " + e); } while (cycles <= MaxCycles && e > maxError); Assert.IsTrue(cycles <= MaxCycles, "Too many cycles to perform successful train."); }
public void ForestExample(FileInfo dir) { Console.WriteLine("Starting forest cover dataset example."); Uri url = new Uri(FOREST_SOURCE); FileInfo analystFile = FileUtil.CombinePath(dir, "forest.ega"); FileInfo rawFile = FileUtil.CombinePath(dir, "forest_raw.csv"); EncogAnalyst encog = new EncogAnalyst(); encog.AddAnalystListener(new ConsoleAnalystListener()); AnalystWizard wiz = new AnalystWizard(encog); wiz.TaskBalance = true; wiz.Wizard(url, analystFile, rawFile, false, AnalystFileFormat.DecpntComma); encog.ExecuteTask("task-full"); encog.Save(analystFile); AnalystReport report = new AnalystReport(encog); report.ProduceReport(FileUtil.CombinePath(dir, "report.html")); }
public void IrisExample(FileInfo dir) { Console.WriteLine("Starting Iris dataset example."); Uri url = new Uri(IRIS_SOURCE); FileInfo analystFile = FileUtil.CombinePath(dir, "iris.ega"); FileInfo rawFile = FileUtil.CombinePath(dir, "iris_raw.csv"); EncogAnalyst encog = new EncogAnalyst(); encog.AddAnalystListener(new ConsoleAnalystListener()); AnalystWizard wiz = new AnalystWizard(encog); //wiz.TaskRandomize = false; wiz.Wizard(url, analystFile, rawFile, false, AnalystFileFormat.DecpntComma); encog.Save(analystFile); encog.ExecuteTask("task-full"); AnalystReport report = new AnalystReport(encog); report.ProduceReport(FileUtil.CombinePath(dir, "report.html")); }
private void AnalystCommand() { String egaFile; String task; if (_cmd.Args.Count == 0) { Console.WriteLine(@"Must specify the EGA file to run"); return; } if (_cmd.Args.Count == 1) { egaFile = _cmd.Args[0]; task = "task-full"; } else { egaFile = _cmd.Args[0]; task = _cmd.Args[1]; } _sw.Start(); var analyst = new EncogAnalyst(); analyst.AddAnalystListener(new ConsoleAnalystListener()); analyst.Load(new FileInfo(egaFile)); analyst.ExecuteTask(task); }