staran 0.5.0__tar.gz → 0.6.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. staran-0.6.1/MANIFEST.in +5 -0
  2. {staran-0.5.0 → staran-0.6.1}/PKG-INFO +42 -20
  3. staran-0.5.0/staran.egg-info/PKG-INFO → staran-0.6.1/README.md +25 -35
  4. staran-0.6.1/pyproject.toml +38 -0
  5. staran-0.6.1/setup.py +38 -0
  6. staran-0.6.1/staran/__init__.py +0 -0
  7. staran-0.6.1/staran/banks/__init__.py +30 -0
  8. staran-0.6.1/staran/banks/xinjiang_icbc/__init__.py +90 -0
  9. staran-0.6.1/staran/models/__init__.py +72 -0
  10. staran-0.6.1/staran/models/daifa_models.py +361 -0
  11. staran-0.6.1/staran/schemas/__init__.py +27 -0
  12. staran-0.6.1/staran/schemas/aum/__init__.py +210 -0
  13. staran-0.5.0/README.md → staran-0.6.1/staran.egg-info/PKG-INFO +57 -9
  14. {staran-0.5.0 → staran-0.6.1}/staran.egg-info/SOURCES.txt +7 -7
  15. staran-0.5.0/setup.py +0 -32
  16. staran-0.5.0/staran/__init__.py +0 -261
  17. staran-0.5.0/staran/examples/__init__.py +0 -8
  18. staran-0.5.0/staran/examples/aum_longtail.py +0 -250
  19. staran-0.5.0/staran/examples/aum_longtail_old.py +0 -487
  20. staran-0.5.0/staran/models/__init__.py +0 -81
  21. staran-0.5.0/staran/models/bank_configs.py +0 -269
  22. staran-0.5.0/staran/schemas/__init__.py +0 -28
  23. staran-0.5.0/staran/schemas/aum/__init__.py +0 -306
  24. staran-0.5.0/staran.egg-info/requires.txt +0 -3
  25. {staran-0.5.0 → staran-0.6.1}/LICENSE +0 -0
  26. {staran-0.5.0 → staran-0.6.1}/setup.cfg +0 -0
  27. {staran-0.5.0 → staran-0.6.1}/staran/engines/__init__.py +0 -0
  28. {staran-0.5.0 → staran-0.6.1}/staran/engines/base.py +0 -0
  29. {staran-0.5.0 → staran-0.6.1}/staran/engines/hive.py +0 -0
  30. {staran-0.5.0 → staran-0.6.1}/staran/engines/spark.py +0 -0
  31. {staran-0.5.0 → staran-0.6.1}/staran/engines/turing.py +0 -0
  32. {staran-0.5.0 → staran-0.6.1}/staran/features/__init__.py +0 -0
  33. {staran-0.5.0 → staran-0.6.1}/staran/features/engines.py +0 -0
  34. {staran-0.5.0 → staran-0.6.1}/staran/features/generator.py +0 -0
  35. {staran-0.5.0 → staran-0.6.1}/staran/features/manager.py +0 -0
  36. {staran-0.5.0 → staran-0.6.1}/staran/features/schema.py +0 -0
  37. {staran-0.5.0 → staran-0.6.1}/staran/models/config.py +0 -0
  38. {staran-0.5.0 → staran-0.6.1}/staran/models/registry.py +0 -0
  39. {staran-0.5.0 → staran-0.6.1}/staran/models/target.py +0 -0
  40. {staran-0.5.0 → staran-0.6.1}/staran/tools/__init__.py +0 -0
  41. {staran-0.5.0 → staran-0.6.1}/staran/tools/date.py +0 -0
  42. {staran-0.5.0/staran/schemas → staran-0.6.1/staran/tools}/document_generator.py +0 -0
  43. {staran-0.5.0 → staran-0.6.1}/staran.egg-info/dependency_links.txt +0 -0
  44. {staran-0.5.0 → staran-0.6.1}/staran.egg-info/top_level.txt +0 -0
@@ -0,0 +1,5 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include staran *.py
4
+ recursive-exclude * __pycache__
5
+ recursive-exclude * *.py[co]
@@ -1,48 +1,70 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: staran
3
- Version: 0.5.0
3
+ Version: 0.6.1
4
4
  Summary: staran - 高性能Python工具库
5
5
  Home-page: https://github.com/starlxa/staran
6
6
  Author: StarAn
