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.4.1.tar.gz (76.6 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.4.1-py3-none-any.whl (58.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for featkit-0.4.1.tar.gz
Algorithm Hash digest
SHA256 5c4796d0e015ca687f16f6edefc7a6d650acb8a47e9c505ae0d913be6229e2f5
MD5 46d55dd55d6fa462c24e803c24093ec6
BLAKE2b-256 c18f5c1aa914a69f82fa1a3e1acd1fdc57717980aae62d11bd5d456391624649

See more details on using hashes here.

Provenance

The following attestation bundles were made for featkit-0.4.1.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.4.1-py3-none-any.whl.

File metadata

  • Download URL: featkit-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 58.9 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.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0eabd40c5c158c466189b88be053959d8e33d4cc756cdc4967d973a7d4d4068b
MD5 97fa3ced59246dbec9c6e1b8568b5dc7
BLAKE2b-256 6af3ff83971afd7a3603f63ce4e21773fe4a4fbc3f56bda8e2bc021b46cf6096

See more details on using hashes here.

Provenance

The following attestation bundles were made for featkit-0.4.1-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