public Factor duplicate () { return new BinaryUnaryFactor (var, theta1, theta2); }
public boolean almostEquals (Factor p, double epsilon) { return equals (p); }
public double logValue (AssignmentIterator it) { return Math.log (value (it)); }
public Factor slice (Assignment assn) { Factor alphSlice = sliceForAlpha (assn); // recursively slice, in case assn includes some of the xs return alphSlice.slice (assn); }
public BinaryUnaryFactor (Variable var, Variable theta1, Variable theta2) { super (BinaryUnaryFactor.combineVariables (theta1, theta2, var)); this.theta1 = theta1; this.theta2 = theta2; this.var = var; if (var.getNumOutcomes () != 2) { throw new IllegalArgumentException ("Discrete variable "+var+" in BoltzmannUnary must be binary."); } if (!theta1.isContinuous ()) { throw new IllegalArgumentException ("Parameter "+theta1+" in BinaryUnary must be continuous."); } if (!theta2.isContinuous ()) { throw new IllegalArgumentException ("Parameter "+theta2+" in BinaryUnary must be continuous."); } }
public Factor slice (Assignment assn) { Factor alphSlice = sliceForAlpha (assn); // recursively slice, in case assn includes some of the xs return alphSlice.slice (assn); }
public BinaryUnaryFactor (Variable var, Variable theta1, Variable theta2) { super (BinaryUnaryFactor.combineVariables (theta1, theta2, var)); this.theta1 = theta1; this.theta2 = theta2; this.var = var; if (var.getNumOutcomes () != 2) { throw new IllegalArgumentException ("Discrete variable "+var+" in BoltzmannUnary must be binary."); } if (!theta1.isContinuous ()) { throw new IllegalArgumentException ("Parameter "+theta1+" in BinaryUnary must be continuous."); } if (!theta2.isContinuous ()) { throw new IllegalArgumentException ("Parameter "+theta2+" in BinaryUnary must be continuous."); } }
public Factor slice (Assignment assn) { Factor alphSlice = sliceForAlpha (assn); // recursively slice, in case assn includes some of the xs return alphSlice.slice (assn); }
public Factor duplicate () { return new BinaryUnaryFactor (var, theta1, theta2); }
public double logValue (AssignmentIterator it) { return Math.log (value (it)); }
public boolean almostEquals (Factor p, double epsilon) { return equals (p); }
public BinaryUnaryFactor (Variable var, Variable theta1, Variable theta2) { super (BinaryUnaryFactor.combineVariables (theta1, theta2, var)); this.theta1 = theta1; this.theta2 = theta2; this.var = var; if (var.getNumOutcomes () != 2) { throw new IllegalArgumentException ("Discrete variable "+var+" in BoltzmannUnary must be binary."); } if (!theta1.isContinuous ()) { throw new IllegalArgumentException ("Parameter "+theta1+" in BinaryUnary must be continuous."); } if (!theta2.isContinuous ()) { throw new IllegalArgumentException ("Parameter "+theta2+" in BinaryUnary must be continuous."); } }
public double value (AssignmentIterator it) { Assignment assn = it.assignment(); Factor tbl = sliceForAlpha (assn); return tbl.value (assn); }
public Factor duplicate () { return new BinaryUnaryFactor (var, theta1, theta2); }
public double logValue (AssignmentIterator it) { return Math.log (value (it)); }
public boolean almostEquals (Factor p, double epsilon) { return equals (p); }
public double value (AssignmentIterator it) { Assignment assn = it.assignment(); Factor tbl = sliceForAlpha (assn); return tbl.value (assn); }
public double value (AssignmentIterator it) { Assignment assn = it.assignment(); Factor tbl = sliceForAlpha (assn); return tbl.value (assn); }