public static void ShuffleCsv(FileInfo source, FileInfo destination) { var shuffle = new ShuffleCSV(); shuffle.Analyze(source, true, CSVFormat.English); shuffle.ProduceOutputHeaders = true; shuffle.Process(destination); }
/// <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 format = Script.DetermineFormat(); // 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, format); norm.Process(targetFile); Analyst.CurrentQuantTask = null; return norm.ShouldStop(); }
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(); }
/// <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); }