c

SparseFactor 

class SparseFactor[T] extends BasicFactor[T]

Sparse implementation of BasicFactor backed by a Map storage

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.

This implementation stores only non-default (non-zero) elements and supplies special sum and product methods to account for the missing values.

Linear Supertypes
BasicFactor[T], Factor[T], AnyRef, Any
Ordering
1. Alphabetic
2. By Inheritance
Inherited
1. SparseFactor
2. BasicFactor
3. Factor
4. AnyRef
5. Any
1. Hide All
2. Show All
Visibility
1. Public
2. All

Instance Constructors

1. new SparseFactor(parents: List[Variable[_]], output: List[Variable[_]], semiring: Semiring[T] = ...)

Type Members

1. class SparseIndices extends Indices

Value Members

1. final def !=(arg0: Any): Boolean
Definition Classes
AnyRef → Any
2. final def ##(): Int
Definition Classes
AnyRef → Any
3. final def ==(arg0: Any): Boolean
Definition Classes
AnyRef → Any
4. final def asInstanceOf[T0]: T0
Definition Classes
Any
5. def clone(): AnyRef
Attributes
protected[java.lang]
Definition Classes
AnyRef
Annotations
@throws( ... )
6. def combination(that: Factor[T], op: (T, T) ⇒ T): Factor[T]

produces a new Factor from the combined input variables of the input factors.

produces a new Factor from the combined input variables of the input factors.

The factor values are computed using the corresponding values from the input factors. This correspondence is determined by the overlap between the variables of this factor and the multiplier factor. When indices from this factor and indices from the multiplier match on the overlapping variables, a new set of indices is constructed for the new factor based on the two input indices and a new value is computed by applying the op to the two input values. The new factor is updated with the new indices and the new value.

that

The Factor to combine with this one

op

The operation used to combine (multiply) factor values

returns

The new Factor containing the combined values of the inputs

Definition Classes
SparseFactorBasicFactorFactor
7. def contains(index: List[Int]): Boolean
Definition Classes
Factor
8. val contents: Map[List[Int], T]
9. def contentsContains(index: List[Int]): Boolean

Test whether a factor contains a value for a specific index

Test whether a factor contains a value for a specific index

Definition Classes
SparseFactorFactor
10. def convertIndicesToValues(indices: List[Int]): List[Extended[_]]
Definition Classes
Factor
11. def createFactor[T](_parents: List[Variable[_]], _output: List[Variable[_]], _semiring: Semiring[T] = semiring): SparseFactor[T]

Creates a new factor of the same type

Creates a new factor of the same type

Definition Classes
SparseFactorFactor
12. def deDuplicate(): Factor[T]

Returns a new Factor with duplicate variable(s) removed

Returns a new Factor with duplicate variable(s) removed

Definition Classes
BasicFactorFactor
13. final def eq(arg0: AnyRef): Boolean
Definition Classes
AnyRef
14. def equals(arg0: Any): Boolean
Definition Classes
AnyRef → Any
15. def fillByRule(rule: (List[Extended[_]]) ⇒ T): Factor[T]

Fill the contents of this factor by applying a rule to every combination of parent and output values.

Fill the contents of this factor by applying a rule to every combination of parent and output values.

Definition Classes
BasicFactorFactor
16. def finalize(): Unit
Attributes
protected[java.lang]
Definition Classes
AnyRef
Annotations
@throws( classOf[java.lang.Throwable] )
17. def foldLeft(initial: T, fn: (T, T) ⇒ T): T

Fold the given function through the contents of the factor, beginning with the given initial values

Fold the given function through the contents of the factor, beginning with the given initial values

Definition Classes
Factor
18. def generateIndices
Definition Classes
Factor
19. def get(indices: List[Int]): T

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. Rows with default values will be missing, so supply the missing value for these rows

Definition Classes
SparseFactorFactor
20. final def getClass(): Class[_]
Definition Classes
AnyRef → Any
21. def getContents(): Traversable[T]

Get the contents of a factor as a traversable (note: no indicies provided)

Get the contents of a factor as a traversable (note: no indicies provided)

