public StructEmBayesSearchRunner(
      DataWrapper dataWrapper, BayesPmWrapper bayesPmWrapper, StructEmBayesSearchParams params) {
    if (dataWrapper == null) {
      throw new NullPointerException();
    }

    if (bayesPmWrapper == null) {
      throw new NullPointerException();
    }

    if (params == null) {
      throw new NullPointerException();
    }

    DataSet dataSet = (DataSet) dataWrapper.getSelectedDataModel();

    FactoredBayesStructuralEM estimator =
        new FactoredBayesStructuralEM(dataSet, bayesPmWrapper.getBayesPm());
    this.dataSet = estimator.getDataSet();

    try {
      this.estimatedBayesIm = estimator.maximization(params.getTolerance());

    } catch (IllegalArgumentException e) {
      throw new RuntimeException(e);
    }
  }
  public StructEmBayesSearchRunner(DataWrapper dataWrapper, BayesPmWrapper bayesPmWrapper) {
    if (dataWrapper == null) {
      throw new NullPointerException("BayesDataWrapper must not be null.");
    }

    if (bayesPmWrapper == null) {
      throw new NullPointerException("BayesPmWrapper must not be null");
    }

    this.dataSet = (DataSet) dataWrapper.getSelectedDataModel();
    this.bayesPm = bayesPmWrapper.getBayesPm();

    estimate(this.dataSet, this.bayesPm);
  }
Beispiel #3
0
  public BayesImWrapper(BayesPmWrapper bayesPmWrapper, BayesImParams params) {
    if (bayesPmWrapper == null) {
      throw new NullPointerException("BayesPmWrapper must not be null.");
    }

    if (params == null) {
      throw new NullPointerException("Params must not be null.");
    }

    BayesPm bayesPm = new BayesPm(bayesPmWrapper.getBayesPm());

    if (params.getInitializationMode() == BayesImParams.MANUAL_RETAIN) {
      this.bayesIm = new MlBayesIm(bayesPm);
    } else if (params.getInitializationMode() == BayesImParams.RANDOM_RETAIN) {
      this.bayesIm = new MlBayesIm(bayesPm, MlBayesIm.RANDOM);
    } else if (params.getInitializationMode() == BayesImParams.RANDOM_OVERWRITE) {
      this.bayesIm = new MlBayesIm(bayesPm, MlBayesIm.RANDOM);
    }
    log(bayesIm);
  }
Beispiel #4
0
 /**
  * Generates a simple exemplar of this class to test serialization.
  *
  * @see TetradSerializableUtils
  */
 public static BayesImWrapper serializableInstance() {
   return new BayesImWrapper(
       BayesPmWrapper.serializableInstance(), BayesImParams.serializableInstance());
 }
 /**
  * Generates a simple exemplar of this class to test serialization.
  *
  * @see edu.cmu.TestSerialization
  * @see edu.cmu.tetradapp.util.TetradSerializableUtils
  */
 public static StructEmBayesSearchRunner serializableInstance() {
   return new StructEmBayesSearchRunner(
       DataWrapper.serializableInstance(), BayesPmWrapper.serializableInstance());
 }