예제 #1
0
  /**
   * Constructs a wrapper for the given DataWrapper. The DatWrapper must contain a DataSet that is
   * either a DataSet or a DataSet or a DataList containing either a DataSet or a DataSet as its
   * selected model.
   *
   * @param knowledgeBoxModel
   */
  public AbstractAlgorithmRunner(
      DataWrapper dataWrapper,
      Parameters params,
      KnowledgeBoxModel knowledgeBoxModel,
      IndependenceFactsModel facts) {
    if (dataWrapper == null) {
      throw new NullPointerException();
    }
    if (params == null) {
      throw new NullPointerException();
    }

    this.params = params;
    this.sourceGraph = dataWrapper.getSourceGraph();

    DataModel dataSource = getSelectedDataModel(dataWrapper);

    this.dataWrapper = dataWrapper;

    // temporary workaround to get the knowledge box to coexist with the dataWrapper's knowledge
    if (knowledgeBoxModel == null) {
      getParams().set("knowledge", dataWrapper.getKnowledge());
    } else {
      getParams().set("knowledge", knowledgeBoxModel.getKnowledge());
    }

    getParams().set("independenceFacts", facts.getFacts());
    List names = dataSource.getVariableNames();
    transferVarNamesToParams(names);
  }
예제 #2
0
  public AbstractAlgorithmRunner(
      IndependenceFactsModel model, Parameters params, KnowledgeBoxModel knowledgeBoxModel) {
    if (model == null) {
      throw new NullPointerException();
    }
    if (params == null) {
      throw new NullPointerException();
    }

    this.params = params;

    DataModel dataSource = model.getFacts();

    if (knowledgeBoxModel != null) {
      getParams().set("knowledge", knowledgeBoxModel.getKnowledge());
    }

    List names = dataSource.getVariableNames();
    transferVarNamesToParams(names);
    this.dataModel = dataSource;
  }