Skip to main content

Python SDK for Feast

Project description


unit-tests integration-tests linter Docs Latest Python API License GitHub Release

Overview

Feast is an open source feature store for machine learning. Feast is the fastest path to productionizing analytic data for model training and online inference.

Please see our documentation for more information about the project.

Architecture

The above architecture is the minimal Feast deployment. Want to run the full Feast on Kubernetes? Click here.

Getting Started

1. Install Feast

pip install feast

2. Create a feature repository

feast init my_feature_repo
cd my_feature_repo

3. Register your feature definitions and set up your feature store

feast apply

4. Build a training dataset

from feast import FeatureStore
import pandas as pd
from datetime import datetime

entity_df = pd.DataFrame.from_dict({
    "driver_id": [1001, 1002, 1003, 1004],
    "event_timestamp": [
        datetime(2021, 4, 12, 10, 59, 42),
        datetime(2021, 4, 12, 8,  12, 10),
        datetime(2021, 4, 12, 16, 40, 26),
        datetime(2021, 4, 12, 15, 1 , 12)
    ]
})

store = FeatureStore(repo_path=".")

training_df = store.get_historical_features(
    entity_df=entity_df, 
    feature_refs = [
        'driver_hourly_stats:conv_rate',
        'driver_hourly_stats:acc_rate',
        'driver_hourly_stats:avg_daily_trips'
    ],
).to_df()

print(training_df.head())

# Train model
# model = ml.fit(training_df)
      event_timestamp  driver_id  driver_hourly_stats__conv_rate  driver_hourly_stats__acc_rate
  2021-04-12 08:12:10       1002                        0.497279                       0.357702
  2021-04-12 10:59:42       1001                        0.979747                       0.008166
  2021-04-12 15:01:12       1004                        0.151432                       0.551748
  2021-04-12 16:40:26       1003                        0.951506                       0.753572

5. Load feature values into your online store

CURRENT_TIME=$(date -u +"%Y-%m-%dT%H:%M:%S")
feast materialize-incremental $CURRENT_TIME
Materializing feature view driver_hourly_stats from 2021-04-14 to 2021-04-15 done!

6. Read online features at low latency

from pprint import pprint
from feast import FeatureStore

store = FeatureStore(repo_path=".")

feature_vector = store.get_online_features(
    feature_refs=[
        'driver_hourly_stats:conv_rate',
        'driver_hourly_stats:acc_rate',
        'driver_hourly_stats:avg_daily_trips'
    ],
    entity_rows=[{"driver_id": 1001}]
).to_dict()

pprint(feature_vector)

# Make prediction
# model.predict(feature_vector)
{
    "driver_id": [1001],
    "driver_hourly_stats__conv_rate": [0.49274],
    "driver_hourly_stats__acc_rate": [0.92743],
    "driver_hourly_stats__avg_daily_trips": [72]
}

Important resources

Please refer to the official documentation at Documentation

Contributing

Feast is a community project and is still under active development. Please have a look at our contributing and development guides if you want to contribute to the project:

Contributors ✨

Thanks goes to these incredible people:

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

feast-0.10.0.tar.gz (171.9 kB view details)

Uploaded Source

Built Distribution

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

feast-0.10.0-py3-none-any.whl (173.2 kB view details)

Uploaded Python 3

File details

Details for the file feast-0.10.0.tar.gz.

File metadata

  • Download URL: feast-0.10.0.tar.gz
  • Upload date:
  • Size: 171.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

File hashes

Hashes for feast-0.10.0.tar.gz
Algorithm Hash digest
SHA256 7bc14ecc311b87845adbd11c15875102843759c2a3410c143c79c982d6d46b48
MD5 3714f41d52737d335a1085b9d93e20dd
BLAKE2b-256 916c8352330243620781f0ca86545343ce1e005b925618d073bb3e1ec8408b21

See more details on using hashes here.

File details

Details for the file feast-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: feast-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 173.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

File hashes

Hashes for feast-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee7101b3035f3dbfb908c256f694ed94df8661253e1939c3d56160667b6c1afb
MD5 ea3df691645b20a31f4c2301bb9c3ee0
BLAKE2b-256 69dd9ac7bbc9658090ed3de5aa1a0be8618cf32b4fa4517338815e3a7f672548

See more details on using hashes here.

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