public Factor lookupMarginal (VarSet varSet) { Factor mrgl = samples.marginalize (varSet); AbstractTableFactor tbl = mrgl.asTable (); tbl.normalize (); return tbl; }
public Factor lookupMarginal (VarSet varSet) { Factor mrgl = samples.marginalize (varSet); AbstractTableFactor tbl = mrgl.asTable (); tbl.normalize (); return tbl; }
public Factor lookupMarginal (VarSet varSet) { Factor mrgl = samples.marginalize (varSet); AbstractTableFactor tbl = mrgl.asTable (); tbl.normalize (); return tbl; }
public void plusEquals (Factor f) { if (f instanceof DiscreteFactor) { DiscreteFactor factor = (DiscreteFactor) f; expandToContain (factor); factor = ensureOperandCompatible (factor); plusEqualsInternal (factor); } else if (f instanceof ConstantFactor) { plusEquals (f.value (new Assignment ())); } else { AbstractTableFactor tbl; try { tbl = f.asTable (); } catch (UnsupportedOperationException e) { throw new UnsupportedOperationException ("Don't know how to add "+this+" by "+f); } plusEquals (tbl); } }
public void plusEquals (Factor f) { if (f instanceof DiscreteFactor) { DiscreteFactor factor = (DiscreteFactor) f; expandToContain (factor); factor = ensureOperandCompatible (factor); plusEqualsInternal (factor); } else if (f instanceof ConstantFactor) { plusEquals (f.value (new Assignment ())); } else { AbstractTableFactor tbl; try { tbl = f.asTable (); } catch (UnsupportedOperationException e) { throw new UnsupportedOperationException ("Don't know how to add "+this+" by "+f); } plusEquals (tbl); } }
public void plusEquals (Factor f) { if (f instanceof DiscreteFactor) { DiscreteFactor factor = (DiscreteFactor) f; expandToContain (factor); factor = ensureOperandCompatible (factor); plusEqualsInternal (factor); } else if (f instanceof ConstantFactor) { plusEquals (f.value (new Assignment ())); } else { AbstractTableFactor tbl; try { tbl = f.asTable (); } catch (UnsupportedOperationException e) { throw new UnsupportedOperationException ("Don't know how to add "+this+" by "+f); } plusEquals (tbl); } }
/** * Does the conceptual equivalent of this *= pot. * Assumes that pot's variables are a subset of * this potential's. */ public void multiplyBy (Factor pot) { if (pot instanceof DiscreteFactor) { DiscreteFactor factor = (DiscreteFactor) pot; expandToContain (factor); factor = ensureOperandCompatible (factor); multiplyByInternal (factor); } else if (pot instanceof ConstantFactor) { timesEquals (pot.value (new Assignment ())); } else { AbstractTableFactor tbl; try { tbl = pot.asTable (); } catch (UnsupportedOperationException e) { throw new UnsupportedOperationException ("Don't know how to multiply "+this+" by "+pot); } multiplyBy (tbl); } }
/** * Does the conceptual equivalent of this /= pot. * Assumes that pot's variables are a subset of * this potential's. */ public void divideBy (Factor pot) { if (pot instanceof DiscreteFactor) { DiscreteFactor pot1 = (DiscreteFactor) pot; // cheating expandToContain (pot1); pot1 = ensureOperandCompatible (pot1); divideByInternal (pot1); } else if (pot instanceof ConstantFactor) { timesEquals (1.0 / pot.value (new Assignment ())); } else { AbstractTableFactor tbl; try { tbl = pot.asTable (); } catch (UnsupportedOperationException e) { throw new UnsupportedOperationException ("Don't know how to multiply "+this+" by "+pot); } multiplyBy (tbl); } }
/** * Does the conceptual equivalent of this /= pot. * Assumes that pot's variables are a subset of * this potential's. */ public void divideBy (Factor pot) { if (pot instanceof DiscreteFactor) { DiscreteFactor pot1 = (DiscreteFactor) pot; // cheating expandToContain (pot1); pot1 = ensureOperandCompatible (pot1); divideByInternal (pot1); } else if (pot instanceof ConstantFactor) { timesEquals (1.0 / pot.value (new Assignment ())); } else { AbstractTableFactor tbl; try { tbl = pot.asTable (); } catch (UnsupportedOperationException e) { throw new UnsupportedOperationException ("Don't know how to multiply "+this+" by "+pot); } multiplyBy (tbl); } }
/** * Does the conceptual equivalent of this *= pot. * Assumes that pot's variables are a subset of * this potential's. */ public void multiplyBy (Factor pot) { if (pot instanceof DiscreteFactor) { DiscreteFactor factor = (DiscreteFactor) pot; expandToContain (factor); factor = ensureOperandCompatible (factor); multiplyByInternal (factor); } else if (pot instanceof ConstantFactor) { timesEquals (pot.value (new Assignment ())); } else { AbstractTableFactor tbl; try { tbl = pot.asTable (); } catch (UnsupportedOperationException e) { throw new UnsupportedOperationException ("Don't know how to multiply "+this+" by "+pot); } multiplyBy (tbl); } }
/** * Does the conceptual equivalent of this *= pot. * Assumes that pot's variables are a subset of * this potential's. */ public void multiplyBy (Factor pot) { if (pot instanceof DiscreteFactor) { DiscreteFactor factor = (DiscreteFactor) pot; expandToContain (factor); factor = ensureOperandCompatible (factor); multiplyByInternal (factor); } else if (pot instanceof ConstantFactor) { timesEquals (pot.value (new Assignment ())); } else { AbstractTableFactor tbl; try { tbl = pot.asTable (); } catch (UnsupportedOperationException e) { throw new UnsupportedOperationException ("Don't know how to multiply "+this+" by "+pot); } multiplyBy (tbl); } }
/** * Does the conceptual equivalent of this /= pot. * Assumes that pot's variables are a subset of * this potential's. */ public void divideBy (Factor pot) { if (pot instanceof DiscreteFactor) { DiscreteFactor pot1 = (DiscreteFactor) pot; // cheating expandToContain (pot1); pot1 = ensureOperandCompatible (pot1); divideByInternal (pot1); } else if (pot instanceof ConstantFactor) { timesEquals (1.0 / pot.value (new Assignment ())); } else { AbstractTableFactor tbl; try { tbl = pot.asTable (); } catch (UnsupportedOperationException e) { throw new UnsupportedOperationException ("Don't know how to multiply "+this+" by "+pot); } multiplyBy (tbl); } }