bayespy.nodes.Take

class bayespy.nodes.Take(node, indices, plate_axis=- 1, **kwargs)[source]

Choose elements/sub-arrays along a plate axis

Basically, applies np.take on a plate axis. Allows advanced mapping of plates.

Parameters
nodeNode

A node to apply the take operation on.

indicesarray of integers

Plate elements to pick along a plate axis.

plate_axisint (negative)

The plate axis to pick elements from (default: -1).

See also

numpy.take

Examples

>>> from bayespy.nodes import Gamma, Take
>>> alpha = Gamma([1, 2, 3], [1, 1, 1])
>>> x = Take(alpha, [1, 1, 2, 2, 1, 0])
>>> x.get_moments()[0]
array([2., 2., 3., 3., 2., 1.])
__init__(node, indices, plate_axis=- 1, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(node, indices[, plate_axis])

Initialize self.

add_plate_axis(to_plate)

broadcasting_multiplier(plates, *args)

delete()

Delete this node and the children

get_mask()

get_moments()

get_pdf_nodes()

get_shape(ind)

has_plotter()

Return True if the node has a plotter

lower_bound_contribution([gradient])

move_plates(from_plate, to_plate)

plot([fig])

Plot the node distribution using the plotter of the node

random()

set_plotter(plotter)

Attributes

plates

plates_multiplier

Plate multiplier is applied to messages to parents