Skip to main content

featkit — automated feature store generation from relational facts tables

Project description

featkit

featkit is a Python framework for automated feature store generation from relational facts tables.

It implements a three-layer architecture:

  • Layer 1 — input facts table with typed columns (ID, time, categorical, measurement)
  • Layer 2 — horizontal concept table built via pivot (2A) and distributional aggregations (2B)
  • Layer 3 — temporal feature table produced by sliding operators over the Layer 2 columns

The framework is engine-agnostic: the same pipeline definition produces either a standalone SQL script (Snowflake, Databricks SQL, Spark SQL) or a lazy PySpark execution plan, with the choice abstracted behind a code generator interface.

Key concepts

Layer What it does
Layer 2A — Pivot GROUP BY (ID, time) + CASE WHEN per categorical combination × measurement × aggregator
Layer 2B — Distributional Per-categorical CTEs computing entropy, HHI, dominant proportion, mode, count
Layer 3 — Temporal Sliding window operators (PROM_U, SUM_U, CREC, FREQ, REC, …) over all Layer 2 columns

Installation

pip install featkit

Quickstart

from featkit import FeatureStorePipeline, FeatureStoreConfig
from featkit.dataset import SimpleDataset
from featkit.fields import IDField, TimeField, CategoricalField, MeasurementField
from featkit.enums import MeasurementType, TimeGranularity, CategoricalTreatment
from featkit.generators.sql import SnowflakeSQLCodeGenerator

# Define schema
fields = [
    IDField(name="ID_CLIENTE"),
    TimeField(name="PERIODO",
              source_granularity=TimeGranularity.MONTHLY,
              target_granularity=TimeGranularity.MONTHLY),
    CategoricalField(name="SECTOR", treatment=CategoricalTreatment.PIVOT,
                     allowed_values=["RETAIL", "CORP", "PYME"]),
    CategoricalField(name="CANAL",  treatment=CategoricalTreatment.PIVOT,
                     allowed_values=["DIGITAL", "PRESENCIAL", "TELEFONO"]),
    MeasurementField(name="MTO", measurement_type=MeasurementType.MONTO),
    MeasurementField(name="TRX", measurement_type=MeasurementType.CANTIDAD),
]

dataset = SimpleDataset(
    source_reference="MY_DB.MY_SCHEMA.FACTS_TABLE",
    fields=fields,
)

config = FeatureStoreConfig(
    dataset=dataset,
    output_schema="MY_DB.MY_SCHEMA",
    output_table_prefix="FS",
    time_windows=[3, 6, 9, 12],
)

pipeline = FeatureStorePipeline(config).build()
output = pipeline.run(SnowflakeSQLCodeGenerator())

output.save("./output")
# Writes: output/script.sql, output/dag.json, output/diagram.md

Architecture

See docs/general_plan.md for the full implementation plan.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

featkit-0.1.0.tar.gz (57.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

featkit-0.1.0-py3-none-any.whl (43.4 kB view details)

Uploaded Python 3

File details

Details for the file featkit-0.1.0.tar.gz.

File metadata

  • Download URL: featkit-0.1.0.tar.gz
  • Upload date:
  • Size: 57.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for featkit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6171097e72906e2adab282e070ff9b576cd8c960f3a767b5f9340795144af70e
MD5 1217e1e95f47243af9e7633a2b6d4636
BLAKE2b-256 8a19b29ac60946ccc69108e9a1a85683fe19d089881cd525a7103c647394d534

See more details on using hashes here.

Provenance

The following attestation bundles were made for featkit-0.1.0.tar.gz:

Publisher: publish.yml on Mirkiux/featkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file featkit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: featkit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 43.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for featkit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 85320b8941ae144becbb11a720f2a9adc90c8ed6495edc8ed5570845d659909c
MD5 068f054758baba41dbe8293c0974200e
BLAKE2b-256 2e327f7f329b6e3a5b58cc7f3274b73d1d23b2f633d13371d2cfbf53a8bc4dad

See more details on using hashes here.

Provenance

The following attestation bundles were made for featkit-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Mirkiux/featkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page