Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

wedata3-feature-engineering

WeData 3.0 特征工程与 Feature Store 客户端 SDK,封装 Feast 0.49 并对接 WeData 平台(Tclake、腾讯云 SDK、MLflow)。

PyPI 包名:wedata3-feature-engineering Python 入口:import wedata


功能特性

  • Feature Store 客户端:基于 Feast 的特征注册、查询、在线 / 离线特征获取(Redis / Postgres 后端)
  • 特征工程客户端:训练集构造、特征关联(feature lookup)、特征表管理
  • MLflow 集成:以 wedata.feature_store.mlflow_model / wedata.feature_engineering.mlflow_model 形式将特征查询逻辑随模型一起持久化,预测时自动取在线特征
  • Spark 支持:内置 Spark Client,离线特征通过 PySpark 处理
  • 腾讯云生态:通过 tencentcloud-sdk-python 与 Tclake、CAM 等平台能力集成

目录结构

feature-engineering/
├── README.md                       # 本文件
├── setup.py                        # 打包配置
├── build.sh                        # 本地构建 + 上传 PyPI 脚本
├── requirements.txt                # 运行依赖
├── test_valid.py                   # 冒烟测试入口
├── tests/                          # 单元测试
└── wedata/                         # 主包(顶层 import 名)
    ├── __init__.py                 # 暴露版本号
    ├── feature_store/              # Feature Store 客户端(与 MLflow 集成)
    │   ├── client.py
    │   ├── mlflow_model.py
    │   ├── feature_table_client/
    │   └── training_set_client/
    ├── feature_engineering/        # 特征工程客户端(封装 Feast)
    │   ├── client.py
    │   ├── mlflow_model.py
    │   ├── feast/
    │   ├── ml_training_client/
    │   └── table_client/
    └── common/                     # 公共能力
        ├── base_table_client/      # 表客户端基类
        ├── cloud_sdk_client/       # 腾讯云 SDK 封装
        ├── feast_client/           # Feast 适配
        ├── spark_client/           # Spark / PySpark 封装
        ├── entities/               # 领域实体
        ├── constants/              # 常量
        ├── protos/                 # protobuf 定义
        ├── log/                    # 日志
        └── utils/                  # 工具函数

环境要求

  • Python:>= 3.10
  • PySpark:3.5.0(与 py4j==0.10.9.7 配合)
  • Feast:0.49.0(extras=[redis,postgres]
  • MLflow:根据使用场景二选一
    • mlflow2 extra:mlflow==2.17.2(WeData 2.0)
    • mlflow3 extra:mlflow>=3.10.0,<3.11.0(WeData 3.0)

安装

# 仅运行时,使用 MLflow 3.x(WeData 3.0 默认)
pip install "wedata3-feature-engineering[mlflow3]"

# WeData 2.0 场景
pip install "wedata3-feature-engineering[mlflow2]"

# 开发依赖(flake8 / pytest / python-dotenv)
pip install "wedata3-feature-engineering[dev]"

快速使用

# 特征工程:构造训练集
from wedata.feature_engineering.client import FeatureEngineeringClient

fe_client = FeatureEngineeringClient()
training_set = fe_client.create_training_set(
    df=labels_df,
    feature_lookups=[...],
    label="label",
)

# Feature Store:在线特征查询
from wedata.feature_store.client import FeatureStoreClient

fs_client = FeatureStoreClient()
features = fs_client.get_online_features(
    feature_refs=["user_features:age", "user_features:city"],
    entity_rows=[{"user_id": "u_001"}],
)

构建与发布

# 本地打包并上传 PyPI(需要在 ~/.pypirc 配置好凭据)
bash build.sh

build.sh 会:

  1. 清理旧的 dist/ / build/ / *.egg-info/
  2. 读取 wedata/__init__.py 中的 __version__
  3. 安装 build / twine
  4. python3 -m build 生成 wheel + sdist
  5. twine upload 推送到 PyPI 镜像

与本仓库其他子项目的关系

项目 关系
../feast-server/ 本 SDK 默认通过 Feast 的 RemoteRegistry 访问 feast-server 的 gRPC 接口,作为特征注册表
../mlflow-server/ mlflow_model.py 序列化的特征逻辑可被 MLflow Server 加载与下发
../wedata-ml-runtime/ Notebook Kernel 启动时会注入 Feast / MLflow 的网关代理与租户隔离逻辑,本 SDK 在其上层使用

许可证

Apache License 2.0

Release files for wedata3-feature-engineering 0.2.4rc3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wedata3-feature-engineering 0.2.4rc3
File Size Uploaded
wedata3_feature_engineering-0.2.4rc3.tar.gz 185.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wedata3-feature-engineering 0.2.4rc3
File Interpreter ABI Platform
wedata3_feature_engineering-0.2.4rc3-py3-none-any.whl Python 3 none any Details

Total release size: 368.9 kB

Release files / wedata3_feature_engineering-0.2.4rc3.tar.gz

Download URL wedata3_feature_engineering-0.2.4rc3.tar.gz
Size 185.0 kB
Tags Source
SHA-256 checksum
How to use checksums
14f15b098405a1f2736c650c48b061ea0fb2d62f093e56e8bbcef6e50220db5a
BLAKE2b-256 checksum
How to use checksums
5b6e8de59b8daff992c573d381fa76a86b8662bd28ea45c09ab8af346c8c6bfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / wedata3_feature_engineering-0.2.4rc3-py3-none-any.whl

Download URL wedata3_feature_engineering-0.2.4rc3-py3-none-any.whl
Size 183.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c6754817fd8340a6e9bc7bf4d1a8ae999be73f6b1098ca7545af6aa908b6144
BLAKE2b-256 checksum
How to use checksums
84b2ba88753749fd662aa3c34c5db928dab14890d6b98cb034ac59d953cce95d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page