Package cc.mallet.grmm.types

Examples of cc.mallet.grmm.types.Variable


  private void lambdaPropagation (FactorGraph mdl, Variable parent, Factor child)
  {
    logger.finer ("lambda propagation "+parent+" , "+child);
    marked.add (child);
    for (Iterator it = child.varSet ().iterator(); it.hasNext();) {
      Variable gchild = (Variable) it.next();
      if (!marked.contains (gchild)) {
        lambdaPropagation (mdl, child, gchild);
      }
    }
    if (parent != null) {
View Full Code Here


  private void piPropagation (FactorGraph mdl, Factor factor)
  {
    logger.finer ("Pi propagation from "+factor);
    marked.add (factor);
    for (Iterator it = factor.varSet ().iterator(); it.hasNext();) {
      Variable child = (Variable) it.next();
      if (!marked.contains (child)) {
//        sendPiMessage (mdl, var, child);
        sendMessage (mdl, factor, child);
        piPropagation (mdl, child);
      }
View Full Code Here

    }

    void dumpAssnForClique (Assignment assn, ACRF.UnrolledVarSet clique)
    {
      for (Iterator it = clique.iterator(); it.hasNext();) {
        Variable var = (Variable) it.next();
        System.out.println(var+" ==> "+assn.getObject (var)
          +"  ("+assn.get (var)+")");
      }
    }
View Full Code Here

  }

  // Tests finding a feasible initial assignment in a sparse model
  public void testInitialAssignment ()
  {
    Variable[] vars = new Variable[] { new Variable (3), new Variable (3), new Variable (3) };

    Variable[] vars1 = new Variable[]{ vars[0], vars[1] };
    double[] vals1 = new double[] { 0, 0.2, 0.8, 0, 0.7, 0.3, 0, 0.5, 0.5 };
    Factor tbl1 = new TableFactor (vars1, vals1);
View Full Code Here

  public void testEqualsHashCode ()
  {
    Variable[] vars = new Variable [4];
    for (int i = 0; i < vars.length; i++) {
      vars[i] = new Variable(3);
    }

    HashVarSet c1 = new HashVarSet (vars);
    HashVarSet c2 = new HashVarSet (vars);
View Full Code Here

  }

  public void testAddAllOrdering ()
  {
    for (int rep = 0; rep < 1000; rep++) {
      Variable[] vars = new Variable[] { new Variable(2), new Variable (2) };
      HashVarSet vs = new HashVarSet (vars);
      checkOrdering (vs, vars);
    }
  }
View Full Code Here

  }

  public void testAddAllOrdering2 ()
  {
    for (int rep = 0; rep < 1000; rep++) {
      Variable[] vars = new Variable[] { new Variable(2), new Variable (2) };
      HashVarSet vs = new HashVarSet ();
      vs.addAll (Arrays.asList (vars));
      checkOrdering (vs, vars);
    }
  }
View Full Code Here

  }

  public void testAddAllOrdering3 ()
  {
    for (int rep = 0; rep < 1000; rep++) {
      Variable[] vars = new Variable[] { new Variable(2), new Variable (2) };
      HashVarSet vsOld = new HashVarSet (vars);
      HashVarSet vs = new HashVarSet (vsOld);
      checkOrdering (vs, vars);
    }
  }
View Full Code Here

  }

  protected void addInstantiatedCliques (ACRF.UnrolledGraph graph, FeatureVectorSequence fvs, LabelsAssignment lblseq)
  {
    for (int t = 0; t < lblseq.size() - 1; t++) {
      Variable var1 = lblseq.varOfIndex (t, lvl1);
      Variable var2 = lblseq.varOfIndex (t + 1, lvl2);
      assert var1 != null : "Couldn't get label factor "+lvl1+" time "+t;
      assert var2 != null : "Couldn't get label factor "+lvl2+" time "+(t+1);

      Variable[] vars = new Variable[] { var1, var2 };
      FeatureVector fv = fvs.getFeatureVector (t);
View Full Code Here

    for (int t = 0; t < lblseq.size (); t++) {
      Labels lbls = lblseq.getLabels (t);
      idx2var[t] = new Variable [lbls.size ()];
      for (int j = 0; j < lbls.size (); j++) {
        Label lbl = lbls.get (j);
        Variable var = new Variable (lbl.getLabelAlphabet ());
        var.setLabel ("I"+id+"_VAR[f=" + j + "][tm=" + t + "]");
        idx2var[t][j] = var;
        var2label.put (var, lbl);
      }
    }
  }
View Full Code Here

TOP

Related Classes of cc.mallet.grmm.types.Variable

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.