Best Practices
Use these practices to prepare source tables before creating a Kumo Relational graph, the connected representation of your tables and their relationships that Kumo uses for predictions. Clear table boundaries, reliable keys, timestamps, and column types help Kumo interpret your data correctly.
Table Structure and Entity Design
An entity table represents a type of object, such as a user or policy. An event table represents actions or observations over time, such as transactions or claims.
-
Model one entity type or event type per table. Keeping each type in its own table makes its identifiers, attributes, and relationships unambiguous.
-
Use a single event-time column per table. A single timestamp gives each event table one clear time axis for prediction.
-
Model many-to-many relationships with junction tables. A junction table stores one row per relationship between records in two other tables.
Data Preparation
-
Set pandas dtypes before creating a graph. These dtypes control how pandas stores each column and provide Kumo with a reliable starting point for type inference.
-
Use consistent naming conventions. Give matching key columns the same name across tables so relationships are easier to define and review.
-
Ensure that primary keys are unique and non-null. Each primary key must identify exactly one row.
Plan Semantic Types
A Kumo semantic type describes how Kumo should interpret a column, independently of how pandas stores it. Before constructing the graph, plan the semantic type for each important column:
- Identifiers and relationship keys must use
ID. - Free-form descriptions must use
text. - Labels from a finite set must use
categorical. - Quantities and measurements must use
numerical. - Event times must use
timestamp.
After creating the graph, review the inferred semantic types and correct any that do not match the column’s role.
Plan Prediction-Ready Relationships
Plan for the Predictive Query Language (PQL) questions that you want to ask when you prepare your source tables. For example, predicting future transaction activity for each user requires an entity table for users, a timestamped event table for transactions, and a key that relates each transaction to a user.
Common Data Modeling Patterns
The following patterns show how to separate common business data into tables with clear keys and relationships.
Entity-event pattern
Use this pattern when one table describes entities and another records events associated with them.
Hierarchical entities
Use this pattern when entities belong to other entities at multiple levels.
Junction table for a many-to-many relationship
Use this pattern when each record in either entity table can relate to multiple records in the other.
Summary
Use this checklist before creating your Kumo Relational graph.
Table design
- Model one entity type or event type per table.
- Use a single event-time column per table.
- Use unique primary keys with consistent key names.
- Model many-to-many relationships with junction tables.
Data preparation
- Set the appropriate pandas dtypes before creating the graph.
- Plan meaningful semantic types such as
ID,categorical,text, andnumerical.
Relationship planning
- Prepare consistent key columns for meaningful relationships between entities.
- Consider PQL query requirements when structuring the data.
These patterns help produce source data that is ready for graph construction.