Class ExternalAlgorithmBNTPc
- All Implemented Interfaces:
Algorithm
,HasParameters
,TetradSerializable
,Serializable
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") }
- Version:
- $Id: $Id
- Author:
- josephramsey
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionExternalAlgorithmBNTPc
(String extDir) Constructor for ExternalAlgorithmBNTPc.ExternalAlgorithmBNTPc
(String extDir, String shortDecription) Constructor for ExternalAlgorithmBNTPc. -
Method Summary
Modifier and TypeMethodDescriptiongetComparisonGraph
(Graph graph) Returns that graph that the result should be compared to.Returns the data type that the search requires, whether continuous, discrete, or mixed.getDescription.long
getElapsedTime
(DataModel dataSet, Parameters parameters) getElapsedTime.search
(DataModel dataSet, Parameters parameters) Runs the search.Methods inherited from class edu.cmu.tetrad.algcomparison.algorithm.ExternalAlgorithm
getIndex, getNumDataModels, getParameters, getSimulation, setPath, setSimIndex, setSimulation
-
Constructor Details
-
Method Details
-
search
Runs the 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 that graph that the result should be compared to.Returns the CPDAG of the supplied DAG.
- Parameters:
graph
- The true directed graph, if there is one.- Returns:
- The comparison graph.
-
getDescription
getDescription.
- Returns:
- a
String
object
-
getDataType
Returns the data type that the search requires, whether continuous, discrete, or mixed.- Returns:
- This type.
-
getElapsedTime
getElapsedTime.
- Specified by:
getElapsedTime
in classExternalAlgorithm
- Parameters:
dataSet
- aDataModel
objectparameters
- aParameters
object- Returns:
- a long
-