Definition Classes
SparseFactorFactor
22. def getIndices

List the indices with non-default values

List the indices with non-default values

Definition Classes
SparseFactorFactor
23. def hasStar: Boolean

Indicates if any of this Factor's variables has Star

Indicates if any of this Factor's variables has Star

Definition Classes
Factor
24. def hashCode(): Int
Definition Classes
AnyRef → Any
25. val isConstraint: Boolean

Indicates if this Factor is condition/constrained

Indicates if this Factor is condition/constrained

Definition Classes
Factor
26. def isEmpty: Boolean

Indicates if this Factor has any variables

Indicates if this Factor has any variables

Definition Classes
Factor
27. final def isInstanceOf[T0]: Boolean
Definition Classes
Any
28. def mapTo[U](fn: (T) ⇒ U, _semiring: Semiring[U] = semiring): Factor[U]

Creates a new SparseFactor by applying the supplied function to all values of this factor.

Creates a new SparseFactor by applying the supplied function to all values of this factor.

The new factor can have a new type parameter as well as a new semiring

fn

The function to apply to each value of this Factor

Definition Classes
SparseFactorBasicFactorFactor
29. def marginalizeTo(targets: Variable[_]*): Factor[T]

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.

Definition Classes
Factor
30. def marginalizeToWithSum(sum: (T, T) ⇒ T, targets: Variable[_]*): Factor[T]

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.

Definition Classes
BasicFactorFactor
31. final def ne(arg0: AnyRef): Boolean
Definition Classes
AnyRef
32. final def notify(): Unit
Definition Classes
AnyRef
33. final def notifyAll(): Unit
Definition Classes
AnyRef
34. lazy val numVars: Int
Definition Classes
Factor
35. val output: List[Variable[_]]
Definition Classes
SparseFactorFactor
36. val parents: List[Variable[_]]
Definition Classes
SparseFactorFactor
37. def product(that: Factor[T]): Factor[T]

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 the combined variables of the two inputs, and the value associated with an assignment is the product of the values in the two inputs.

Definition Classes
BasicFactorFactor
38. def recordArgMax[U](variable: Variable[U], comparator: (T, T) ⇒ Boolean, _semiring: Semiring[U] = semiring.asInstanceOf[Semiring[U]]): Factor[U]

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.

U

The type of element whose value is being recorded. The resulting factor maps values of other variables in this factor to this type.

Definition Classes
SparseFactorBasicFactorFactor
39. val semiring: Semiring[T]
Definition Classes
SparseFactorBasicFactorFactor
40. def set(indices: List[Int], value: T): Factor[T]

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.

Definition Classes
SparseFactorFactor
41. val size: Int
Definition Classes
Factor
42. def stringContents(): String

Return the contents of a factor as a string

Return the contents of a factor as a string

Definition Classes
SparseFactorFactor
43. def sumOver(variable: Variable[_], sum: (T, T) ⇒ T = semiring.sum): Factor[T]

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.

Definition Classes
BasicFactorFactor
44. final def synchronized[T0](arg0: ⇒ T0): T0
Definition Classes
AnyRef

Produce a readable string representation of the factor

Produce a readable string representation of the factor

Definition Classes
BasicFactorFactor
46. def toString(): String

Description that includes the variable list and conditional probabilities

Description that includes the variable list and conditional probabilities

Definition Classes
Factor → AnyRef → Any
47. def unionVars[U](that: Factor[U]): (List[Variable[_]], List[Variable[_]], List[Int], List[Int])

takes the variables in two factors and produces their set union.

takes the variables in two factors and produces their set union.

It produces a mapping from each original variable to its new location. Similarly it produces a mapping from each new variable to its new location.

Definition Classes
BasicFactor
48. def variables: List[Variable[_]]
Definition Classes
Factor
49. final def wait(): Unit
Definition Classes
AnyRef
Annotations
@throws( ... )
50. final def wait(arg0: Long, arg1: Int): Unit
Definition Classes
AnyRef
Annotations
@throws( ... )
51. final def wait(arg0: Long): Unit
Definition Classes
AnyRef
Annotations
@throws( ... )