use of edu.cmu.tetrad.algcomparison.simulation.LoadDataAndGraphs in project tetrad by cmu-phil.
the class TimeoutComparison method generateReportFromExternalAlgorithms.
public void generateReportFromExternalAlgorithms(String dataPath, String resultsPath, String outputFileName, Algorithms algorithms, Statistics statistics, Parameters parameters, long timeout, TimeUnit unit) {
this.saveGraphs = false;
this.dataPath = dataPath;
this.resultsPath = resultsPath;
for (Algorithm algorithm : algorithms.getAlgorithms()) {
if (!(algorithm instanceof ExternalAlgorithm)) {
throw new IllegalArgumentException("Expecting all algorithms to implement ExternalAlgorithm.");
}
}
Simulations simulations = new Simulations();
File file = new File(this.dataPath, "save");
File[] dirs = file.listFiles();
if (dirs == null) {
throw new NullPointerException("No files in " + file.getAbsolutePath());
}
this.dirs = new ArrayList<String>();
int count = 0;
for (File dir : dirs) {
if (dir.getName().contains("DS_Store")) {
continue;
}
count++;
}
for (int i = 1; i <= count; i++) {
File _dir = new File(dataPath, "save/" + i);
simulations.add(new LoadDataAndGraphs(_dir.getAbsolutePath()));
this.dirs.add(_dir.getAbsolutePath());
}
compareFromSimulations(this.resultsPath, simulations, outputFileName, algorithms, statistics, parameters, timeout, unit);
}
use of edu.cmu.tetrad.algcomparison.simulation.LoadDataAndGraphs in project tetrad by cmu-phil.
the class TimeoutComparison method compareFromFiles.
/**
* Compares algorithms.
*
* @param dataPath Path to the directory where data and graph files have
* been saved.
* @param resultsPath Path to the file where the results should be stored.
* @param algorithms The list of algorithms to be compared.
* @param statistics The list of statistics on which to compare the
* algorithm, and their utility weights.
* @param parameters The list of parameters and their values.
*/
public void compareFromFiles(String dataPath, String resultsPath, Algorithms algorithms, Statistics statistics, Parameters parameters, long timeout, TimeUnit unit) {
for (Algorithm algorithm : algorithms.getAlgorithms()) {
if (algorithm instanceof ExternalAlgorithm) {
throw new IllegalArgumentException("Not expecting any implementations of ExternalAlgorithm here.");
}
}
this.dataPath = dataPath;
this.resultsPath = resultsPath;
Simulations simulations = new Simulations();
File file = new File(this.dataPath, "save");
File[] dirs = file.listFiles();
if (dirs == null) {
throw new NullPointerException("No files in " + file.getAbsolutePath());
}
this.dirs = new ArrayList<String>();
int count = 0;
for (File dir : dirs) {
if (dir.getName().contains("DS_Store")) {
continue;
}
count++;
}
for (int i = 1; i <= count; i++) {
File _dir = new File(dataPath, "save/" + i);
simulations.add(new LoadDataAndGraphs(_dir.getAbsolutePath()));
this.dirs.add(_dir.getAbsolutePath());
}
compareFromSimulations(this.resultsPath, simulations, algorithms, statistics, parameters, timeout, unit);
}
use of edu.cmu.tetrad.algcomparison.simulation.LoadDataAndGraphs in project tetrad by cmu-phil.
the class Comparison method generateReportFromExternalAlgorithms.
public void generateReportFromExternalAlgorithms(String dataPath, String resultsPath, String outputFileName, Algorithms algorithms, Statistics statistics, Parameters parameters) {
this.saveGraphs = false;
this.dataPath = dataPath;
this.resultsPath = resultsPath;
for (Algorithm algorithm : algorithms.getAlgorithms()) {
if (!(algorithm instanceof ExternalAlgorithm))
throw new IllegalArgumentException("Expecting all algorithms to implement ExternalAlgorithm.");
}
Simulations simulations = new Simulations();
File file = new File(this.dataPath, "save");
File[] dirs = file.listFiles();
if (dirs == null) {
throw new NullPointerException("No files in " + file.getAbsolutePath());
}
this.dirs = new ArrayList<String>();
int count = 0;
for (File dir : dirs) {
if (dir.getName().contains("DS_Store"))
continue;
count++;
}
for (int i = 1; i <= count; i++) {
File _dir = new File(dataPath, "save/" + i);
simulations.add(new LoadDataAndGraphs(_dir.getAbsolutePath()));
this.dirs.add(_dir.getAbsolutePath());
}
compareFromSimulations(this.resultsPath, simulations, outputFileName, algorithms, statistics, parameters);
}
use of edu.cmu.tetrad.algcomparison.simulation.LoadDataAndGraphs in project tetrad by cmu-phil.
the class Comparison method compareFromFiles.
/**
* Compares algorithms.
*
* @param dataPath Path to the directory where data and graph files have been saved.
* @param resultsPath Path to the file where the results should be stored.
* @param algorithms The list of algorithms to be compared.
* @param statistics The list of statistics on which to compare the algorithm, and their utility weights.
* @param parameters The list of parameters and their values.
*/
public void compareFromFiles(String dataPath, String resultsPath, Algorithms algorithms, Statistics statistics, Parameters parameters) {
for (Algorithm algorithm : algorithms.getAlgorithms()) {
if (algorithm instanceof ExternalAlgorithm) {
throw new IllegalArgumentException("Not expecting any implementations of ExternalAlgorithm here.");
}
}
this.dataPath = dataPath;
this.resultsPath = resultsPath;
Simulations simulations = new Simulations();
File file = new File(this.dataPath, "save");
File[] dirs = file.listFiles();
if (dirs == null) {
throw new NullPointerException("No files in " + file.getAbsolutePath());
}
this.dirs = new ArrayList<String>();
int count = 0;
for (File dir : dirs) {
if (dir.getName().contains("DS_Store"))
continue;
count++;
}
for (int i = 1; i <= count; i++) {
File _dir = new File(dataPath, "save/" + i);
simulations.add(new LoadDataAndGraphs(_dir.getAbsolutePath()));
this.dirs.add(_dir.getAbsolutePath());
}
compareFromSimulations(this.resultsPath, simulations, algorithms, statistics, parameters);
}
Aggregations