Class ExternalAlgorithmBnlearnMmhc
java.lang.Object
edu.cmu.tetrad.algcomparison.algorithm.ExternalAlgorithm
edu.cmu.tetrad.algcomparison.algorithm.external.ExternalAlgorithmBnlearnMmhc
- All Implemented Interfaces:
Algorithm,HasParameters,TetradSerializable,Serializable
An API to allow results from external algorithms to be included in a report through the algrorithm
comparison tool. This one is for matrix generated by PC in pcalg. See below. This script can generate
the files in R.
library("MASS"); library("pcalg");
path<-"/Users/user/tetrad/comparison-final"; simulation<-1;
subdir<-"pc.solve.confl.TRUE"; dir.create(paste(path, "/save/", simulation, "/", subdir, sep=""));
for (i in 1:10) { data<-read.table(paste(path, "/save/", simulation, "/data/data.", i, ".txt", sep=""), header=TRUE) n<-nrow(data) C<-cor(data) v<-names(data) suffStat<-list(C = C, n=n) pc.fit<-pc(suffStat=suffStat, indepTest=gaussCItest, alpha=0.001, labels=v, solve.conf=TRUE) A<-as(pc.fit, "amat") name<-paste(path, "/save/", simulation, "/", subdir, "/graph.", i, ".txt", sep="") print(name) write.matrix(A, file=name, sep="\t") }
- Author:
- jdramsey
- See Also:
-
Field Summary
Fields inherited from class edu.cmu.tetrad.algcomparison.algorithm.ExternalAlgorithm
path, simIndex, simulation, usedParameters -
Constructor Summary
ConstructorsConstructorDescriptionExternalAlgorithmBnlearnMmhc(String extDir) ExternalAlgorithmBnlearnMmhc(String extDir, String shortDecription) -
Method Summary
Modifier and TypeMethodDescriptiongetComparisonGraph(Graph graph) Returns the CPDAG of the supplied DAG.Returns the data type that the search requires, whether continuous, discrete, or mixed.Returns a short, one-line description of this algorithm.longgetElapsedTime(DataModel dataSet, Parameters parameters) search(DataModel dataSet, Parameters parameters) Reads in the relevant graph from the file (see above) and returns it.Methods inherited from class edu.cmu.tetrad.algcomparison.algorithm.ExternalAlgorithm
getIndex, getNumDataModels, getParameters, getSimulation, setPath, setSimIndex, setSimulation
-
Constructor Details
-
ExternalAlgorithmBnlearnMmhc
-
ExternalAlgorithmBnlearnMmhc
-
-
Method Details
-
search
Reads in the relevant graph from the file (see above) and returns it.- Parameters:
dataSet- The data set to run to the search on.parameters- The paramters of the search.- Returns:
- The result graph.
-
getComparisonGraph
Returns the CPDAG of the supplied DAG.- Parameters:
graph- The true directed graph, if there is one.- Returns:
- The comparison graph.
-
getDescription
Description copied from interface:AlgorithmReturns a short, one-line description of this algorithm. This will be printed in the report.- Returns:
- This description.
-
getDataType
Description copied from interface:AlgorithmReturns the data type that the search requires, whether continuous, discrete, or mixed.- Returns:
- This type.
-
getElapsedTime
- Specified by:
getElapsedTimein classExternalAlgorithm
-