public AbstractTableFactor computeFactor (UnrolledVarSet clique) { Matrix phi = createFactorMatrix(clique); SparseVector[] weights = getWeights(); // System.out.println("UnrolledClique "+clique); // System.out.println("FV : "+clique.fv); for (int loc = 0; loc < phi.numLocations(); loc++) { int idx = phi.indexAtLocation(loc); assert idx < weights.length : "Error: Instantiating "+this+" on "+clique+" : Clique has too many " +"assignments.\n # of weights = "+weights.length+" clique weight = "+clique.weight(); SparseVector w = weights[idx]; // System.out.println("Weights "+idx+" : "+w); // w.print(); double dp = w.dotProduct(clique.fv); dp += getDefaultWeight(idx); phi.setValueAtLocation(loc, dp); } AbstractTableFactor ptl = new LogTableFactor(clique); ptl.setValues(phi); return ptl; }
public AbstractTableFactor computeFactor (UnrolledVarSet clique) { Matrix phi = createFactorMatrix(clique); SparseVector[] weights = getWeights(); // System.out.println("UnrolledClique "+clique); // System.out.println("FV : "+clique.fv); for (int loc = 0; loc < phi.numLocations(); loc++) { int idx = phi.indexAtLocation(loc); assert idx < weights.length : "Error: Instantiating "+this+" on "+clique+" : Clique has too many " +"assignments.\n # of weights = "+weights.length+" clique weight = "+clique.weight(); SparseVector w = weights[idx]; // System.out.println("Weights "+idx+" : "+w); // w.print(); double dp = w.dotProduct(clique.fv); dp += getDefaultWeight(idx); phi.setValueAtLocation(loc, dp); } AbstractTableFactor ptl = new LogTableFactor(clique); ptl.setValues(phi); return ptl; }
public AbstractTableFactor computeFactor (UnrolledVarSet clique) { Matrix phi = createFactorMatrix(clique); SparseVector[] weights = getWeights(); // System.out.println("UnrolledClique "+clique); // System.out.println("FV : "+clique.fv); for (int loc = 0; loc < phi.numLocations(); loc++) { int idx = phi.indexAtLocation(loc); assert idx < weights.length : "Error: Instantiating "+this+" on "+clique+" : Clique has too many " +"assignments.\n # of weights = "+weights.length+" clique weight = "+clique.weight(); SparseVector w = weights[idx]; // System.out.println("Weights "+idx+" : "+w); // w.print(); double dp = w.dotProduct(clique.fv); dp += getDefaultWeight(idx); phi.setValueAtLocation(loc, dp); } AbstractTableFactor ptl = new LogTableFactor(clique); ptl.setValues(phi); return ptl; }
private double computeLogFactorValue (Assignment cliqueAssn, ACRF.Template tmpl, FeatureVector fv) { SparseVector[] weights = tmpl.getWeights (); int idx = cliqueAssn.singleIndex (); SparseVector w = weights[idx]; double dp = w.dotProduct (fv); dp += tmpl.getDefaultWeight (idx); return dp; }
private double computeLogFactorValue (Assignment cliqueAssn, ACRF.Template tmpl, FeatureVector fv) { SparseVector[] weights = tmpl.getWeights (); int idx = cliqueAssn.singleIndex (); SparseVector w = weights[idx]; double dp = w.dotProduct (fv); dp += tmpl.getDefaultWeight (idx); return dp; }
private double computeLogFactorValue (Assignment cliqueAssn, ACRF.Template tmpl, FeatureVector fv) { SparseVector[] weights = tmpl.getWeights (); int idx = cliqueAssn.singleIndex (); SparseVector w = weights[idx]; double dp = w.dotProduct (fv); dp += tmpl.getDefaultWeight (idx); return dp; }