7
- Author-email: starlxa@icloud.com
7
+ Author-email: StarAn <starlxa@icloud.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/starlxa/staran
10
+ Project-URL: Bug Reports, https://github.com/starlxa/staran/issues
11
+ Project-URL: Source, https://github.com/starlxa/staran
12
+ Keywords: machine-learning,feature-engineering,data-processing,sql-generation
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
8
17
  Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Programming Language :: Python :: 3.7
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Operating System :: OS Independent
10
25
  Requires-Python: >=3.7
11
26
  Description-Content-Type: text/markdown
12
27
  License-File: LICENSE
13
- Requires-Dist: datetime
14
- Requires-Dist: calendar
15
- Requires-Dist: re
16
28
  Dynamic: author
17
- Dynamic: author-email
18
- Dynamic: classifier
19
- Dynamic: description
20
- Dynamic: description-content-type
21
29
  Dynamic: home-page
22
30
  Dynamic: license-file
23
- Dynamic: requires-dist
24
31
  Dynamic: requires-python
25
- Dynamic: summary
26
32
 
27
- # Star## ✨ v0.4.2 新特性
33
+ # Star## Staran ✨ v0.6.1 新特性
28
34
 
29
- - 📋 **独立Schema模块** - 专门的表结构定义和管理模块
35
+ - **完善的包管理** - 优化setup.py配置,移除不必要的标准库依赖
36
+ - �📋 **独立Schema模块** - 专门的表结构定义和管理模块
30
37
  - 📄 **文档自动生成** - 支持Markdown/PDF/HTML格式的技术文档生成
31
38
  - 🏢 **业务域支持** - AUM等业务领域的标准表结构定义
32
- - 🔗 **无缝集成** - Schema与特征工程examples模块完美集成
39
+ - 🔗 **无缝集成** - Schema与特征工程模块完美集成
33
40
  - 🛠️ **模块化引擎架构** - 独立的引擎模块,支持Spark、Hive、图灵平台
34
41
  - 🔧 **统一接口设计** - 所有引擎提供一致的SQL生成、执行和下载接口
35
42
  - 🎯 **继承复用架构** - TuringEngine继承SparkEngine,复用SQL生成逻辑
36
43
  - 📦 **清晰代码分离** - SQL生成与平台特定执行逻辑完全分离
37
44
  - 🚀 **易于扩展** - 新增数据库支持只需实现BaseEngine接口
38
45
  - 📁 **独立引擎存储** - engines/文件夹专门存放所有数据库引擎
39
- - 🔄 **向后兼容** - 保持对原有API的完全兼容工程工具包
46
+ - 🔄 **向后兼容** - 保持对原有API的完全兼容
47
+
48
+ ## 🎯 专为机器学习设计的Python工具包
49
+
50
+ Staran是一个强大的特征工程和数据处理工具包,提供从数据到模型的完整解决方案。特别针对工银图灵平台优化,让特征工程和模型训练变得前所未有的简单。
51
+
52
+ ## ✨ v0.6.1 新特性
53
+
54
+ - 🔧 **完善的包管理** - 优化setup.py配置,移除不必要的标准库依赖
55
+ - 🛠️ **模块化引擎架构** - 独立的引擎模块,支持Spark、Hive、图灵平台
56
+ - 🔧 **统一接口设计** - 所有引擎提供一致的SQL生成、执行和下载接口
57
+ - 🎯 **继承复用架构** - TuringEngine继承SparkEngine,复用SQL生成逻辑
58
+ - 📦 **清晰代码分离** - SQL生成与平台特定执行逻辑完全分离
59
+ - 🚀 **易于扩展** - 新增数据库支持只需实现BaseEngine接口
60
+ - 📁 **独立引擎存储** - engines/文件夹专门存放所有数据库引擎
61
+ - 🔄 **向后兼容** - 保持对原有API的完全兼容
40
62
 
41
63
  ## � 专为机器学习设计的Python工具包
42
64
 
43
65
  Staran是一个强大的特征工程和数据处理工具包,提供从数据到模型的完整解决方案。特别针对工银图灵平台优化,让特征工程和模型训练变得前所未有的简单。
44
66
 
45
- ## ✨ v0.4.2 新特性
67
+ ## ✨ v0.6.0 新特性
46
68
 
47
69
  - �️ **模块化引擎架构** - 独立的引擎模块,支持Spark、Hive、图灵平台
48
70
  - 🔧 **统一接口设计** - 所有引擎提供一致的SQL生成、执行和下载接口
