lenskit.data.types#

Basic data types used in data representations.

Attributes#

FeedbackType

Types of feedback supported.

NPID

NumPy entity identifier types.

ID

Allowable identifier types.

IDArray

NumPy arrays of identifiers.

IDSequence

Sequences of identifiers.

NPMatrix

NPVector

DF_FORMAT

MAT_FORMAT

LAYOUT

Classes#

AliasedColumn

A data frame column with possible aliases.

UIPair

A user-item pair of values.

Extent

Representation of a range with a start and end.

Module Contents#

type lenskit.data.types.FeedbackType = Literal['explicit', 'implicit']#

Types of feedback supported.

type lenskit.data.types.NPID = np.integer[Any] | np.str_ | np.bytes_ | np.object_#

NumPy entity identifier types.

type lenskit.data.types.ID = CoreID | NPID#

Allowable identifier types.

type lenskit.data.types.IDArray = np.ndarray[tuple[int], np.dtype[NPID]]#

NumPy arrays of identifiers.

type lenskit.data.types.IDSequence = '\n    Sequence[ID]\n    | IDArray\n    | pa.StringArray\n    | pa.IntegerArray[Any]\n    | pa.ChunkedArray[Any]\n    | pd.Series[CoreID]\n    '#

Sequences of identifiers.

type lenskit.data.types.NPMatrix = np.ndarray[tuple[int, int], np.dtype[V]]#
type lenskit.data.types.NPVector = np.ndarray[tuple[int], np.dtype[V]]#
type lenskit.data.types.DF_FORMAT = Literal['numpy', 'pandas', 'torch']#
type lenskit.data.types.MAT_FORMAT = Literal['scipy', 'torch', 'pandas', 'structure']#
type lenskit.data.types.LAYOUT = Literal['csr', 'coo']#
class lenskit.data.types.AliasedColumn#

A data frame column with possible aliases.

Stability:
Testing (see Stability Levels).
name: str#

The column name.

compat_aliases: list[str] = []#

A list of aliases for the column.

warn: bool = False#

Whether to warn when using an alias.

class lenskit.data.types.UIPair#

Bases: Generic[_UIPT]

A user-item pair of values.

user: _UIPT#
item: _UIPT#
class lenskit.data.types.Extent#

Bases: NamedTuple

Representation of a range with a start and end.

start: int#

The range start (inclusive).

end: int#

The range end (exclusive).

property size: int#

The size of the extent.

Return type:

int