
com.github.vangj.jbayes.inf.prob.util.CsvUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jbayes-inference Show documentation
Show all versions of jbayes-inference Show documentation
A very cool project for BBN inference using approximate and exact algorithms.
The newest version!
package com.github.vangj.jbayes.inf.prob.util;
import au.com.bytecode.opencsv.CSVWriter;
import com.github.vangj.jbayes.inf.prob.Graph;
import java.io.IOException;
import java.io.Writer;
/**
* CSV util.
*/
public class CsvUtil {
private CsvUtil() {
}
public static void saveSamples(Graph graph, Writer writer) throws IOException {
String[] values = graph.getNodeNames();
try (CSVWriter csv =
new CSVWriter(writer,
CSVWriter.DEFAULT_SEPARATOR,
CSVWriter.DEFAULT_QUOTE_CHARACTER)) {
csv.writeNext(graph.getNodeNames());
graph.getSamples().forEach(line -> csv.writeNext(line));
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy