Skip to content

PropertyTransformer

relationalai.semantics.reasoners.predictive.property_transformer
PropertyTransformer(
*,
text: Optional[list[Chain | Concept]] = None,
category: Optional[list[Chain | Concept]] = None,
datetime: Optional[list[Chain | Concept]] = None,
continuous: Optional[list[Chain | Concept]] = None,
integer: Optional[list[Chain | Concept]] = None,
drop: Optional[list[Chain | Concept]] = None,
time_col: Optional[Chain | List[Chain]] = None
)

Annotate concept fields with semantic types for GNN data preparation.

A PropertyTransformer tells the GNN pipeline how to encode each column before training. Pass lists of concept fields (Concept.field chains) or entire Concept objects to the constructor, grouped by semantic type.

Fields that are not mentioned are auto-inferred (SemanticType.INFER). Passing a Concept instead of a field sets the default type for all unmentioned fields of that concept.

  • text

    (list of Chain or Concept, default: None) - Fields containing free-form text, embedded via a language model (e.g. product names, descriptions).
  • category

    (list of Chain or Concept, default: None) - Fields with discrete categorical values — enum codes, boolean flags, status strings, or numeric IDs that represent categories.
  • datetime

    (list of Chain or Concept, default: None) - Date or timestamp fields.
  • continuous

    (list of Chain or Concept, default: None) - Numeric fields representing continuous measurements (e.g. price, age, rating).
  • integer

    (list of Chain or Concept, default: None) - Integer fields that should be kept as integers rather than treated as categorical.
  • drop

    (list of Chain or Concept, default: None) - Fields (or entire concepts) to exclude from the model. Commonly used for primary keys, foreign keys, and target columns.
  • time_col

    (Chain or list of Chain, default: None) - The column(s) used for temporal ordering in temporal models. Each concept may have at most one time_col. A time_col field cannot also be dropped.
pt = PropertyTransformer(
category=[User.gender, Event.city, Event.country],
continuous=[User.age, Event.lat, Event.lng],
datetime=[Event.start_time],
drop=[User.user_id],
time_col=[Event.start_time],
)

Drop all fields of a concept by passing the concept itself:

pt = PropertyTransformer(
category=[Article.product_code],
drop=[Customer],
)

For columns with spaces or special characters (e.g. "weight(kg)", "fasting blood sugar"), use getattr to reference them:

pt = PropertyTransformer(
continuous=[
getattr(People, "weight(kg)"),
getattr(People, "fasting blood sugar"),
]
)
 semantics > reasoners > predictive > estimator
└──  GNN