Skip to main content

Wedata Feature Engineering Library Development

Project description

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

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

wedata3_feature_engineering-0.2.4rc2.tar.gz (180.6 kB view details)

Uploaded Source

Built Distribution

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

wedata3_feature_engineering-0.2.4rc2-py3-none-any.whl (181.9 kB view details)

Uploaded Python 3

File details

Details for the file wedata3_feature_engineering-0.2.4rc2.tar.gz.

File metadata

File hashes

Hashes for wedata3_feature_engineering-0.2.4rc2.tar.gz
Algorithm Hash digest
SHA256 1ef5c0a9ba7fa2caea7351743eff882de0af6049c6cf52a51f8e2164c4ad62f7
MD5 b2fdea56ea2086b6596fb69fa1e3f1d4
BLAKE2b-256 78d38370b63632975697e040c97b48c86a7baaba6ad1098988af9e76f13d78d4

See more details on using hashes here.

File details

Details for the file wedata3_feature_engineering-0.2.4rc2-py3-none-any.whl.

File metadata

File hashes

Hashes for wedata3_feature_engineering-0.2.4rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 0d28cab759a442c36e9170358a42554bedc82f62b5ca858169ef1577f9e2c95a
MD5 f4f2398af69e36aca307432fae41f113
BLAKE2b-256 60c61a07fc92a62a6aa7372485ef4953e4e8fd573895238449757d0412060115

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