rbnet.autoencoder.AutoencoderNonTermVar
- class rbnet.autoencoder.AutoencoderNonTermVar(dim, chart_type='TMap', *args, **kwargs)[source]
Bases:
NonTermVarA 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 asweightsare multiplied on the weights provided incomponents.- Parameters:
components – array-like with pairs of (values, weights) mixture components along
dimweights – [optional] weights of the mixture components; must be compatible (broadcastable) to weights in
componentsdim – integer or tuple of integers indicating the dimensions of
componentsalong which to sum to compute the mixture
- Returns:
distribution corresponding to the mixture