@@ -361,7 +383,7 @@ tomorrow = date.add_days(1) # 202504 (智能处理)
361
383
 
362
384
  ```
363
385
  staran/
364
- ├── __init__.py # 主包入口,v0.4.2功能导出
386
+ ├── __init__.py # 主包入口,v0.6.0功能导出
365
387
  ├── schemas/ # 🆕 表结构定义与文档生成模块
366
388
  │ ├── __init__.py # Schema模块入口
367
389
  │ ├── document_generator.py # 文档生成器 (MD/PDF/HTML)
@@ -385,7 +407,7 @@ staran/
385
407
  │ ├── __init__.py # 工具模块
386
408
  │ └── date.py # Date类实现
387
409
  ├── setup.py # 安装配置
388
- ├── README.md # 本文档 v0.4.2
410
+ ├── README.md # 本文档 v0.6.0
389
411
  └── quick-upload.sh # 快速部署脚本
390
412
  ```
391
413
 
@@ -561,4 +583,4 @@ MIT License
561
583
 
562
584
  ---
563
585
 
564
- **Staran v0.4.2** - 模块化引擎架构,让机器学习特征工程变得前所未有的简单 🌟
586
+ **Staran v0.6.0** - 模块化引擎架构,让机器学习特征工程变得前所未有的简单 🌟
@@ -1,48 +1,38 @@
1
- Metadata-Version: 2.4
2
- Name: staran
3
- Version: 0.5.0
4
- Summary: staran - 高性能Python工具库
5
- Home-page: https://github.com/starlxa/staran
6
- Author: StarAn
7
- Author-email: starlxa@icloud.com
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Requires-Python: >=3.7
11
- Description-Content-Type: text/markdown
12
- License-File: LICENSE
13
- Requires-Dist: datetime
14
- Requires-Dist: calendar
15
- Requires-Dist: re
16
- Dynamic: author
17
- Dynamic: author-email
18
- Dynamic: classifier
19
- Dynamic: description
20
- Dynamic: description-content-type
21
- Dynamic: home-page
22
- Dynamic: license-file
23
- Dynamic: requires-dist
24
- Dynamic: requires-python
25
- Dynamic: summary
26
-
27
- # Star## ✨ v0.4.2 新特性
28
-
29
- - 📋 **独立Schema模块** - 专门的表结构定义和管理模块
1
+ # Star## Staran ✨ v0.6.1 新特性
2
+
3
+ - � **完善的包管理** - 优化setup.py配置,移除不必要的标准库依赖
4
+ - �📋 **独立Schema模块** - 专门的表结构定义和管理模块
30
5
  - 📄 **文档自动生成** - 支持Markdown/PDF/HTML格式的技术文档生成
31
6
  - 🏢 **业务域支持** - AUM等业务领域的标准表结构定义
32
- - 🔗 **无缝集成** - Schema与特征工程examples模块完美集成
7
+ - 🔗 **无缝集成** - Schema与特征工程模块完美集成
8
+ - 🛠️ **模块化引擎架构** - 独立的引擎模块,支持Spark、Hive、图灵平台
9
+ - 🔧 **统一接口设计** - 所有引擎提供一致的SQL生成、执行和下载接口
10
+ - 🎯 **继承复用架构** - TuringEngine继承SparkEngine,复用SQL生成逻辑
11
+ - 📦 **清晰代码分离** - SQL生成与平台特定执行逻辑完全分离
12
+ - 🚀 **易于扩展** - 新增数据库支持只需实现BaseEngine接口
13
+ - 📁 **独立引擎存储** - engines/文件夹专门存放所有数据库引擎
14
+ - 🔄 **向后兼容** - 保持对原有API的完全兼容
15
+
16
+ ## 🎯 专为机器学习设计的Python工具包
17
+
18
+ Staran是一个强大的特征工程和数据处理工具包,提供从数据到模型的完整解决方案。特别针对工银图灵平台优化,让特征工程和模型训练变得前所未有的简单。
19
+
20
+ ## ✨ v0.6.1 新特性
21
+
22
+ - 🔧 **完善的包管理** - 优化setup.py配置,移除不必要的标准库依赖
33
23
  - 🛠️ **模块化引擎架构** - 独立的引擎模块,支持Spark、Hive、图灵平台
34
24
  - 🔧 **统一接口设计** - 所有引擎提供一致的SQL生成、执行和下载接口
