Skip to content

API Reference

Timefence's Python API is organized around five core objects and four functions.

Core Objects

Class Purpose
Source A historical data source (Parquet, CSV, DataFrame)
Feature A named signal derived from a Source
Labels Prediction target definition
FeatureSet Group features for reuse
Store Build tracking and caching

Functions

Function Purpose
build() Construct a point-in-time correct training dataset
audit() Scan a dataset for temporal leakage
explain() Preview join logic without executing
diff() Compare two datasets for changes

Quick example

import timefence

source = timefence.Source(path="data/users.parquet", keys=["user_id"], timestamp="updated_at")
feature = timefence.Feature(source=source, columns=["country"])
labels = timefence.Labels(path="data/labels.parquet", keys=["user_id"], label_time="label_time", target="churned")

result = timefence.build(labels=labels, features=[feature], output="train.parquet")