tlc.core.builtins.schemas.schemas

A number of helper classes for common simple schemas

Module Contents

Classes

Class

Description

Float32ListSchema

A schema for a list of float32 values

Int32ListSchema

A schema for a list of int32 values

XyzSchema

A Schema defining an (x, y, z) value

COCOLabelSchema

A Schema defining COCO label

CIFAR10LabelSchema

A Schema defining CIFAR10 label

CategoricalLabelSchema

A schema for a categorical label

CategoricalLabelListSchema

A schema for a list of categorical labels

FloatVector2Schema

A schema for a 2D vector

FloatVector3Schema

A schema for a 3D vector

ExampleIdSchema

A schema for example ID values

EpochSchema

A schema for epoch values

IterationSchema

A schema for iteration values

ForeignTableIdSchema

A schema describing a value that identifies a foreign table

SampleWeightSchema

A schema for sample weight values

API

class Float32ListSchema(
**kwargs: Any,
)

Bases: tlc.core.schema.Schema

A schema for a list of float32 values

class Int32ListSchema(
**kwargs: Any,
)

Bases: tlc.core.schema.Schema

A schema for a list of int32 values

class XyzSchema(
display_name: str = '',
description: str = '',
writable: bool = True,
display_importance: float = 0,
value_type: str = _DEFAULT_SCALAR_VALUE_TYPE,
)

Bases: tlc.core.schema.Schema

A Schema defining an (x, y, z) value

class COCOLabelSchema(
display_name: str = 'label',
description: str = 'COCO Label',
writable: bool = False,
display_importance: float = 0,
)

Bases: tlc.core.schema.Schema

A Schema defining COCO label

class CIFAR10LabelSchema(
display_name: str = 'label',
description: str = 'CIFAR-10 Label',
writable: bool = False,
display_importance: float = 0,
value_type: str = _DEFAULT_SCALAR_VALUE_TYPE,
)

Bases: tlc.core.schema.Schema

A Schema defining CIFAR10 label

class CategoricalLabelSchema(
class_names: list[str] | None = None,
classes: Sequence[str] | Sequence[dict[str, str]] | Sequence[MapElement] | dict[float, str] | dict[int, str] | dict[float, MapElement] | dict[int, MapElement] | None = None,
**kwargs: Any,
)

Bases: tlc.core.schema.Schema

A schema for a categorical label

Parameters:
  • class_names – Deprecated, use classes instead

  • classes – The classes to use for the label. If a list or sequence, each item will be converted to a MapElement and assigned a zero-based integer key. If a dict, the keys will be used as the label values and the values will be converted to MapElements.

  • kwargs – Additional arguments to pass to the Schema constructor

class CategoricalLabelListSchema(
classes: Sequence[str] | Sequence[dict[str, str]] | Sequence[MapElement] | dict[float, str] | dict[int, str] | dict[float, MapElement] | dict[int, MapElement] | None = None,
class_names: list[str] | None = None,
**kwargs: Any,
)

Bases: tlc.core.builtins.schemas.schemas.CategoricalLabelSchema

A schema for a list of categorical labels

Parameters:
  • classes – The classes to use for the label

  • class_names – Deprecated, use classes instead

  • kwargs – Additional arguments to pass to the Schema constructor

class FloatVector2Schema(
display_name: str = '2D Embedding',
description: str = '',
writable: bool = False,
display_importance: float = 0,
number_role: str = NUMBER_ROLE_XY_COMPONENT,
mode: Literal[numpy, python] = 'python',
)

Bases: tlc.core.schema.Schema

A schema for a 2D vector

class FloatVector3Schema(
display_name: str = '3D Embedding',
description: str = '',
writable: bool = False,
display_importance: float = 0,
number_role: str = NUMBER_ROLE_XYZ_COMPONENT,
mode: Literal[numpy, python] = 'python',
)

Bases: tlc.core.schema.Schema

A schema for a 3D vector

class ExampleIdSchema(
display_name: str = 'Example ID',
description: str = '',
writable: bool = False,
computable: bool = False,
)

Bases: tlc.core.schema.Schema

A schema for example ID values

Example ID is a unique identifier for an example. It is used to identify examples across different tables.

class EpochSchema(
display_name: str = 'Epoch',
description: str = 'Epoch of training',
display_importance: float | None = None,
)

Bases: tlc.core.schema.Schema

A schema for epoch values

class IterationSchema(
display_name: str = 'Iteration',
description: str = 'The current iteration of the training process.',
display_importance: float | None = None,
)

Bases: tlc.core.schema.Schema

A schema for iteration values

class ForeignTableIdSchema(
foreign_table_url: str,
display_name: str = '',
)

Bases: tlc.core.schema.Schema

A schema describing a value that identifies a foreign table

class SampleWeightSchema(
display_name: str = 'Weight',
description: str = 'The weights of the samples in this table.',
sample_type: str = 'hidden',
default_value: float = 1.0,
)

Bases: tlc.core.schema.Schema

A schema for sample weight values

Initialize the SampleWeightSchema

Parameters:
  • display_name – The display name of the schema

  • description – The description of the schema

  • sample_type – The sample type of the schema

  • default_value – The default value of the schema