35
25
  - 🎯 **继承复用架构** - TuringEngine继承SparkEngine,复用SQL生成逻辑
36
26
  - 📦 **清晰代码分离** - SQL生成与平台特定执行逻辑完全分离
37
27
  - 🚀 **易于扩展** - 新增数据库支持只需实现BaseEngine接口
38
28
  - 📁 **独立引擎存储** - engines/文件夹专门存放所有数据库引擎
39
- - 🔄 **向后兼容** - 保持对原有API的完全兼容工程工具包
29
+ - 🔄 **向后兼容** - 保持对原有API的完全兼容
40
30
 
41
31
  ## � 专为机器学习设计的Python工具包
42
32
 
43
33
  Staran是一个强大的特征工程和数据处理工具包,提供从数据到模型的完整解决方案。特别针对工银图灵平台优化,让特征工程和模型训练变得前所未有的简单。
44
34
 
45
- ## ✨ v0.4.2 新特性
35
+ ## ✨ v0.6.0 新特性
46
36
 
47
37
  - �️ **模块化引擎架构** - 独立的引擎模块,支持Spark、Hive、图灵平台
48
38
  - 🔧 **统一接口设计** - 所有引擎提供一致的SQL生成、执行和下载接口
@@ -361,7 +351,7 @@ tomorrow = date.add_days(1) # 202504 (智能处理)
361
351
 
362
352
  ```
363
353
  staran/
364
- ├── __init__.py # 主包入口,v0.4.2功能导出
354
+ ├── __init__.py # 主包入口,v0.6.0功能导出
365
355
  ├── schemas/ # 🆕 表结构定义与文档生成模块
366
356
  │ ├── __init__.py # Schema模块入口
367
357
  │ ├── document_generator.py # 文档生成器 (MD/PDF/HTML)
@@ -385,7 +375,7 @@ staran/
385
375
  │ ├── __init__.py # 工具模块
386
376
  │ └── date.py # Date类实现
387
377
  ├── setup.py # 安装配置
388
- ├── README.md # 本文档 v0.4.2
378
+ ├── README.md # 本文档 v0.6.0
389
379
  └── quick-upload.sh # 快速部署脚本
390
380
  ```
391
381
 
@@ -561,4 +551,4 @@ MIT License
561
551
 
562
552
  ---
563
553
 
