latents.data#
Observation data containers for latent variable models.
Classes
Store and manipulate views of observed static data. |
|
Store and manipulate views of observed time series data. |
- class ObsStatic(data: ndarray, dims: ndarray)[source]#
Store and manipulate views of observed static data.
- Parameters:
- data
ndarrayoffloat, shape (y_dim,n_samples) Observed data. Groups are stacked vertically. For example, if there are three groups with dimensionalities 2, 3, and 4, then
datais a ndarray of shape(9, n_samples), anddata[:2, :]contains the first group,data[2:5, :]contains the second group, anddata[5:, :]contains the third group.- dims
ndarrayofint, shape (n_groups,) Dimensionalities of each observed group.
- data
- Attributes:
- Raises:
TypeErrorIf
dataordimsis not a ndarray.ValueErrorIf the sum of
dimsdoes not equal the number of rows indata.
Examples
Create observation data with two groups (3 and 2 dimensions):
>>> import numpy as np >>> from latents.data import ObsStatic >>> data = np.random.randn(5, 100) # 5 total dims, 100 samples >>> dims = np.array([3, 2]) # Group 1 has 3 dims, group 2 has 2 >>> Y = ObsStatic(data, dims) >>> Y ObsStatic(data.shape=(5, 100), dims=[3 2])
Access data for each group separately:
>>> groups = Y.get_groups() >>> groups[0].shape # First group (3, 100) >>> groups[1].shape # Second group (2, 100)
- class ObsTimeSeries[source]#
Store and manipulate views of observed time series data.
Stub for future implementation.
- Raises:
NotImplementedErrorAlways raised; this class is a placeholder for future implementation.