...
 
Commits (13)
......@@ -8,3 +8,12 @@ Fixed PCall loading knowledge
Fixed data reader missing value bugs
Fixed simulation data disappearing
Fixed general contract warnings
6.5.1
Fixed simulation data disappearing bug
Fixed knowledge box variable dragging bug
6.5.2
Fixed simulation from im box bug
......@@ -18,7 +18,6 @@
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
///////////////////////////////////////////////////////////////////////////////
package edu.cmu.tetradapp.model;
import edu.cmu.tetrad.bayes.BayesIm;
......@@ -32,7 +31,6 @@ import edu.cmu.tetrad.graph.NodeType;
import edu.cmu.tetrad.session.SessionModel;
import edu.cmu.tetrad.util.TetradLogger;
import edu.cmu.tetrad.util.TetradSerializableUtils;
import java.io.IOException;
import java.io.ObjectInputStream;
......@@ -41,7 +39,8 @@ import java.io.ObjectInputStream;
*
* @author Joseph Ramsey
*/
public class BayesEstimatorWrapper implements SessionModel, GraphSource {
public class BayesEstimatorWrapper implements SessionModel {
static final long serialVersionUID = 23L;
/**
......@@ -60,9 +59,8 @@ public class BayesEstimatorWrapper implements SessionModel, GraphSource {
private DataSet dataSet;
//=================================CONSTRUCTORS========================//
public BayesEstimatorWrapper(DataWrapper dataWrapper,
BayesPmWrapper bayesPmWrapper) {
BayesPmWrapper bayesPmWrapper) {
if (dataWrapper instanceof Simulation) {
......@@ -85,7 +83,6 @@ public class BayesEstimatorWrapper implements SessionModel, GraphSource {
// if (DataUtils.containsMissingValue(dataSet)) {
// throw new IllegalArgumentException("Please remove or impute missing values.");
// }
System.out.println(dataSet);
estimate(dataSet, bayesPm);
......@@ -113,7 +110,6 @@ public class BayesEstimatorWrapper implements SessionModel, GraphSource {
// estimate(dataSet, bayesPm);
// log(bayesIm);
// }
/**
* Generates a simple exemplar of this class to test serialization.
*
......@@ -124,9 +120,6 @@ public class BayesEstimatorWrapper implements SessionModel, GraphSource {
}
//==============================PUBLIC METHODS========================//
public BayesIm getEstimatedBayesIm() {
return this.bayesIm;
}
......@@ -137,8 +130,8 @@ public class BayesEstimatorWrapper implements SessionModel, GraphSource {
for (Object o : graph.getNodes()) {
Node node = (Node) o;
if (node.getNodeType() == NodeType.LATENT) {
throw new IllegalArgumentException("Estimation of Bayes IM's " +
"with latents is not supported.");
throw new IllegalArgumentException("Estimation of Bayes IM's "
+ "with latents is not supported.");
}
}
......@@ -149,11 +142,10 @@ public class BayesEstimatorWrapper implements SessionModel, GraphSource {
try {
MlBayesEstimator estimator = new MlBayesEstimator();
this.bayesIm = estimator.estimate(bayesPm, dataSet);
}
catch (ArrayIndexOutOfBoundsException e) {
} catch (ArrayIndexOutOfBoundsException e) {
e.printStackTrace();
throw new RuntimeException("Value assignments between Bayes PM " +
"and discrete data set do not match.");
throw new RuntimeException("Value assignments between Bayes PM "
+ "and discrete data set do not match.");
}
}
......@@ -200,14 +192,8 @@ public class BayesEstimatorWrapper implements SessionModel, GraphSource {
}
//======================== Private Methods ======================//
private void log(BayesIm im) {
TetradLogger.getInstance().log("info", "ML estimated Bayes IM.");
TetradLogger.getInstance().log("im", im.toString());
}
}
......@@ -18,25 +18,19 @@
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
///////////////////////////////////////////////////////////////////////////////
package edu.cmu.tetradapp.model;
import edu.cmu.tetrad.algcomparison.simulation.BayesNetSimulation;
import edu.cmu.tetrad.algcomparison.simulation.SemSimulation;
import edu.cmu.tetrad.bayes.BayesIm;
import edu.cmu.tetrad.bayes.BayesPm;
import edu.cmu.tetrad.bayes.MlBayesIm;
import edu.cmu.tetrad.data.KnowledgeBoxInput;
import edu.cmu.tetrad.graph.Dag;
import edu.cmu.tetrad.graph.Graph;
import edu.cmu.tetrad.graph.Node;
import edu.cmu.tetrad.sem.Parameter;
import edu.cmu.tetrad.session.SessionModel;
import edu.cmu.tetrad.util.Memorable;
import edu.cmu.tetrad.util.Parameters;
import edu.cmu.tetrad.util.TetradLogger;
import edu.cmu.tetrad.util.TetradSerializableUtils;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
......@@ -47,7 +41,8 @@ import java.util.List;
*
* @author Joseph Ramsey
*/
public class BayesImWrapper implements SessionModel, Memorable, GraphSource {
public class BayesImWrapper implements SessionModel, Memorable {
static final long serialVersionUID = 23L;
private int numModels = 1;
......@@ -65,7 +60,6 @@ public class BayesImWrapper implements SessionModel, Memorable, GraphSource {
private List<BayesIm> bayesIms;
//===========================CONSTRUCTORS===========================//
public BayesImWrapper(BayesPmWrapper bayesPmWrapper, BayesImWrapper oldBayesImwrapper, Parameters params) {
if (bayesPmWrapper == null) {
throw new NullPointerException("BayesPmWrapper must not be null.");
......@@ -206,7 +200,6 @@ public class BayesImWrapper implements SessionModel, Memorable, GraphSource {
// BayesPm pm = new BayesPm(graph);
// setBayesIm(new MlBayesIm(pm));
// }
/**
* Generates a simple exemplar of this class to test serialization.
*
......@@ -218,12 +211,10 @@ public class BayesImWrapper implements SessionModel, Memorable, GraphSource {
}
//=============================PUBLIC METHODS=========================//
public BayesIm getBayesIm() {
return bayesIms.get(getModelIndex());
}
public Graph getGraph() {
return getBayesIm().getBayesPm().getDag();
}
......@@ -237,7 +228,6 @@ public class BayesImWrapper implements SessionModel, Memorable, GraphSource {
}
//============================== private methods ============================//
private void log(BayesIm im) {
TetradLogger.getInstance().log("info", "Maximum likelihood Bayes IM");
TetradLogger.getInstance().log("im", im.toString());
......@@ -277,7 +267,6 @@ public class BayesImWrapper implements SessionModel, Memorable, GraphSource {
return getGraph().getNodes();
}
public void setBayesIm(BayesIm bayesIm) {
bayesIms = new ArrayList<>();
bayesIms.add(bayesIm);
......@@ -299,9 +288,3 @@ public class BayesImWrapper implements SessionModel, Memorable, GraphSource {
this.modelIndex = modelIndex;
}
}
......@@ -18,15 +18,12 @@
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
///////////////////////////////////////////////////////////////////////////////
package edu.cmu.tetradapp.model;
import edu.cmu.tetrad.bayes.BayesIm;
import edu.cmu.tetrad.bayes.BayesPm;
import edu.cmu.tetrad.bayes.MlBayesIm;
import edu.cmu.tetrad.bayes.MlBayesImObs;
import edu.cmu.tetrad.data.KnowledgeBoxInput;
import edu.cmu.tetrad.graph.Dag;
import edu.cmu.tetrad.graph.Graph;
import edu.cmu.tetrad.graph.Node;
import edu.cmu.tetrad.session.SessionModel;
......@@ -34,19 +31,18 @@ import edu.cmu.tetrad.util.Memorable;
import edu.cmu.tetrad.util.Parameters;
import edu.cmu.tetrad.util.TetradLogger;
import edu.cmu.tetrad.util.TetradSerializableUtils;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.List;
///////////////////////////////////////////////////////////
// Wraps a Bayes Im (observed variables only) for use
// Wraps a Bayes Im (observed variables only) for use
// in the Tetrad application.
//
// @author Joseph Ramsey
///////////////////////////////////////////////////////////
public class BayesImWrapperObs implements SessionModel, Memorable {
public class BayesImWrapperObs implements SessionModel, Memorable, GraphSource {
static final long serialVersionUID = 23L;
/**
......@@ -60,16 +56,14 @@ public class BayesImWrapperObs implements SessionModel, Memorable, GraphSource {
private BayesIm bayesIm;
//===========================CONSTRUCTORS===========================//
/////////////////////////////////////////////////////////////////
// Disregard all other methods of instantiating an IM
// Only constructed from a PM or from another BayesIm
//
// If from a regular BayesIm, the new probability values are
// the marginalized values of the allowUnfaithfulness probability values in
// the old BayesIm, stored in a JPD
//
/////////////////////////////////////////////////////////////////
// Disregard all other methods of instantiating an IM
// Only constructed from a PM or from another BayesIm
//
// If from a regular BayesIm, the new probability values are
// the marginalized values of the allowUnfaithfulness probability values in
// the old BayesIm, stored in a JPD
//
// public BayesImWrapperObs(BayesPmWrapper bayesPmWrapper,
// BayesImWrapperObs oldBayesImwrapper,
// Parameters params) {
......@@ -95,7 +89,7 @@ public class BayesImWrapperObs implements SessionModel, Memorable, GraphSource {
// log(bayesIm);
// }
/*
/*
public BayesImWrapperObs(BayesEstimatorWrapper wrapper) {
if (wrapper == null) {
throw new NullPointerException();
......@@ -143,8 +137,7 @@ public class BayesImWrapperObs implements SessionModel, Memorable, GraphSource {
this.bayesIm = wrapper.getBayesUpdater().getUpdatedBayesIm();
log(bayesIm);
}
*/
*/
public BayesImWrapperObs(BayesPmWrapper bayesPmWrapper, Parameters params) {
if (bayesPmWrapper == null) {
throw new NullPointerException("BayesPmWrapper must not be null.");
......@@ -166,7 +159,7 @@ public class BayesImWrapperObs implements SessionModel, Memorable, GraphSource {
log(bayesIm);
}
// // from regular allowUnfaithfulness BayesIm
// // marginalize the probability values from the old BayesIm
// public BayesImWrapperObs(BayesImWrapper bayesImWrapper) {
......@@ -178,7 +171,6 @@ public class BayesImWrapperObs implements SessionModel, Memorable, GraphSource {
//
// log(bayesIm);
// }
// // from BayesIm with only observed variables
// public BayesImWrapperObs(BayesImWrapperObs bayesImWrapperObs) {
// if (bayesImWrapperObs == null) {
......@@ -189,7 +181,6 @@ public class BayesImWrapperObs implements SessionModel, Memorable, GraphSource {
//
// log(bayesIm);
// }
// // brand new BayesIm
// public BayesImWrapperObs() {
// Dag graph = new Dag();
......@@ -199,23 +190,20 @@ public class BayesImWrapperObs implements SessionModel, Memorable, GraphSource {
//
// log(bayesIm);
// }
/**
* Generates a simple exemplar of this class to test serialization.
*
* @see TetradSerializableUtils
*/
public static PcRunner serializableInstance() {
public static PcRunner serializableInstance() {
return PcRunner.serializableInstance();
}
//=============================PUBLIC METHODS=========================//
public BayesIm getBayesIm() {
return this.bayesIm;
}
public Graph getGraph() {
return bayesIm.getBayesPm().getDag();
}
......@@ -229,10 +217,9 @@ public class BayesImWrapperObs implements SessionModel, Memorable, GraphSource {
}
//============================== private methods ============================//
private void log(BayesIm im) {
TetradLogger.getInstance().log("info",
"Maximum likelihood Bayes IM: Observed Variables Only");
TetradLogger.getInstance().log("info",
"Maximum likelihood Bayes IM: Observed Variables Only");
TetradLogger.getInstance().log("im", im.toString());
}
......@@ -258,30 +245,23 @@ public class BayesImWrapperObs implements SessionModel, Memorable, GraphSource {
}
}
public Graph getSourceGraph() {
return getGraph();
}
public Graph getSourceGraph() {
return getGraph();
}
public Graph getResultGraph() {
return getGraph();
}
public List<String> getVariableNames() {
return getGraph().getNodeNames();
}
public List<Node> getVariables() {
return getGraph().getNodes();
}
return getGraph().getNodeNames();
}
public List<Node> getVariables() {
return getGraph().getNodes();
}
public void setBayesIm(BayesIm bayesIm) {
this.bayesIm = bayesIm;
}
}
......@@ -18,26 +18,21 @@
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
///////////////////////////////////////////////////////////////////////////////
package edu.cmu.tetradapp.model;
import edu.cmu.tetrad.algcomparison.simulation.BayesNetSimulation;
import edu.cmu.tetrad.algcomparison.simulation.SemSimulation;
import edu.cmu.tetrad.bayes.BayesIm;
import edu.cmu.tetrad.bayes.BayesPm;
import edu.cmu.tetrad.data.DataSet;
import edu.cmu.tetrad.data.DiscreteVariable;
import edu.cmu.tetrad.data.KnowledgeBoxInput;
import edu.cmu.tetrad.graph.Dag;
import edu.cmu.tetrad.graph.Graph;
import edu.cmu.tetrad.graph.GraphNode;
import edu.cmu.tetrad.graph.Node;
import edu.cmu.tetrad.sem.SemIm;
import edu.cmu.tetrad.session.SessionModel;
import edu.cmu.tetrad.util.Parameters;
import edu.cmu.tetrad.util.TetradLogger;
import edu.cmu.tetrad.util.TetradSerializableUtils;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
......@@ -50,7 +45,8 @@ import java.util.Map;
*
* @author Joseph Ramsey
*/
public class BayesPmWrapper implements SessionModel, GraphSource {
public class BayesPmWrapper implements SessionModel {
static final long serialVersionUID = 23L;
private int numModels = 1;
private int modelIndex = 0;
......@@ -64,7 +60,6 @@ public class BayesPmWrapper implements SessionModel, GraphSource {
private List<BayesPm> bayesPms;
//==============================CONSTRUCTORS=========================//
/**
* Creates a new BayesPm from the given DAG and uses it to construct a new
* BayesPm.
......@@ -164,7 +159,7 @@ public class BayesPmWrapper implements SessionModel, GraphSource {
* new BayesPm.
*
* @throws RuntimeException If the parent graph cannot be converted into a
* DAG.
* DAG.
*/
public BayesPmWrapper(GraphWrapper graphWrapper, Parameters params) {
if (graphWrapper == null) {
......@@ -174,7 +169,6 @@ public class BayesPmWrapper implements SessionModel, GraphSource {
// if (graphWrapper.getGraph().getNodes().isEmpty()) {
// throw new IllegalArgumentException("The parent graph is empty.");
// }
Dag graph;
try {
......@@ -200,7 +194,7 @@ public class BayesPmWrapper implements SessionModel, GraphSource {
}
public BayesPmWrapper(GraphWrapper graphWrapper,
BayesPmWrapper oldBayesPmWrapper, Parameters params) {
BayesPmWrapper oldBayesPmWrapper, Parameters params) {
try {
if (graphWrapper == null) {
throw new NullPointerException("Graph must not be null.");
......@@ -215,11 +209,9 @@ public class BayesPmWrapper implements SessionModel, GraphSource {
int lowerBound, upperBound;
// params.set("initializationMode", "automatic");
if (params.getString("initializationMode", "manualRetain").equals("manualRetain")) {
lowerBound = upperBound = 2;
BayesPm bayesPm = new BayesPm(graph,
oldBayesPmWrapper.getBayesPm(), lowerBound, upperBound);
setBayesPm(bayesPm);
......@@ -251,12 +243,12 @@ public class BayesPmWrapper implements SessionModel, GraphSource {
}
public BayesPmWrapper(Graph graph, DataWrapper dataWrapper) {
DataSet dataSet =
(DataSet) dataWrapper.getSelectedDataModel();
DataSet dataSet
= (DataSet) dataWrapper.getSelectedDataModel();
List vars = dataSet.getVariables();
Map<String, DiscreteVariable> nodesToVars =
new HashMap<>();
Map<String, DiscreteVariable> nodesToVars
= new HashMap<>();
for (int i = 0; i < dataSet.getNumColumns(); i++) {
DiscreteVariable var = (DiscreteVariable) vars.get(i);
String name = var.getName();
......@@ -286,7 +278,7 @@ public class BayesPmWrapper implements SessionModel, GraphSource {
}
public BayesPmWrapper(GraphWrapper graphWrapper,
Simulation simulation) {
Simulation simulation) {
this(graphWrapper, (DataWrapper) simulation);
}
......@@ -307,7 +299,7 @@ public class BayesPmWrapper implements SessionModel, GraphSource {
}
public BayesPmWrapper(BayesEstimatorWrapper wrapper,
DataWrapper dataWrapper) {
DataWrapper dataWrapper) {
this(new Dag(wrapper.getGraph()), dataWrapper);
}
......@@ -316,7 +308,7 @@ public class BayesPmWrapper implements SessionModel, GraphSource {
* new BayesPm.
*
* @throws RuntimeException If the parent graph cannot be converted into a
* DAG.
* DAG.
*/
public BayesPmWrapper(DagWrapper dagWrapper, Parameters params) {
if (dagWrapper == null) {
......@@ -348,7 +340,7 @@ public class BayesPmWrapper implements SessionModel, GraphSource {
}
public BayesPmWrapper(DagWrapper dagWrapper,
BayesPmWrapper oldBayesPmWrapper, Parameters params) {
BayesPmWrapper oldBayesPmWrapper, Parameters params) {
try {
if (dagWrapper == null) {
throw new NullPointerException("Graph must not be null.");
......@@ -383,11 +375,11 @@ public class BayesPmWrapper implements SessionModel, GraphSource {
}
public BayesPmWrapper(DagWrapper dagWrapper, DataWrapper dataWrapper) {
DataSet dataSet =
(DataSet) dataWrapper.getSelectedDataModel();
DataSet dataSet
= (DataSet) dataWrapper.getSelectedDataModel();
List vars = dataSet.getVariables();
Map<String, DiscreteVariable> nodesToVars =
new HashMap<>();
Map<String, DiscreteVariable> nodesToVars
= new HashMap<>();
for (int i = 0; i < dataSet.getNumColumns(); i++) {
DiscreteVariable var = (DiscreteVariable) vars.get(i);
String name = var.getName();
......@@ -433,7 +425,6 @@ public class BayesPmWrapper implements SessionModel, GraphSource {
}
//=============================PUBLIC METHODS========================//
public BayesPm getBayesPm() {
return bayesPms.get(getModelIndex());
}
......@@ -469,7 +460,6 @@ public class BayesPmWrapper implements SessionModel, GraphSource {
}
//================================= Private Methods ==================================//
private void log(BayesPm pm) {
TetradLogger.getInstance().log("info", "Bayes Parametric Model (Bayes PM)");
TetradLogger.getInstance().log("pm", pm.toString());
......@@ -508,10 +498,3 @@ public class BayesPmWrapper implements SessionModel, GraphSource {
this.modelIndex = modelIndex;
}
}
......@@ -18,23 +18,17 @@
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
///////////////////////////////////////////////////////////////////////////////
package edu.cmu.tetradapp.model;
import edu.cmu.tetrad.algcomparison.simulation.GeneralSemSimulation;
import edu.cmu.tetrad.bayes.BayesPm;
import edu.cmu.tetrad.bayes.DirichletBayesIm;
import edu.cmu.tetrad.bayes.DirichletEstimator;
import edu.cmu.tetrad.data.DataSet;
import edu.cmu.tetrad.data.KnowledgeBoxInput;
import edu.cmu.tetrad.graph.Graph;
import edu.cmu.tetrad.graph.Node;
import edu.cmu.tetrad.sem.GeneralizedSemIm;
import edu.cmu.tetrad.session.SessionModel;
import edu.cmu.tetrad.util.Parameters;
import edu.cmu.tetrad.util.TetradLogger;
import edu.cmu.tetrad.util.TetradSerializableUtils;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.List;
......@@ -44,7 +38,8 @@ import java.util.List;
*
* @author Joseph Ramsey
*/
public class DirichletBayesImWrapper implements SessionModel, GraphSource, KnowledgeBoxInput {
public class DirichletBayesImWrapper implements SessionModel, KnowledgeBoxInput {
static final long serialVersionUID = 23L;
/**
......@@ -58,13 +53,12 @@ public class DirichletBayesImWrapper implements SessionModel, GraphSource, Knowl
private DirichletBayesIm dirichletBayesIm;
//===========================CONSTRUCTORS=============================//
public DirichletBayesImWrapper(Simulation simulation) {
throw new NullPointerException("Sorry, that was not a Dirichlet Bayes IM simulation.");
}
public DirichletBayesImWrapper(BayesPmWrapper bayesPmWrapper,
Parameters params) {
Parameters params) {
if (bayesPmWrapper == null) {
throw new NullPointerException("BayesPmWrapper must not be null.");
}
......@@ -109,11 +103,9 @@ public class DirichletBayesImWrapper implements SessionModel, GraphSource, Knowl
//
// log(this.dirichletBayesIm);
// }
// public DirichletBayesImWrapper(BayesPmWrapper bayesPmWrapper, Simulation simulation) {
// this(bayesPmWrapper, (DataWrapper) simulation);
// }
public DirichletBayesImWrapper(DirichletEstimatorWrapper wrapper) {
if (wrapper == null) {
throw new NullPointerException();
......@@ -134,7 +126,6 @@ public class DirichletBayesImWrapper implements SessionModel, GraphSource, Knowl
}
//================================PUBLIC METHODS=======================//
public DirichletBayesIm getDirichletBayesIm() {
return this.dirichletBayesIm;
}
......@@ -189,14 +180,8 @@ public class DirichletBayesImWrapper implements SessionModel, GraphSource, Knowl
return getGraph().getNodes();
}
private void log(DirichletBayesIm im) {
TetradLogger.getInstance().log("info", "Dirichlet Bayes IM");
TetradLogger.getInstance().log("im", im.toString());
}
}
......@@ -18,7 +18,6 @@
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
///////////////////////////////////////////////////////////////////////////////
package edu.cmu.tetradapp.model;
import edu.cmu.tetrad.bayes.DirichletBayesIm;
......@@ -30,7 +29,6 @@ import edu.cmu.tetrad.session.SessionModel;
import edu.cmu.tetrad.util.Parameters;
import edu.cmu.tetrad.util.TetradLogger;
import edu.cmu.tetrad.util.TetradSerializableUtils;
import java.io.IOException;
import java.io.ObjectInputStream;
......@@ -39,7 +37,8 @@ import java.io.ObjectInputStream;
*
* @author Joseph Ramsey
*/
public class DirichletEstimatorWrapper implements SessionModel, GraphSource {
public class DirichletEstimatorWrapper implements SessionModel {
static final long serialVersionUID = 23L;
/**
......@@ -53,7 +52,6 @@ public class DirichletEstimatorWrapper implements SessionModel, GraphSource {
private DirichletBayesIm dirichletBayesIm;
//============================CONSTRUCTORS============================//
public DirichletEstimatorWrapper(DataWrapper dataWrapper,
DirichletBayesImWrapper dirichletPriorWrapper) {
if (dataWrapper == null) {
......@@ -64,21 +62,20 @@ public class DirichletEstimatorWrapper implements SessionModel, GraphSource {
throw new NullPointerException();
}
DataSet dataSet =
(DataSet) dataWrapper.getSelectedDataModel();
DataSet dataSet
= (DataSet) dataWrapper.getSelectedDataModel();
if (DataUtils.containsMissingValue(dataSet)) {
throw new IllegalArgumentException("Please remove or impute missing values.");
}
DirichletBayesIm dirichletBayesIm =
dirichletPriorWrapper.getDirichletBayesIm();
DirichletBayesIm dirichletBayesIm
= dirichletPriorWrapper.getDirichletBayesIm();
try {
this.dirichletBayesIm =
DirichletEstimator.estimate(dirichletBayesIm, dataSet);
}
catch (IllegalArgumentException e) {
this.dirichletBayesIm
= DirichletEstimator.estimate(dirichletBayesIm, dataSet);
} catch (IllegalArgumentException e) {
throw new RuntimeException(
"Please fully specify the Dirichlet prior first.");
}
......@@ -115,7 +112,6 @@ public class DirichletEstimatorWrapper implements SessionModel, GraphSource {
// }
// log(dirichletBayesIm);
// }
public DirichletEstimatorWrapper(DataWrapper dataWrapper,
BayesPmWrapper bayesPmWrapper, Parameters params) {
if (dataWrapper == null) {
......@@ -130,16 +126,15 @@ public class DirichletEstimatorWrapper implements SessionModel, GraphSource {
throw new NullPointerException();
}
DataSet dataSet =
(DataSet) dataWrapper.getSelectedDataModel();
DataSet dataSet
= (DataSet) dataWrapper.getSelectedDataModel();
if (DataUtils.containsMissingValue(dataSet)) {
throw new IllegalArgumentException("Please remove or impute missing values.");
}
DirichletBayesIm dirichletBayesIm =
DirichletBayesIm.symmetricDirichletIm(
DirichletBayesIm dirichletBayesIm
= DirichletBayesIm.symmetricDirichletIm(
bayesPmWrapper.getBayesPm(),
params.getDouble("symmetricAlpha", 1.0));
......@@ -148,14 +143,13 @@ public class DirichletEstimatorWrapper implements SessionModel, GraphSource {
}
try {
this.dirichletBayesIm =
DirichletEstimator.estimate(dirichletBayesIm, dataSet);
}
catch (IllegalArgumentException e) {
this.dirichletBayesIm
= DirichletEstimator.estimate(dirichletBayesIm, dataSet);
} catch (IllegalArgumentException e) {
throw new RuntimeException(
"Please fully specify the Dirichlet prior first.");
}
log(dirichletBayesIm);
log(dirichletBayesIm);
}
/**
......@@ -168,7 +162,6 @@ public class DirichletEstimatorWrapper implements SessionModel, GraphSource {
}
//===============================PUBLIC METHODS=======================//
public DirichletBayesIm getEstimatedBayesIm() {
return this.dirichletBayesIm;
}
......@@ -183,8 +176,8 @@ public class DirichletEstimatorWrapper implements SessionModel, GraphSource {
* of the class that didn't include it. (That's what the
* "s.defaultReadObject();" is for. See J. Bloch, Effective Java, for help.
*
LogUtils.getInstance().finer("Estimated Bayes IM:");
* LogUtils.getInstance().finer("Estimated Bayes IM:");
*
* @throws java.io.IOException
* @throws ClassNotFoundException
*/
......@@ -209,17 +202,10 @@ public class DirichletEstimatorWrapper implements SessionModel, GraphSource {
this.name = name;
}
private void log(DirichletBayesIm im){
private void log(DirichletBayesIm im) {
TetradLogger.getInstance().log("info", "Estimated Dirichlet Bayes IM");
TetradLogger.getInstance().log("im", "" + im);
TetradLogger.getInstance().reset();
}
}
......@@ -18,7 +18,6 @@
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
///////////////////////////////////////////////////////////////////////////////
package edu.cmu.tetradapp.model;
import edu.cmu.tetrad.algcomparison.simulation.GeneralSemSimulation;
......@@ -30,19 +29,18 @@ import edu.cmu.tetrad.sem.GeneralizedSemPm;
import edu.cmu.tetrad.session.SessionModel;
import edu.cmu.tetrad.util.TetradLogger;
import edu.cmu.tetrad.util.TetradSerializableUtils;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.List;
/**
* Wraps a Bayes Pm for use in the Tetrad application.
*
* @author Joseph Ramsey
*/
public class GeneralizedSemImWrapper implements SessionModel, GraphSource, KnowledgeBoxInput {
public class GeneralizedSemImWrapper implements SessionModel, KnowledgeBoxInput {
static final long serialVersionUID = 23L;
/**
......@@ -61,7 +59,6 @@ public class GeneralizedSemImWrapper implements SessionModel, GraphSource, Knowl
private boolean showErrors;
//==============================CONSTRUCTORS==========================//
public GeneralizedSemImWrapper(Simulation simulation) {
List<GeneralizedSemIm> semIms = new ArrayList<>();
......@@ -92,7 +89,6 @@ public class GeneralizedSemImWrapper implements SessionModel, GraphSource, Knowl
}
}
private GeneralizedSemImWrapper(GeneralizedSemPm semPm) {
if (semPm == null) {
throw new NullPointerException("SEM PM must not be null.");
......@@ -123,7 +119,6 @@ public class GeneralizedSemImWrapper implements SessionModel, GraphSource, Knowl
}
//============================PUBLIC METHODS=========================//
public List<GeneralizedSemIm> getSemIms() {
return this.semIms;
}
......@@ -171,29 +166,25 @@ public class GeneralizedSemImWrapper implements SessionModel, GraphSource, Knowl
}
//======================= Private methods ====================//
private void log(GeneralizedSemIm im){
private void log(GeneralizedSemIm im) {
TetradLogger.getInstance().log("info", "Generalized SEM IM");
TetradLogger.getInstance().log("im", im.toString());
}
public Graph getSourceGraph() {
return getGraph();
}
public Graph getSourceGraph() {
return getGraph();
}
public Graph getResultGraph() {
return getGraph();
}
public List<String> getVariableNames() {
return getGraph().getNodeNames();
}
public List<Node> getVariables() {
return getGraph().getNodes();
}
return getGraph().getNodeNames();
}
public List<Node> getVariables() {
return getGraph().getNodes();
}
}
......@@ -18,7 +18,6 @@
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
///////////////////////////////////////////////////////////////////////////////
package edu.cmu.tetradapp.model;
import edu.cmu.tetrad.algcomparison.simulation.GeneralSemSimulation;
......@@ -31,7 +30,6 @@ import edu.cmu.tetrad.sem.TemplateExpander;
import edu.cmu.tetrad.session.SessionModel;
import edu.cmu.tetrad.util.TetradLogger;
import edu.cmu.tetrad.util.TetradSerializableUtils;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.text.ParseException;
......@@ -39,13 +37,13 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Wraps a Bayes Pm for use in the Tetrad application.
*
* @author Joseph Ramsey
*/
public class GeneralizedSemPmWrapper implements SessionModel, GraphSource, KnowledgeBoxInput {
public class GeneralizedSemPmWrapper implements SessionModel, KnowledgeBoxInput {
static final long serialVersionUID = 23L;
/**
......@@ -66,7 +64,6 @@ public class GeneralizedSemPmWrapper implements SessionModel, GraphSource, Knowl
private boolean showErrors;
//==============================CONSTRUCTORS==========================//
public GeneralizedSemPmWrapper(Simulation simulation) {
GeneralizedSemPm semPm = null;
......@@ -105,8 +102,7 @@ public class GeneralizedSemPmWrapper implements SessionModel, GraphSource, Knowl
} else {
try {
this.semPm = new GeneralizedSemPm(new SemGraph(graph));
}
catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
......@@ -143,7 +139,6 @@ public class GeneralizedSemPmWrapper implements SessionModel, GraphSource, Knowl
// System.out.println("\nnode = " + node);
// System.out.println("Parents = " + parents);
// System.out.println("Old referenced names = " + oldReferencedNames);
String template;
if (semPm.getVariableNodes().contains(node)) {
......@@ -160,10 +155,8 @@ public class GeneralizedSemPmWrapper implements SessionModel, GraphSource, Knowl
//
}
this.semPm.setNodeExpression(node, newExpression);
if (_node == null || !parents.equals(oldReferencedNames)) {
this.semPm.setNodeExpression(node, newExpression);
setReferencedParameters(node, semPm, oldPm);
......@@ -211,7 +204,7 @@ public class GeneralizedSemPmWrapper implements SessionModel, GraphSource, Knowl
Set<String> parameters = semPm.getReferencedParameters(node);
for (String parameter : parameters) {
}
}
......@@ -263,7 +256,6 @@ public class GeneralizedSemPmWrapper implements SessionModel, GraphSource, Knowl
semPm = new GeneralizedSemPm(pmWrapper.getSemPm());
}
/**
* Creates a new SemPm from the given workbench and uses it to construct a
* new BayesPm.
......@@ -272,14 +264,12 @@ public class GeneralizedSemPmWrapper implements SessionModel, GraphSource, Knowl
this(wrapper.getGraph());
}
public GeneralizedSemPmWrapper(SemEstimatorWrapper wrapper) {
try {
SemPm oldSemPm = wrapper.getSemEstimator().getEstimatedSem()
.getSemPm();
this.semPm = new GeneralizedSemPm(oldSemPm);
}
catch (Exception e) {
} catch (Exception e) {
throw new RuntimeException("SemPm could not be deep cloned.", e);
}
log(semPm);
......@@ -299,7 +289,9 @@ public class GeneralizedSemPmWrapper implements SessionModel, GraphSource, Knowl
public GeneralizedSemPmWrapper(BuildPureClustersRunner wrapper) {
Graph graph = wrapper.getResultGraph();
if (graph == null) throw new IllegalArgumentException("No graph to display.");
if (graph == null) {
throw new IllegalArgumentException("No graph to display.");
}
SemPm oldSemPm = new SemPm(graph);
this.semPm = new GeneralizedSemPm(oldSemPm);
log(semPm);
......@@ -319,7 +311,6 @@ public class GeneralizedSemPmWrapper implements SessionModel, GraphSource, Knowl
}
//============================PUBLIC METHODS=========================//
public GeneralizedSemPm getSemPm() {
return this.semPm;
}
......@@ -367,7 +358,6 @@ public class GeneralizedSemPmWrapper implements SessionModel, GraphSource, Knowl
}
//======================= Private methods ====================//
private void log(GeneralizedSemPm pm) {
TetradLogger.getInstance().log("info", "Generalized Structural Equation Parameter Model (Generalized SEM PM)");
TetradLogger.getInstance().log("pm", pm.toString());
......@@ -389,7 +379,4 @@ public class GeneralizedSemPmWrapper implements SessionModel, GraphSource, Knowl
return getGraph().getNodes();
}
}
......@@ -62,7 +62,7 @@ import javax.swing.JOptionPane;
*
* @author Joseph Ramsey
*/
public class SemEstimatorWrapper implements SessionModel, GraphSource, Unmarshallable {
public class SemEstimatorWrapper implements SessionModel, Unmarshallable {
static final long serialVersionUID = 23L;
......
......@@ -18,7 +18,6 @@
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
///////////////////////////////////////////////////////////////////////////////
package edu.cmu.tetradapp.model;
import edu.cmu.tetrad.algcomparison.simulation.LinearFisherModel;
......@@ -31,7 +30,6 @@ import edu.cmu.tetrad.session.SessionModel;
import edu.cmu.tetrad.util.Parameters;
import edu.cmu.tetrad.util.TetradLogger;
import edu.cmu.tetrad.util.TetradSerializableUtils;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.rmi.MarshalledObject;
......@@ -43,7 +41,8 @@ import java.util.List;
*
* @author Joseph Ramsey
*/
public class SemImWrapper implements SessionModel, GraphSource {
public class SemImWrapper implements SessionModel {
static final long serialVersionUID = 23L;
private List<SemIm> semIms;
......@@ -52,13 +51,11 @@ public class SemImWrapper implements SessionModel, GraphSource {
*/
private String name;
private int numModels = 1;
private int modelIndex = 0;
private String modelSourceName = null;
//============================CONSTRUCTORS==========================//
public SemImWrapper(SemIm semIm) {
setSemIm(semIm);
}
......@@ -72,8 +69,7 @@ public class SemImWrapper implements SessionModel, GraphSource {
try {
setSemIm((SemIm) new MarshalledObject(oldSemIm).get());
}
catch (Exception e) {
} catch (Exception e) {
throw new RuntimeException("SemIm could not be deep cloned.", e);
}
}
......@@ -90,8 +86,8 @@ public class SemImWrapper implements SessionModel, GraphSource {
}
if (_simulation instanceof LinearFisherModel) {
throw new IllegalArgumentException("Large SEM simulations cannot be represented " +
"using a SEM PM or IM box, sorry.");
throw new IllegalArgumentException("Large SEM simulations cannot be represented "
+ "using a SEM PM or IM box, sorry.");
}
if (!(_simulation instanceof SemSimulation)) {
......@@ -118,7 +114,7 @@ public class SemImWrapper implements SessionModel, GraphSource {
}
public SemImWrapper(SemPmWrapper semPmWrapper, SemImWrapper oldSemImWrapper,
Parameters params) {
Parameters params) {
if (semPmWrapper == null) {
throw new NullPointerException("SemPmWrapper must not be null.");
}
......@@ -180,12 +176,10 @@ public class SemImWrapper implements SessionModel, GraphSource {
}
//===========================PUBLIC METHODS=========================//
public SemIm getSemIm() {
return this.semIms.get(getModelIndex());
}
public Graph getGraph() {
return getSemIm().getSemPm().getGraph();
}
......@@ -199,7 +193,6 @@ public class SemImWrapper implements SessionModel, GraphSource {
}
//======================== Private methods =======================//
private void log(int i, SemIm pm) {
TetradLogger.getInstance().log("info", "Linear SEM IM");
TetradLogger.getInstance().log("info", "IM # " + (i + 1));
......@@ -256,8 +249,3 @@ public class SemImWrapper implements SessionModel, GraphSource {
this.modelIndex = modelIndex;
}
}
......@@ -18,7 +18,6 @@
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
///////////////////////////////////////////////////////////////////////////////
package edu.cmu.tetradapp.model;
import edu.cmu.tetrad.algcomparison.simulation.LinearFisherModel;
......@@ -30,7 +29,6 @@ import edu.cmu.tetrad.session.SessionModel;
import edu.cmu.tetrad.util.Parameters;
import edu.cmu.tetrad.util.TetradLogger;
import edu.cmu.tetrad.util.TetradSerializableUtils;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.rmi.MarshalledObject;
......@@ -42,7 +40,8 @@ import java.util.List;
*
* @author Joseph Ramsey
*/
public class SemPmWrapper implements SessionModel, GraphSource {
public class SemPmWrapper implements SessionModel {
static final long serialVersionUID = 23L;
private int numModels = 1;
private int modelIndex = 0;
......@@ -56,7 +55,6 @@ public class SemPmWrapper implements SessionModel, GraphSource {
private List<SemPm> semPms;
//==============================CONSTRUCTORS==========================//
public SemPmWrapper(Graph graph) {
if (graph == null) {
throw new NullPointerException("Graph must not be null.");
......@@ -88,8 +86,8 @@ public class SemPmWrapper implements SessionModel, GraphSource {
}
if (_simulation instanceof LinearFisherModel) {
throw new IllegalArgumentException("Large SEM simulations cannot be represented " +
"using a SEM PM or IM box, sorry.");
throw new IllegalArgumentException("Large SEM simulations cannot be represented "
+ "using a SEM PM or IM box, sorry.");
}
if (!(_simulation instanceof SemSimulation)) {
......@@ -118,9 +116,9 @@ public class SemPmWrapper implements SessionModel, GraphSource {
* new BayesPm.
*/
public SemPmWrapper(GraphSource graphWrapper, Parameters parameters) {
this(graphWrapper.getGraph() instanceof TimeLagGraph ?
new TimeLagGraph((TimeLagGraph) graphWrapper.getGraph()) :
new EdgeListGraph(graphWrapper.getGraph()));
this(graphWrapper.getGraph() instanceof TimeLagGraph
? new TimeLagGraph((TimeLagGraph) graphWrapper.getGraph())
: new EdgeListGraph(graphWrapper.getGraph()));
}
public SemPmWrapper(GraphSource graphSource, DataWrapper dataWrapper, Parameters parameters) {
......@@ -158,7 +156,9 @@ public class SemPmWrapper implements SessionModel, GraphSource {
public SemPmWrapper(BuildPureClustersRunner wrapper) {
Graph graph = wrapper.getResultGraph();
if (graph == null) throw new IllegalArgumentException("No graph to display.");
if (graph == null) {
throw new IllegalArgumentException("No graph to display.");
}
SemPm pm = new SemPm(graph);
setSemPm(pm);
......@@ -202,7 +202,6 @@ public class SemPmWrapper implements SessionModel, GraphSource {
}
//============================PUBLIC METHODS=========================//
public SemPm getSemPm() {
return this.semPms.get(getModelIndex());
}
......@@ -237,9 +236,7 @@ public class SemPmWrapper implements SessionModel, GraphSource {
this.name = name;
}
//======================= Private methods ====================//
private void log(int i, SemPm pm) {
TetradLogger.getInstance().log("info", "Linear Structural Equation Parametric Model (SEM PM)");
TetradLogger.getInstance().log("info", "PM # " + (i + 1));
......@@ -287,11 +284,3 @@ public class SemPmWrapper implements SessionModel, GraphSource {
this.modelIndex = modelIndex;
}
}
......@@ -18,11 +18,9 @@
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
///////////////////////////////////////////////////////////////////////////////
package edu.cmu.tetradapp.model;
import edu.cmu.tetrad.data.KnowledgeBoxInput;
import edu.cmu.tetrad.gene.tetrad.gene.history.PreviousStepOnly;
import edu.cmu.tetrad.graph.Graph;
import edu.cmu.tetrad.graph.Node;
import edu.cmu.tetrad.sem.SemIm;
......@@ -30,18 +28,17 @@ import edu.cmu.tetrad.sem.StandardizedSemIm;
import edu.cmu.tetrad.session.SessionModel;
import edu.cmu.tetrad.util.TetradLogger;
import edu.cmu.tetrad.util.TetradSerializableUtils;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.List;
/**
* Wraps a Bayes Pm for use in the Tetrad application.
*
* @author Joseph Ramsey
*/
public class StandardizedSemImWrapper implements SessionModel, GraphSource, KnowledgeBoxInput {
public class StandardizedSemImWrapper implements SessionModel, KnowledgeBoxInput {
static final long serialVersionUID = 23L;
/**
......@@ -60,7 +57,6 @@ public class StandardizedSemImWrapper implements SessionModel, GraphSource, Know
private boolean showErrors;
//============================CONSTRUCTORS==========================//
public StandardizedSemImWrapper(SemImWrapper semImWrapper) {
if (semImWrapper == null) {
throw new NullPointerException();
......@@ -91,12 +87,10 @@ public class StandardizedSemImWrapper implements SessionModel, GraphSource, Know
}
//===========================PUBLIC METHODS=========================//
public StandardizedSemIm getStandardizedSemIm() {
return this.standardizedSemIm;
}
public Graph getGraph() {
return standardizedSemIm.getSemPm().getGraph();
}
......@@ -118,7 +112,6 @@ public class StandardizedSemImWrapper implements SessionModel, GraphSource, Know
}
//======================== Private methods =======================//
/**
* Adds semantic checks to the default deserialization method. This method
* must have the standard signature for a readObject method, and the body of
......@@ -140,25 +133,25 @@ public class StandardizedSemImWrapper implements SessionModel, GraphSource, Know
throw new NullPointerException();
}
}
public Graph getSourceGraph() {
return getGraph();
}
public Graph getSourceGraph() {
return getGraph();
}
public Graph getResultGraph() {
return getGraph();
}
public List<String> getVariableNames() {
return getGraph().getNodeNames();
}
return getGraph().getNodeNames();
}
public List<Node> getVariables() {
return getGraph().getNodes();
}
public List<Node> getVariables() {
return getGraph().getNodes();
}
private void log(StandardizedSemIm pm){
private void log(StandardizedSemIm pm) {
TetradLogger.getInstance().log("info", "Standardized SEM IM");
TetradLogger.getInstance().log("im", pm.toString());
}}
}
}
......@@ -176,11 +176,11 @@ public final class TabularComparison implements SessionModel, SimulationParamsSo
if (referenceGraphs.size() != targetGraphs.size()) {
throw new IllegalArgumentException("I was expecting the same number of graphs in each parent.");
}
if (algorithm != null) {
for (int i = 0; i < referenceGraphs.size(); i++) {
referenceGraphs.set(i, algorithm.getComparisonGraph(referenceGraphs.get(i)));
}
}
// if (algorithm != null) {
// for (int i = 0; i < referenceGraphs.size(); i++) {
// referenceGraphs.set(i, algorithm.getComparisonGraph(referenceGraphs.get(i)));
// }
// }
for (int i = 0; i < targetGraphs.size(); i++) {
targetGraphs.set(i, GraphUtils.replaceNodes(targetGraphs.get(i), referenceGraphs.get(i).getNodes()));
......@@ -276,13 +276,13 @@ public final class TabularComparison implements SessionModel, SimulationParamsSo
s.defaultReadObject();
}
public Graph getTrueGraph() {
return trueGraph;
}
public void setTrueGraph(Graph trueGraph) {
this.trueGraph = trueGraph;
}
// public Graph getTrueGraph() {
// return trueGraph;
// }
//
// public void setTrueGraph(Graph trueGraph) {
// this.trueGraph = trueGraph;
// }
@Override
public Map<String, String> getParamSettings() {
......
......@@ -65,6 +65,7 @@ public class FaskConcatenated implements MultiDataSetAlgorithm, HasKnowledge, Us
search.setDelta(parameters.getDouble("faskDelta"));
search.setAlpha(parameters.getDouble("twoCycleAlpha"));
search.setKnowledge(knowledge);
return search.search();
} else {
FaskConcatenated algorithm = new FaskConcatenated(score);
......
......@@ -59,6 +59,8 @@ public class TsFci implements Algorithm, TakesInitialGraph, HasKnowledge, TakesI
edu.cmu.tetrad.search.TsFci search = new edu.cmu.tetrad.search.TsFci(test.getTest(dataSet, parameters));
search.setDepth(parameters.getInt("depth"));
search.setKnowledge(dataSet.getKnowledge());
search.setVerbose(parameters.getBoolean("verbose"));
return search.search();
} else {
TsFci tsFci = new TsFci(test, algorithm);
......
......@@ -56,6 +56,9 @@ public class TsGfci implements Algorithm, TakesInitialGraph, HasKnowledge, Takes
score.getScore(dataSet, parameters));
IKnowledge _knowledge = dataSet.getKnowledge() != null ? dataSet.getKnowledge() : new Knowledge2();
search.setKnowledge(dataSet.getKnowledge());
search.setVerbose(parameters.getBoolean("verbose"));
return search.search();
} else {
TsGfci algorithm = new TsGfci(test, score);
......
......@@ -65,6 +65,8 @@ public class TsImages implements Algorithm, HasKnowledge, MultiDataSetAlgorithm,
IndependenceTest test = new IndTestScore(score1);
search = new TsGFci(test, score1);
search.setKnowledge(dataSet.getKnowledge());
search.setVerbose(parameters.getBoolean("verbose"));
return search.search();
} else {
TsImages algorithm = new TsImages(score);
......
......@@ -43,11 +43,12 @@ public class FAS implements Algorithm, HasKnowledge, TakesIndependenceWrapper {
@Override
public Graph search(DataModel dataSet, Parameters parameters) {
if (parameters.getInt("bootstrapSampleSize") < 1) {
if (parameters.getInt("bootstrapSampleSize") < 1) {
edu.cmu.tetrad.search.Fas search = new edu.cmu.tetrad.search.Fas(test.getTest(dataSet, parameters));
search.setDepth(parameters.getInt("depth"));
search.setKnowledge(knowledge);
search.setVerbose(parameters.getBoolean("verbose"));
return search.search();
} else {
FAS algorithm = new FAS(test);
......
......@@ -60,6 +60,7 @@ public class FgesMb implements Algorithm, TakesInitialGraph, HasKnowledge, UsesS
edu.cmu.tetrad.search.FgesMb search = new edu.cmu.tetrad.search.FgesMb(score);
search.setFaithfulnessAssumed(parameters.getBoolean("faithfulnessAssumed"));
search.setKnowledge(knowledge);
search.setVerbose(parameters.getBoolean("verbose"));
if (initialGraph != null) {
search.setInitialGraph(initialGraph);
......
......@@ -113,6 +113,7 @@ public class PcAll implements Algorithm, TakesInitialGraph, HasKnowledge, TakesI
search.setConflictRule(conflictRule);
search.setUseHeuristic(parameters.getBoolean("useMaxPOrientationHeuristic"));
search.setMaxPathLength(parameters.getInt("maxPOrientationMaxPathLength"));
search.setVerbose(parameters.getBoolean("verbose"));
return search.search();
} else {
......
......@@ -26,7 +26,6 @@ import edu.cmu.tetrad.data.Knowledge2;
import edu.cmu.tetrad.graph.*;
import edu.cmu.tetrad.util.ChoiceGenerator;
import edu.cmu.tetrad.util.TetradLogger;
import java.io.PrintStream;
import java.text.DecimalFormat;
import java.text.NumberFormat;
......