/// <inheritdoc/> public override sealed bool ExecuteCommand(String args) { // get filenames String sourceID = Prop.GetPropertyString( ScriptProperties.RandomizeConfigSourceFile); String targetID = Prop.GetPropertyString( ScriptProperties.RandomizeConfigTargetFile); EncogLogging.Log(EncogLogging.LevelDebug, "Beginning randomize"); EncogLogging.Log(EncogLogging.LevelDebug, "source file:" + sourceID); EncogLogging.Log(EncogLogging.LevelDebug, "target file:" + targetID); FileInfo sourceFile = Script.ResolveFilename(sourceID); FileInfo targetFile = Script.ResolveFilename(targetID); // get formats CSVFormat inputFormat = Script .DetermineInputFormat(sourceID); CSVFormat outputFormat = Script.DetermineOutputFormat(); // mark generated Script.MarkGenerated(targetID); // prepare to normalize var norm = new ShuffleCSV {Script = Script}; Analyst.CurrentQuantTask = norm; norm.Report = new AnalystReportBridge(Analyst); bool headers = Script.ExpectInputHeaders(sourceID); norm.Analyze(sourceFile, headers, inputFormat); norm.OutputFormat = outputFormat; norm.Process(targetFile); Analyst.CurrentQuantTask = null; return norm.ShouldStop(); }
public static void ShuffleCsv(FileInfo source, FileInfo destination) { var shuffle = new ShuffleCSV(); shuffle.Analyze(source, true, CSVFormat.English); shuffle.ProduceOutputHeaders = true; shuffle.Process(destination); }
public void TestShuffleHeaders() { GenerateTestFileHeadings(true); var norm = new ShuffleCSV(); norm.Analyze(InputName, true, CSVFormat.English); norm.Process(OutputName); var tr = new StreamReader(OutputName.ToString()); String line; IDictionary<String, int> list = new Dictionary<String, int>(); while ((line = tr.ReadLine()) != null) { list[line] = 0; } Assert.AreEqual(7, list.Count); tr.Close(); InputName.Delete(); OutputName.Delete(); }
public override sealed bool ExecuteCommand(string args) { FileInfo info2; CSVFormat format; CSVFormat format2; ShuffleCSV ecsv; bool flag; ShuffleCSV ecsv2; string propertyString = base.Prop.GetPropertyString("RANDOMIZE:CONFIG_sourceFile"); string filename = base.Prop.GetPropertyString("RANDOMIZE:CONFIG_targetFile"); EncogLogging.Log(0, "Beginning randomize"); EncogLogging.Log(0, "source file:" + propertyString); if ((((uint) flag) - ((uint) flag)) < 0) { goto Label_0094; } EncogLogging.Log(0, "target file:" + filename); FileInfo inputFile = base.Script.ResolveFilename(propertyString); goto Label_0167; Label_0027: ecsv.Analyze(inputFile, flag, format); ecsv.OutputFormat = format2; ecsv.Process(info2); if (((uint) flag) <= uint.MaxValue) { base.Analyst.CurrentQuantTask = null; return ecsv.ShouldStop(); } if ((((uint) flag) - ((uint) flag)) >= 0) { goto Label_00B7; } Label_0071: ecsv = ecsv2; if (((uint) flag) <= uint.MaxValue) { } base.Analyst.CurrentQuantTask = ecsv; Label_0094: ecsv.Report = new AnalystReportBridge(base.Analyst); flag = base.Script.ExpectInputHeaders(propertyString); if (0 == 0) { goto Label_0027; } Label_00B7: format2 = base.Script.DetermineOutputFormat(); base.Script.MarkGenerated(filename); ecsv2 = new ShuffleCSV(); if ((((uint) flag) + ((uint) flag)) >= 0) { ecsv2.Script = base.Script; if ((((uint) flag) & 0) == 0) { goto Label_0071; } goto Label_0027; } Label_0167: info2 = base.Script.ResolveFilename(filename); format = base.Script.DetermineInputFormat(propertyString); goto Label_00B7; }
/// <summary> /// Metodo responsavel por misturar as informacoes do dataset /// </summary> /// <param name="source">FileInfo com o caminho do Dataset original</param> private static void Shuffle(FileInfo source) { var shuffle = new ShuffleCSV(); shuffle.Analyze(source, true, CSVFormat.English); shuffle.ProduceOutputHeaders = true; shuffle.Process(Config.ShuffledClassificationFile); }
public static void ShuffleDataFile(FileOps fileOps) { var shuffle = new ShuffleCSV{ProduceOutputHeaders = true}; shuffle.Analyze(fileOps.BaseFile,true,CSVFormat.English); shuffle.Process(fileOps.ShuffledFile); }