Examples of varSet()


Examples of cc.mallet.grmm.types.Factor.varSet()

      g.addVertex (var);
    }

    for (Iterator it = fg.factorsIterator (); it.hasNext ();) {
      Factor factor = (Factor) it.next ();
      VarSet varSet = factor.varSet ();
      int nv = varSet.size ();
      for (int i = 0; i < nv; i++) {
        for (int j = i + 1; j < nv; j++) {
          g.addEdge (varSet.get (i), varSet.get (j));
        }
View Full Code Here

Examples of cc.mallet.grmm.types.Factor.varSet()

  public RegionGraph constructRegionGraph (FactorGraph mdl)
  {
    RegionGraph rg = new RegionGraph ();
    for (Iterator it = mdl.factorsIterator (); it.hasNext();) {
      Factor ptl = (Factor) it.next ();
      if (ptl.varSet ().size() == 1) continue// Single-node potentials handled separately

      Region parent = new Region (ptl);

      // Now add appropriate edges to region graph
      for (Iterator childIt = ptl.varSet().iterator (); childIt.hasNext();) {
View Full Code Here

Examples of cc.mallet.grmm.types.Factor.varSet()

      if (ptl.varSet ().size() == 1) continue// Single-node potentials handled separately

      Region parent = new Region (ptl);

      // Now add appropriate edges to region graph
      for (Iterator childIt = ptl.varSet().iterator (); childIt.hasNext();) {
        Variable var = (Variable) childIt.next ();
        Factor childPtl = mdl.factorOf (var);
        Region child = rg.findRegion (childPtl, true);

        //add node potential to parent if necessary
View Full Code Here

Examples of cc.mallet.grmm.types.Factor.varSet()

  private static Collection varsForFactors (List factors)
  {
    Set vars = new THashSet ();
    for (Iterator it = factors.iterator (); it.hasNext ();) {
      Factor ptl = (Factor) it.next ();
      vars.addAll (ptl.varSet ());
    }
    return vars;
  }

}
View Full Code Here

Examples of cc.mallet.grmm.types.Factor.varSet()

    HashSet phiSet = new HashSet();     
   
    /* collect the potentials that include this variable */
    for (Iterator j = allPhi.iterator(); j.hasNext(); ) {
      Factor cpf = (Factor) j.next ();
      if (cpf.varSet().isEmpty() || cpf.containsVar (node)) {
        phiSet.add (cpf);
        j.remove ();
      }
    }

View Full Code Here

Examples of cc.mallet.grmm.types.Factor.varSet()

     * query variable.... UNLESS the graph is disconnected.  So just
     * eliminate the query var.
     */
    Factor marginal = eliminate (allPhi, query);
    assert marginal.containsVar (query);
    assert marginal.varSet().size() == 1;

    return marginal;
  }

  /**
 
View Full Code Here

Examples of cc.mallet.grmm.types.Factor.varSet()

    // Send all messages in random order.
    ArrayList factors = new ArrayList (mdl.factors());
    Collections.shuffle (factors, rand);
    for (Iterator it = factors.iterator(); it.hasNext();) {
      Factor factor = (Factor) it.next();
      for (Iterator vit = factor.varSet ().iterator (); vit.hasNext ();) {
        Variable from = (Variable) vit.next ();
        sendMessage (mdl, from, factor);
      }
    }
View Full Code Here

Examples of cc.mallet.grmm.types.Factor.varSet()

      }
    }

    for (Iterator it = factors.iterator(); it.hasNext();) {
      Factor factor = (Factor) it.next();
      for (Iterator vit = factor.varSet ().iterator (); vit.hasNext ();) {
        Variable to = (Variable) vit.next ();
        sendMessage (mdl, factor, to);
      }
    }
  }
View Full Code Here

Examples of cc.mallet.grmm.types.Factor.varSet()

  {
    for (Iterator it = regions.iterator (); it.hasNext ();) {
      Region region = (Region) it.next ();
      for (Iterator pIt = mdl.factorsIterator (); pIt.hasNext();) {
        Factor ptl = (Factor) pIt.next ();
        if (region.vars.containsAll (ptl.varSet ())) {
          region.factors.add (ptl);
        }
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.