lenskit.data.schema#

Pydantic models for LensKit data schemas. These models define define the data schema in memory and also define how schemas are serialized to and from configuration files. See Data Model for details.

Note

The schema does not specify data types directly — data types are inferred from the underlying Arrow data structures. This reduces duplication of type information and the opportunity for inconsistency.

Attributes#

Classes#

AllowableTroolean

Stores both whether a feature is allowed and is used in the case of having repeats.

AttrLayout

Possible layouts for entity attributes.

DataSchema

Description of the entities and layout of a dataset.

EntitySchema

Entity class definitions in the dataset schema.

RelationshipSchema

Relationship class definitions in the dataset schema.

ColumnSpec

Functions#

id_col_name(name)

num_col_name(name)

check_name(name)

Check if a name is valid.

Module Contents#

lenskit.data.schema.CURRENT_VERSION = '2025.3'#
lenskit.data.schema.OLDEST_VERSION = '2025.1'#
lenskit.data.schema.LOAD_CONTEXT#
lenskit.data.schema.NAME_PATTERN#
type lenskit.data.schema.Name = Annotated[str, StringConstraints(pattern=NAME_PATTERN)]#
lenskit.data.schema.id_col_name(name)#
Parameters:

name (str)

Return type:

str

lenskit.data.schema.num_col_name(name)#
Parameters:

name (str)

Return type:

str

lenskit.data.schema.check_name(name)#

Check if a name is valid.

Raises:

ValueError – when the name is invalid.

Parameters:

name (str)

Return type:

None