rbnet.autoencoder.AutoencoderNonTermVar
- class rbnet.autoencoder.AutoencoderNonTermVar(dim, chart_type='TMap', *args, **kwargs)[source]
Bases:
NonTermVar
A point-wise continuous non-terminal variable of dimensionality
dim
. Distributions over these variables can be thought of as Dirac deltas (the limit of infinitely narrow Gaussians), represented by a location (a specific variable value) and weight (in the case of mixtures or inside probabilities).- Parameters:
cardinality – cardinality
chart_type – type of chart to use (“dict” or “TMap”)
Public Methods:
__init__
(dim[, chart_type])A point-wise continuous non-terminal variable of dimensionality
dim
.get_chart
(n, *args, **kwargs)Initialise a chart for sequence of length n.
mixture
(components[, weights, dim])Approximate a mixture by its weighted average.
Inherited from
NonTermVar
__init__
(*args, **kwargs)get_chart
(*args, **kwargs)Return a parse chart to store this variable type in.
mixture
(*args, **kwargs)Compute a mixture over this variable type.
- get_chart(n, *args, **kwargs)[source]
Initialise a chart for sequence of length n. :type n: :param n: length of the sequence :return: chart
- mixture(components, weights=None, dim=0)[source]
Approximate a mixture by its weighted average. The new weight is the sum of mixture weights. Mixture weights are provided as part of the
components
; additional weights provided asweights
are multiplied on the weights provided incomponents
.- Parameters:
components – array-like with pairs of (values, weights) mixture components along
dim
weights – [optional] weights of the mixture components; must be compatible (broadcastable) to weights in
components
dim – integer or tuple of integers indicating the dimensions of
components
along which to sum to compute the mixture
- Returns:
distribution corresponding to the mixture