跳到正文
cccskills
免费在 GitHub 公开

feast-user-guide

Use this guide to define Feast entities and feature views, configure a feature store, and retrieve online or historical features. It also explains CLI commands and vector search, which finds similar documents for RAG pipelines.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Guide for working with Feast (Feature Store) — defining features, configuring feature_store.yaml, retrieving features online/offline, using the CLI, and building RAG retrieval pipelines. Use when the user asks about creating entities, feature views, on-demand feature views, stream feature views, feature services, data sources, feature_store.yaml configuration, feast apply/materialize commands, online or historical feature retrieval, or vector-based document retrieval with Feast.

feast-dev/feast星标 7,347(GitHub 7,347 + cccskills 0)

实测评分 未实测

查看安装方法

适用场景

  • Defining entities, data sources, and feature views
  • Configuring feature_store.yaml and registering definitions
  • Retrieving online features or historical training data
  • Building vector search and RAG retrieval pipelines

包含的文件(8)

  • SKILL.md6.9 KB
  • feast-architecture/SKILL.md16.5 KB
  • feast-dev/SKILL.md5.0 KB
  • feast-testing/SKILL.md9.0 KB
  • feast-user-guide/SKILL.md6.9 KB
  • references/configuration.md7.0 KB
  • references/feature-definitions.md10.1 KB
  • references/retrieval-and-rag.md8.2 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Feast User Guide

Quick Start

A Feast project requires:

  1. A feature_store.yaml config file
  2. Python files defining entities, data sources, feature views, and feature services
  3. Running feast apply to register definitions
feast init my_project
cd my_project
feast apply

Core Concepts

Entity

An entity is a collection of semantically related features (e.g., a customer, a driver). Entities have join keys used to look up features.

from feast import Entity
from feast.value_type import ValueType

driver = Entity(
    name="driver_id",
    description="Driver identifier",
    value_type=ValueType.INT64,
)

Data Sources

Data sources describe where raw feature data lives.

from feast import FileSource, BigQuerySource, KafkaSource, PushSource, RequestSource
from feast.data_format import ParquetFormat

# Batch source (file)
driver_stats_source = FileSource(
    name="driver_stats_source",
    path="data/driver_stats.parquet",
    timestamp_field="event_timestamp",
    created_timestamp_column="created",
)

# Request source (for on-demand features)
input_request = RequestSource(
    name="vals_to_add",
    schema=[Field(name="val_to_add", dtype=Float64)],
)

FeatureView

Maps features from a data source to entities with a schema, TTL, and online/offline settings.

from feast import FeatureView, Field
from feast.types import Float32, Int64, String
from datetime import timedelta

driver_hourly_stats = FeatureView(
    name="driver_hourly_stats",
    entities=[driver],
    ttl=timedelta(days=365),
    schema=[
        Field(name="conv_rate", dtype=Float32),
        Field(name="acc_rate", dtype=Float32),
        Field(name="avg_daily_trips", dtype=Int64),
    ],
    online=True,
    source=driver_stats_source,
)

OnDemandFeatureView

Computes features at request time from other feature views and/or request data.

from feast import on_demand_feature_view
import pandas as pd

@on_demand_feature_view(
    sources=[driver_hourly_stats, input_request],
    schema=[Field(name="conv_rate_plus_val", dtype=Float64)],
    mode="pandas",
)
def transformed_conv_rate(inputs: pd.DataFrame) -> pd.DataFrame:
    df = pd.DataFrame()
    df["conv_rate_plus_val"] = inputs["conv_rate"] + inputs["val_to_add"]
    return df

FeatureService

Groups features from multiple views for retrieval.

from feast import FeatureService

driver_fs = FeatureService(
    name="driver_ranking",
    features=[driver_hourly_stats, transformed_conv_rate],
)

Feature Retrieval

Online (low-latency)

from feast import FeatureStore

store = FeatureStore(repo_path=".")

features = store.get_online_features(
    features=[
        "driver_hourly_stats:conv_rate",
        "driver_hourly_stats:acc_rate",
    ],
    entity_rows=[{"driver_id": 1001}, {"driver_id": 1002}],
).to_dict()

