quantlab.model.collected_panel#

The collected panel: what a model’s collect() read, and the arrays built from it.

A model reads its factors and labels over its own date range into one panel indexed by (timestamp, symbol). CollectedPanel holds that panel sorted on both axes, the record of the reads and what it was read for, and builds the numpy arrays the model fits and predicts on once each. Every model holding the same collected panel, each walk-forward fold of a model and the members of a seed ensemble, reads the same arrays. The module loads no torch.

Examples#

>>> panel = CollectedPanel(dataset, record={}, source=None)
>>> x, timestamps, symbols = panel.array(["f_a", "f_b"], np.float32)
>>> x.shape, x.dtype
((40, 3, 2), dtype('float32'))

Classes

CollectedPanel

A model's collected panel: the data sorted on both axes, its read record, its arrays.

Functions

as_feature_dtype

Return data with every variable cast to FEATURE_DTYPE.

sorted_panel

Return data with both axes increasing, sorting only when they are not.

to_array

Convert a panel to a [num_times, num_symbols, len(variables)] array.