564
- **Staran v0.4.2** - 模块化引擎架构,让机器学习特征工程变得前所未有的简单 🌟
554
+ **Staran v0.6.0** - 模块化引擎架构,让机器学习特征工程变得前所未有的简单 🌟
@@ -0,0 +1,38 @@
1
+ [build-system]
2
+ requires = ["setuptools>=45", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "staran"
7
+ version = "0.6.1"
8
+ description = "staran - 高性能Python工具库"
9
+ readme = "README.md"
10
+ authors = [{name = "StarAn", email = "starlxa@icloud.com"}]
11
+ license = {text = "MIT"}
12
+ classifiers = [
13
+ "Development Status :: 4 - Beta",
14
+ "Intended Audience :: Developers",
15
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
16
+ "Topic :: Software Development :: Libraries :: Python Modules",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.7",
19
+ "Programming Language :: Python :: 3.8",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Operating System :: OS Independent",
25
+ ]
26
+ keywords = ["machine-learning", "feature-engineering", "data-processing", "sql-generation"]
27
+ dependencies = []
28
+ requires-python = ">=3.7"
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/starlxa/staran"
32
+ "Bug Reports" = "https://github.com/starlxa/staran/issues"
33
+ Source = "https://github.com/starlxa/staran"
34
+
35
+ [tool.setuptools.packages.find]
36
+ where = ["."]
37
+ include = ["staran*"]
38
+ exclude = ["tests*"]
staran-0.6.1/setup.py ADDED
@@ -0,0 +1,38 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="staran",
5
+ version="0.6.1",
6
+ description="staran - 高性能Python工具库",
7
+ long_description=open("README.md", encoding="utf-8").read(),
8
+ long_description_content_type="text/markdown",
9
+ author="StarAn",
10
+ author_email="starlxa@icloud.com",
11
+ license="MIT",
12
+ url="https://github.com/starlxa/staran",
13
+ packages=find_packages(),
14
+ install_requires=[
15
+ # 添加实际需要的外部依赖
16
+ # datetime, calendar, re 都是标准库,无需列出
17
+ ],
18
+ classifiers=[
19
+ "Development Status :: 4 - Beta",
20
+ "Intended Audience :: Developers",
21
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
22
+ "Topic :: Software Development :: Libraries :: Python Modules",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.7",
25
+ "Programming Language :: Python :: 3.8",
26
+ "Programming Language :: Python :: 3.9",
27
+ "Programming Language :: Python :: 3.10",
28
+ "Programming Language :: Python :: 3.11",
29
+ "Programming Language :: Python :: 3.12",
30
+ "Operating System :: OS Independent",
31
+ ],
32
+ python_requires=">=3.7",
33
+ keywords="machine-learning feature-engineering data-processing sql-generation",
34
+ project_urls={
35
+ "Bug Reports": "https://github.com/starlxa/staran/issues",
36
+ "Source": "https://github.com/starlxa/staran",
37
+ },
38
+ )
File without changes
@@ -0,0 +1,30 @@
1
+ """
2
+ staran.banks - 银行配置模块
3
+
4
+ 该模块包含不同银行的特定配置,包括:
5
+ - 数据库连接配置
6
+ - 表结构定义
7
+ - 业务规则设置
8
+ - 模型配置
9
+
10
+ 支持的银行:
11
+ - xinjiang_icbc: 新疆工行配置
12
+
13
+ 版本: 0.6.0
14
+ """
15
+
16
+ from .xinjiang_icbc import (
17
+ XinjiangICBCConfig,
18
+ get_xinjiang_icbc_tables,
19
+ get_xinjiang_icbc_models,
20
+ xinjiang_icbc_config
21
+ )
22
+
23
+ __all__ = [
24
+ 'XinjiangICBCConfig',
25
+ 'xinjiang_icbc_config',
26
+ 'get_xinjiang_icbc_tables',
27
+ 'get_xinjiang_icbc_models'
28
+ ]
29
+
30
+ __version__ = "0.6.0"
@@ -0,0 +1,90 @@
1
+ """
2
+ 新疆工行银行配置模块
3
+
4
+ 专门针对新疆工行代发长尾客户的配置:
5
+ - 数据库表结构定义(代发长尾客户专用)
6
+ - 业务规则配置
7
+ - 模型配置(提升模型和防流失模型)
8
+
9
+ 数据库: xinjiang_icbc_daifa_longtail
10
+ 业务范围: 代发长尾客户
11
+ """
12
+
13
+ from dataclasses import dataclass
14
+ from typing import Dict, List, Optional
15
+ from datetime import datetime
16
+
17
+
18
+ @dataclass
19
+ class XinjiangICBCConfig:
20
+ """新疆工行配置类"""
21
+
22
+ # 数据库配置
23
+ database_name: str = "xinjiang_icbc_daifa_longtail"
24
+ schema_name: str = "daifa_longtail"
25
+
26
+ # 业务配置
27
+ business_domain: str = "代发长尾客户"
28
+ customer_segment: str = "代发长尾"
29
+
30
+ # 模型配置
31
+ available_models: List[str] = None
32
+
33
+ # 业务规则
34
+ longtail_asset_min: float = 10000 # 长尾客户最小资产
35
+ longtail_asset_max: float = 100000 # 长尾客户最大资产
36
+ upgrade_target: float = 3000 # 提升目标金额
37
+ churn_threshold: float = 1500 # 流失阈值金额
38
+
39
+ def __post_init__(self):
40
+ if self.available_models is None:
41
+ self.available_models = [
42
+ "daifa_longtail_upgrade_3k", # 代发长尾提升3k模型
43
+ "daifa_longtail_churn_1_5k" # 代发长尾防流失1.5k模型
44
+ ]
45
+
46
+
47
+ def get_xinjiang_icbc_tables() -> Dict[str, str]:
48
+ """获取新疆工行代发长尾客户表配置"""
49
+ return {
50
+ # 代发长尾客户行为表
51
+ "daifa_longtail_behavior": "xinjiang_icbc_daifa_hlwj_dfcw_f1_f4_wy",
52
+
53
+ # 代发长尾客户资产平均表
54
+ "daifa_longtail_asset_avg": "xinjiang_icbc_daifa_hlwj_zi_chan_avg_wy",
55
+
56
+ # 代发长尾客户资产配置表
57
+ "daifa_longtail_asset_config": "xinjiang_icbc_daifa_hlwj_zi_chan_config_wy",
58
+
59
+ # 代发长尾客户月度统计表
60
+ "daifa_longtail_monthly_stat": "xinjiang_icbc_daifa_hlwj_monthly_stat_wy"
61
+ }
62
+
63
+
64
+ def get_xinjiang_icbc_models() -> Dict[str, Dict]:
65
+ """获取新疆工行代发长尾客户模型配置"""
66
+ return {
67
+ "daifa_longtail_upgrade_3k": {
68
+ "name": "代发长尾客户提升3k预测模型",
69
+ "description": "预测下个月代发长尾客户资产提升3000元的概率",
70
+ "target": "upgrade_3k_next_month",
71
+ "model_type": "binary_classification",
72
+ "business_objective": "识别有潜力提升资产的代发长尾客户",
73
+ "target_threshold": 3000,
74
+ "prediction_window": "1_month"
75
+ },
76
+
77
+ "daifa_longtail_churn_1_5k": {
78
+ "name": "代发长尾客户防流失1.5k预测模型",
79
+ "description": "预测下个月代发长尾客户流失1500元资产的风险",
80
+ "target": "churn_1_5k_next_month",
81
+ "model_type": "binary_classification",
82
+ "business_objective": "识别有流失风险的代发长尾客户",
83
+ "target_threshold": 1500,
84
+ "prediction_window": "1_month"
85
+ }
86
+ }
87
+
88
+
89
+ # 创建默认配置实例
90
+ xinjiang_icbc_config = XinjiangICBCConfig()
@@ -0,0 +1,72 @@
1
+ """
2
+ staran.models v0.6.0 - 新疆工行代发长尾客户模型管理
3
+
4
+ 专门针对新疆工行代发长尾客户的两个核心模型:
5
+ 1. 代发长尾客户提升3k预测模型 (daifa_longtail_upgrade_3k)
6
+ 2. 代发长尾客户防流失1.5k预测模型 (daifa_longtail_churn_1_5k)
7
+
8
+ 主要功能:
9
+ - 模型配置管理
10
+ - SQL驱动的目标变量定义
11
+ - 模型注册和版本控制
12
+ - 新疆工行特定配置
13
+ """
14
+
15
+ from .config import ModelConfig, create_model_config
16
+ from .target import TargetDefinition, create_target_definition
17
+ from .registry import ModelRegistry, register_model, save_model_registry
18
+ from .daifa_models import (
19
+ create_daifa_longtail_upgrade_model,
20
+ create_daifa_longtail_churn_model,
21
+ get_available_daifa_models,
22
+ create_both_daifa_models
23
+ )
24
+
25
+ # 便捷函数
26
+ def create_xinjiang_icbc_models(output_dir: str = "./xinjiang_models") -> dict:
27
+ """为新疆工行创建两个代发长尾客户模型"""
28
+ return create_both_daifa_models(output_dir)
29
+
30
+ def list_available_models() -> list:
31
+ """列出所有可用的代发长尾客户模型"""
32
+ return get_available_daifa_models()
33
+
34
+ def get_model_summary() -> dict:
35
+ """获取模型概述信息"""
36
+ return {
37
+ "version": "0.6.0",
38
+ "bank": "新疆工行",
39
+ "business_domain": "代发长尾客户",
40
+ "models": [
41
+ {
42
+ "name": "daifa_longtail_upgrade_3k",
43
+ "description": "预测下个月代发长尾客户资产提升3k的概率",
44
+ "target_amount": 3000,
45
+ "model_type": "binary_classification"
46
+ },
47
+ {
48
+ "name": "daifa_longtail_churn_1_5k",
49
+ "description": "预测下个月代发长尾客户流失1.5k资产的风险",
50
+ "target_amount": 1500,
51
+ "model_type": "binary_classification"
52
+ }
53
+ ]
54
+ }
55
+
56
+ __all__ = [
57
+ # 核心组件
58
+ 'ModelConfig', 'TargetDefinition', 'ModelRegistry',
59
+
60
+ # 创建函数
61
+ 'create_model_config', 'create_target_definition', 'register_model',
62
+
63
+ # 代发长尾模型
64
+ 'create_daifa_longtail_upgrade_model', 'create_daifa_longtail_churn_model',
65
+ 'create_both_daifa_models', 'get_available_daifa_models',
66
+
67
+ # 便捷函数
68
+ 'create_xinjiang_icbc_models', 'list_available_models', 'get_model_summary',
69
+ 'save_model_registry'
70
+ ]
71
+
72
+ __version__ = "0.6.0"