Combination function for factors.
Combination function for factors. By default, this is product, but other operations (such as divide that is a valid operation for some semirings) can use this
Test whether a factor contains a value for a specific index
Creates a new factor of the same type
Returns a new Factor with duplicate variable(s) removed
Fill the contents of this factor by applying a rule to every combination of values.
Get the value associated with a row.
Get the value associated with a row. The row is identified by an list of indices into the ranges of the variables over which the factor is defined.
Get the contents of a factor as a traversable (note: no indicies provided)
Fill the contents of the target by applying the given function to all elements of this factor.
Returns the marginalization of the factor to a variable according to the given addition function.
Returns the marginalization of the factor to a variable according to the given addition function. Unlike marginalizeTo, this uses the provided sum function. This is useful e.g. to easily switch between max-product and sum-product operations when the data within are unchanged and the product operation is the same.
The returned factor uses the semiring associated with this factor; it does not override the sum function of the semiring with the function given here.
Returns the product of this factor with another factor according to a given multiplication function.
Returns the product of this factor with another factor according to a given multiplication function. The product is associated with all variables in the two inputs, and the value associated with an assignment is the product of the values in the two inputs.
Returns a factor that maps values of the other variables to the value of the given variable that maximizes the entry associated with that value, according to some maximization function.
Returns a factor that maps values of the other variables to the value of the given variable that maximizes the entry associated with that value, according to some maximization function. comparator defines the maximization. It returns true iff its second argument is greater than its first.
The type of element whose value is being recorded. The resulting factor maps values of other variables in this factor to this type.
Set the value associated with a row.
Set the value associated with a row. The row is identified by an list of indices into the ranges of the variables over which the factor is defined.
Return the contents of a factor as a string
Returns the summation of the factor over a variable according to an addition function.
Returns the summation of the factor over a variable according to an addition function. The result is associated with all the variables in the input except for the summed over variable and the value for a set of assignments is the sum of the values of the corresponding assignments in the input.
If no funciton is provided, this defaults to the sum function in this factor's semiring.
Produce a readable string representation of the factor
Fold the given function through the contents of the factor, beginning with the given initial values
Indicates if any of this Factor's variables has Star
Indicates if this Factor is condition/constrained
Indicates if this Factor has any variables
Returns the marginalization of the factor to a variable according to the addition function in this factor's semiring.
Returns the marginalization of the factor to a variable according to the addition function in this factor's semiring. This involves summing out all other variables.
Description that includes the variable list and conditional probabilities
Description that includes the variable list and conditional probabilities
Definition of Factor
A factor is associated with a set of variables and specifies a value for every combination of assignments to those variables.
Factors are parameterized by the type of the Variables they contain and contain a semiring that defines the mathematical operation to be performed on the values Parent variables are distinguished from the output variable.
Refactored by