Historical (training data with point-in-time joins)

entity_df = pd.DataFrame({
    "driver_id": [1001, 1002],
    "event_timestamp": [datetime(2023, 1, 1), datetime(2023, 1, 2)],
})

training_df = store.get_historical_features(
    entity_df=entity_df,
    features=["driver_hourly_stats:conv_rate", "driver_hourly_stats:acc_rate"],
).to_df()

Or use a FeatureService:

training_df = store.get_historical_features(
    entity_df=entity_df,
    features=driver_fs,
).to_df()

Materialization

Load features from offline store into online store:

# Full materialization over a time range
feast materialize 2023-01-01T00:00:00 2023-12-31T23:59:59

# Incremental (from last materialized timestamp)
feast materialize-incremental $(date -u +"%Y-%m-%dT%H:%M:%S")

Python API:

from datetime import datetime
store.materialize(start_date=datetime(2023, 1, 1), end_date=datetime(2023, 12, 31))
store.materialize_incremental(end_date=datetime.utcnow())

CLI Commands

CommandPurpose
feast init [DIR]Create new feature repository
feast applyRegister/update feature definitions
feast planPreview changes without applying
feast materialize START ENDMaterialize features to online store
feast materialize-incremental ENDIncremental materialization
feast entities listList registered entities
feast feature-views listList feature views
feast feature-services listList feature services
feast on-demand-feature-views listList on-demand feature views
feast teardownRemove infrastructure resources
feast versionShow SDK version

Options: --chdir / -c (run in different directory), --feature-store-yaml / -f (override config path).

Vector Search / RAG

Define a feature view with vector fields for similarity search:

from feast.types import Array, Float32

wiki_passages = FeatureView(
    name="wiki_passages",
    entities=[passage_entity],
    schema=[
        Field(name="passage_text", dtype=String),
        Field(
            name="embedding",
            dtype=Array(Float32),
            vector_index=True,
            vector_length=384,
            vector_search_metric="COSINE",
        ),
    ],
    source=passages_source,
    online=True,
)

Retrieve similar documents:

results = store.retrieve_online_documents(
    feature="wiki_passages:embedding",
    query=query_embedding,
    top_k=5,
)

feature_store.yaml Minimal Config

project: my_project
registry: data/registry.db
provider: local
online_store:
  type: sqlite
  path: data/online_store.db

Common Imports

from feast import (
    Entity, FeatureView, OnDemandFeatureView, FeatureService,
    Field, FileSource, RequestSource, FeatureStore,
)
from feast.on_demand_feature_view import on_demand_feature_view
from feast.types import Float32, Float64, Int64, String, Bool, Array
from feast.value_type import ValueType
from datetime import timedelta

Detailed References

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Understand how Feast components fit together and how data moves through the system. Trace operations such as applying definitions, materializing features, and retrieving online data, and locate the relevant code when exploring or changing the codebase.

中文简介正在准备中。当前显示英语简介。

  • Tracing what happens during `feast apply`
  • Understanding how registry metadata is stored
  • Following feature data into an online store
feast-dev/feast73472026年10月25日 更新

feast-dev

免费

Prepare to contribute to Feast by setting up the development environment, running tests and linters, and finding your way around the project structure. The guide also explains documentation placement and practical pull request conventions.

中文简介正在准备中。当前显示英语简介。

  • Setting up a local Feast development environment
  • Running tests and lint checks before a change
  • Finding where a new store implementation belongs
feast-dev/feast73472026年10月25日 更新

Test and debug Feast, a feature store for managing machine learning data. Run focused unit and integration tests, add tests for components such as registries or online stores, inspect live registry state, and investigate common runtime and retrieval problems.

中文简介正在准备中。当前显示英语简介。

  • Running a focused Feast test after a code change
  • Writing unit tests for a new online store component
  • Investigating stale registry metadata
feast-dev/feast73472026年10月25日 更新

查看 feast-dev 的全部技能

报告此技能的问题