Documentation

oslots

# Access to `oslots` feature data.

In general, features are stored as dictionaries, but this specific feature has an optimised representation. Since it is a large feature and present in any CF dataset, this pays off.

Supports two backends: - Dict-based tuple format (.tf loading): data = (slots_tuple, maxSlot, maxNode) - CSR array format (.cfm loading): data = CSRArray instance

Classes

class

OslotsFeature

Attributes

NameTypeDescription
_datatuple[(tuple[(int, ...)], ...)] | CSRArray
_is_mmapbool
apiApi
datatuple[(tuple[(int, ...)], ...)] | CSRArrayAccess to raw slots data.
maxNodeint | None
maxSlotint | None
metadict[(str, str)]Metadata of the feature.

Methods

__init__(self, api: Api, metaData: dict[(str, str)], data: tuple[(tuple[(tuple[(int, ...)], ...)], int, int)] | CSRArray, maxSlot: int | None = None, maxNode: int | None = None) None

Initialize OslotsFeature with either dict-based or CSR backend.

Parameters
  • api: Api
  • metaData: dict[(str, str)]
  • data: tuple[(tuple[(tuple[(int, ...)], ...)], int, int)] | CSRArray
  • maxSlot: int | None= None
  • maxNode: int | None= None
items(self) Iterator[tuple[(int, tuple[(int, ...)])]]

A generator that yields the non-slot nodes with their slots.

s(self, n: int) tuple[(int, ...)]

Get the slots of a (non-slot) node.

Parameters
  • n: int