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.3.0.tar.gz (70.9 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.3.0-py3-none-any.whl (55.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for featkit-0.3.0.tar.gz
Algorithm Hash digest
SHA256 833eda77944215b5099c5a0cc1181be097a2513a46b18cae7d8591a8144fe4dd
MD5 2d21827c225ab6bd68112b9051a2c974
BLAKE2b-256 8ef738ff6af17622e8b6a16d7f32d9d39c0753c698424f6436b3d43b37ce40f2

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: featkit-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 55.3 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 101b2028085d80e64e1ff744fcc7058261e1d4a6564151980562756b47d1fbc0
MD5 52b1dfbd34736869b812be9cb54f0a05
BLAKE2b-256 569c2a5b00ae325a628836249b76c7a8ab0d96e901111d7b088bd4bd4704adad

See more details on using hashes here.

Provenance

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