public static double distLinf (AbstractTableFactor f1, AbstractTableFactor f2) { // double sum1 = f1.logsum (); // double sum2 = f2.logsum (); Matrix m1 = f1.getLogValueMatrix (); Matrix m2 = f2.getLogValueMatrix (); return matrixDistLinf (m1, m2); }
public static double distLinf (AbstractTableFactor f1, AbstractTableFactor f2) { // double sum1 = f1.logsum (); // double sum2 = f2.logsum (); Matrix m1 = f1.getLogValueMatrix (); Matrix m2 = f2.getLogValueMatrix (); return matrixDistLinf (m1, m2); }
public static double distLinf (AbstractTableFactor f1, AbstractTableFactor f2) { // double sum1 = f1.logsum (); // double sum2 = f2.logsum (); Matrix m1 = f1.getLogValueMatrix (); Matrix m2 = f2.getLogValueMatrix (); return matrixDistLinf (m1, m2); }
public LogTableFactor (AbstractTableFactor in) { super (in); probs = (Matrix) in.getLogValueMatrix ().cloneMatrix (); }
public LogTableFactor (AbstractTableFactor in) { super (in); probs = (Matrix) in.getLogValueMatrix ().cloneMatrix (); }
public LogTableFactor (AbstractTableFactor in) { super (in); probs = (Matrix) in.getLogValueMatrix ().cloneMatrix (); }
public double[] toLogValueArray () { Matrix matrix = getLogValueMatrix (); if (matrix instanceof Matrixn) return ((Matrixn)matrix).toArray (); else if (matrix instanceof SparseMatrixn) return ((SparseMatrixn)matrix).toArray (); else throw new RuntimeException (); }
public double[] toLogValueArray () { Matrix matrix = getLogValueMatrix (); if (matrix instanceof Matrixn) return ((Matrixn)matrix).toArray (); else if (matrix instanceof SparseMatrixn) return ((SparseMatrixn)matrix).toArray (); else throw new RuntimeException (); }
public double[] toLogValueArray () { Matrix matrix = getLogValueMatrix (); if (matrix instanceof Matrixn) return ((Matrixn)matrix).toArray (); else if (matrix instanceof SparseMatrixn) return ((SparseMatrixn)matrix).toArray (); else throw new RuntimeException (); }
/** Implements the error range measure from Ihler et al. */ public static double logErrorRange (AbstractTableFactor f1, AbstractTableFactor f2) { double error_min = Double.MAX_VALUE; double error_max = 0; Matrix m1 = f1.getLogValueMatrix (); Matrix m2 = f2.getLogValueMatrix (); int nl1 = m1.singleSize (); int nl2 = m2.singleSize (); if (nl1 != nl2) return Double.POSITIVE_INFINITY; for (int l = 0; l < nl1; l++) { double val1 = m1.singleValue (l); double val2 = m2.singleValue (l); double diff = (val1 > val2) ? val1 - val2 : val2 - val1; error_max = (diff > error_max) ? diff : error_max; error_min = (diff < error_min) ? diff : error_min; } return error_max - error_min; }
/** Implements the error range measure from Ihler et al. */ public static double logErrorRange (AbstractTableFactor f1, AbstractTableFactor f2) { double error_min = Double.MAX_VALUE; double error_max = 0; Matrix m1 = f1.getLogValueMatrix (); Matrix m2 = f2.getLogValueMatrix (); int nl1 = m1.singleSize (); int nl2 = m2.singleSize (); if (nl1 != nl2) return Double.POSITIVE_INFINITY; for (int l = 0; l < nl1; l++) { double val1 = m1.singleValue (l); double val2 = m2.singleValue (l); double diff = (val1 > val2) ? val1 - val2 : val2 - val1; error_max = (diff > error_max) ? diff : error_max; error_min = (diff < error_min) ? diff : error_min; } return error_max - error_min; }
/** Implements the error range measure from Ihler et al. */ public static double logErrorRange (AbstractTableFactor f1, AbstractTableFactor f2) { double error_min = Double.MAX_VALUE; double error_max = 0; Matrix m1 = f1.getLogValueMatrix (); Matrix m2 = f2.getLogValueMatrix (); int nl1 = m1.singleSize (); int nl2 = m2.singleSize (); if (nl1 != nl2) return Double.POSITIVE_INFINITY; for (int l = 0; l < nl1; l++) { double val1 = m1.singleValue (l); double val2 = m2.singleValue (l); double diff = (val1 > val2) ? val1 - val2 : val2 - val1; error_max = (diff > error_max) ? diff : error_max; error_min = (diff < error_min) ? diff : error_min; } return error_max - error_min; }
private void recomputeFactors () { lastResids = new double [factors ().size ()]; for (Iterator it = cliques.iterator(); it.hasNext();) { UnrolledVarSet clique = (UnrolledVarSet) it.next(); AbstractTableFactor oldF = (AbstractTableFactor) clique.getFactor (); AbstractTableFactor newF = clique.tmpl.computeFactor (clique); double dist = Factors.distLinf ((AbstractTableFactor) oldF.duplicate ().normalize (), (AbstractTableFactor) newF.duplicate ().normalize ()); lastResids [getIndex (oldF)] = dist; oldF.setValues (newF.getLogValueMatrix ()); clique.tmpl.modifyPotential (this, clique, oldF); } }
private void recomputeFactors () { lastResids = new double [factors ().size ()]; for (Iterator it = cliques.iterator(); it.hasNext();) { UnrolledVarSet clique = (UnrolledVarSet) it.next(); AbstractTableFactor oldF = (AbstractTableFactor) clique.getFactor (); AbstractTableFactor newF = clique.tmpl.computeFactor (clique); double dist = Factors.distLinf ((AbstractTableFactor) oldF.duplicate ().normalize (), (AbstractTableFactor) newF.duplicate ().normalize ()); lastResids [getIndex (oldF)] = dist; oldF.setValues (newF.getLogValueMatrix ()); clique.tmpl.modifyPotential (this, clique, oldF); } }
private void recomputeFactors () { lastResids = new double [factors ().size ()]; for (Iterator it = cliques.iterator(); it.hasNext();) { UnrolledVarSet clique = (UnrolledVarSet) it.next(); AbstractTableFactor oldF = (AbstractTableFactor) clique.getFactor (); AbstractTableFactor newF = clique.tmpl.computeFactor (clique); double dist = Factors.distLinf ((AbstractTableFactor) oldF.duplicate ().normalize (), (AbstractTableFactor) newF.duplicate ().normalize ()); lastResids [getIndex (oldF)] = dist; oldF.setValues (newF.getLogValueMatrix ()); clique.tmpl.modifyPotential (this, clique, oldF); } }