Package org.encog.ml.bayesian.query.sample

Examples of org.encog.ml.bayesian.query.sample.EventState


    // copy the input to evidence
    int inputIndex = 0;
    for (int i = 0; i < this.events.size(); i++) {
      BayesianEvent event = this.events.get(i);
      EventState state = this.query.getEventState(event);
      if (state.getEventType() == EventType.Evidence) {
        state.setValue((int)input.getData(inputIndex++));
      }
    }

    // execute the query
    this.query.execute();
View Full Code Here


    result.append("P(");
    boolean first = true;
   
    for(int i=0;i<this.getEvents().size();i++) {
      BayesianEvent event = this.events.get(i)
      EventState state = this.query.getEventState(event);
      if( state.getEventType()==EventType.Outcome ) {
        if(!first) {
          result.append(",");
        }
        result.append(event.getLabel());
        first = false;
View Full Code Here

      eof = true;
    }

    while (!done) {

      EventState state = this.enumerationEvents.get(currentIndex);
      int v = (int) state.getValue();
      v++;
      if (v >= state.getEvent().getChoices().size()) {
        state.setValue(0);
      } else {
        state.setValue(v);
        done = true;
        break;
      }

      currentIndex++;
View Full Code Here

  private int[] obtainArgs(BayesianEvent event) {
    int[] result = new int[event.getParents().size()];

    int index = 0;
    for (BayesianEvent parentEvent : event.getParents()) {
      EventState state = this.getEventState(parentEvent);
      result[index++] = state.getValue();

    }
    return result;
  }
View Full Code Here

  }
 
  public void finalizeStructure() {
    this.events.clear();
    for(BayesianEvent event: this.network.getEvents()) {
      events.put(event, new EventState(event));
    }
  }
View Full Code Here

   * @return Determines if the evidence events have values that satisfy the
   *         needed case. This is used for sampling.
   */
  protected boolean isNeededEvidence() {
    for(BayesianEvent evidenceEvent: this.evidenceEvents) {
      EventState state = getEventState(evidenceEvent);
      if(!state.isSatisfied() )  {
        return false;
      }
    }
    return true;
  }
View Full Code Here

  /**
   * @return True, if the current state satisifies the desired outcome.
   */
  protected boolean satisfiesDesiredOutcome() {
    for(BayesianEvent outcomeEvent: this.outcomeEvents) {
      EventState state = getEventState(outcomeEvent);
      if(!state.isSatisfied() )  {
        return false;
      }
    }
    return true;
  }
View Full Code Here

    for(BayesianEvent event: this.evidenceEvents) {
      if( !first ) {
        result.append(",");
      }
      first = false;
      EventState state = getEventState(event);
      if( state==null )
        break;
      result.append(EventState.toSimpleString(state));
    }
    result.append(")");
View Full Code Here

TOP

Related Classes of org.encog.ml.bayesian.query.sample.EventState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.