ins-pricing 0.1.6__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.
- ins_pricing-0.1.6/Ins_Pricing.egg-info/PKG-INFO +78 -0
- ins_pricing-0.1.6/Ins_Pricing.egg-info/SOURCES.txt +178 -0
- ins_pricing-0.1.6/Ins_Pricing.egg-info/dependency_links.txt +1 -0
- ins_pricing-0.1.6/Ins_Pricing.egg-info/requires.txt +13 -0
- ins_pricing-0.1.6/Ins_Pricing.egg-info/top_level.txt +4 -0
- ins_pricing-0.1.6/MANIFEST.in +3 -0
- ins_pricing-0.1.6/PKG-INFO +78 -0
- ins_pricing-0.1.6/README.md +49 -0
- ins_pricing-0.1.6/ins_pricing/README.md +60 -0
- ins_pricing-0.1.6/ins_pricing/__init__.py +102 -0
- ins_pricing-0.1.6/ins_pricing/governance/README.md +18 -0
- ins_pricing-0.1.6/ins_pricing/governance/__init__.py +20 -0
- ins_pricing-0.1.6/ins_pricing/governance/approval.py +93 -0
- ins_pricing-0.1.6/ins_pricing/governance/audit.py +37 -0
- ins_pricing-0.1.6/ins_pricing/governance/registry.py +99 -0
- ins_pricing-0.1.6/ins_pricing/governance/release.py +159 -0
- ins_pricing-0.1.6/ins_pricing/modelling/BayesOpt.py +146 -0
- ins_pricing-0.1.6/ins_pricing/modelling/BayesOpt_USAGE.md +925 -0
- ins_pricing-0.1.6/ins_pricing/modelling/BayesOpt_entry.py +575 -0
- ins_pricing-0.1.6/ins_pricing/modelling/BayesOpt_incremental.py +731 -0
- ins_pricing-0.1.6/ins_pricing/modelling/Explain_Run.py +36 -0
- ins_pricing-0.1.6/ins_pricing/modelling/Explain_entry.py +539 -0
- ins_pricing-0.1.6/ins_pricing/modelling/Pricing_Run.py +36 -0
- ins_pricing-0.1.6/ins_pricing/modelling/README.md +33 -0
- ins_pricing-0.1.6/ins_pricing/modelling/__init__.py +44 -0
- ins_pricing-0.1.6/ins_pricing/modelling/bayesopt/__init__.py +98 -0
- ins_pricing-0.1.6/ins_pricing/modelling/bayesopt/config_preprocess.py +303 -0
- ins_pricing-0.1.6/ins_pricing/modelling/bayesopt/core.py +1476 -0
- ins_pricing-0.1.6/ins_pricing/modelling/bayesopt/models.py +2196 -0
- ins_pricing-0.1.6/ins_pricing/modelling/bayesopt/trainers.py +2446 -0
- ins_pricing-0.1.6/ins_pricing/modelling/bayesopt/utils.py +1021 -0
- ins_pricing-0.1.6/ins_pricing/modelling/cli_common.py +136 -0
- ins_pricing-0.1.6/ins_pricing/modelling/explain/__init__.py +55 -0
- ins_pricing-0.1.6/ins_pricing/modelling/explain/gradients.py +334 -0
- ins_pricing-0.1.6/ins_pricing/modelling/explain/metrics.py +176 -0
- ins_pricing-0.1.6/ins_pricing/modelling/explain/permutation.py +155 -0
- ins_pricing-0.1.6/ins_pricing/modelling/explain/shap_utils.py +146 -0
- ins_pricing-0.1.6/ins_pricing/modelling/notebook_utils.py +284 -0
- ins_pricing-0.1.6/ins_pricing/modelling/plotting/__init__.py +45 -0
- ins_pricing-0.1.6/ins_pricing/modelling/plotting/common.py +63 -0
- ins_pricing-0.1.6/ins_pricing/modelling/plotting/curves.py +572 -0
- ins_pricing-0.1.6/ins_pricing/modelling/plotting/diagnostics.py +139 -0
- ins_pricing-0.1.6/ins_pricing/modelling/plotting/geo.py +362 -0
- ins_pricing-0.1.6/ins_pricing/modelling/plotting/importance.py +121 -0
- ins_pricing-0.1.6/ins_pricing/modelling/run_logging.py +133 -0
- ins_pricing-0.1.6/ins_pricing/modelling/tests/conftest.py +8 -0
- ins_pricing-0.1.6/ins_pricing/modelling/tests/test_cross_val_generic.py +66 -0
- ins_pricing-0.1.6/ins_pricing/modelling/tests/test_distributed_utils.py +18 -0
- ins_pricing-0.1.6/ins_pricing/modelling/tests/test_explain.py +56 -0
- ins_pricing-0.1.6/ins_pricing/modelling/tests/test_geo_tokens_split.py +49 -0
- ins_pricing-0.1.6/ins_pricing/modelling/tests/test_graph_cache.py +33 -0
- ins_pricing-0.1.6/ins_pricing/modelling/tests/test_plotting.py +63 -0
- ins_pricing-0.1.6/ins_pricing/modelling/tests/test_plotting_library.py +150 -0
- ins_pricing-0.1.6/ins_pricing/modelling/tests/test_preprocessor.py +48 -0
- ins_pricing-0.1.6/ins_pricing/modelling/watchdog_run.py +211 -0
- ins_pricing-0.1.6/ins_pricing/pricing/README.md +44 -0
- ins_pricing-0.1.6/ins_pricing/pricing/__init__.py +27 -0
- ins_pricing-0.1.6/ins_pricing/pricing/calibration.py +39 -0
- ins_pricing-0.1.6/ins_pricing/pricing/data_quality.py +117 -0
- ins_pricing-0.1.6/ins_pricing/pricing/exposure.py +85 -0
- ins_pricing-0.1.6/ins_pricing/pricing/factors.py +91 -0
- ins_pricing-0.1.6/ins_pricing/pricing/monitoring.py +99 -0
- ins_pricing-0.1.6/ins_pricing/pricing/rate_table.py +78 -0
- ins_pricing-0.1.6/ins_pricing/production/__init__.py +21 -0
- ins_pricing-0.1.6/ins_pricing/production/drift.py +30 -0
- ins_pricing-0.1.6/ins_pricing/production/monitoring.py +143 -0
- ins_pricing-0.1.6/ins_pricing/production/scoring.py +40 -0
- ins_pricing-0.1.6/ins_pricing/reporting/README.md +20 -0
- ins_pricing-0.1.6/ins_pricing/reporting/__init__.py +11 -0
- ins_pricing-0.1.6/ins_pricing/reporting/report_builder.py +72 -0
- ins_pricing-0.1.6/ins_pricing/reporting/scheduler.py +45 -0
- ins_pricing-0.1.6/ins_pricing/setup.py +41 -0
- ins_pricing-0.1.6/ins_pricing v2/__init__.py +23 -0
- ins_pricing-0.1.6/ins_pricing v2/governance/__init__.py +20 -0
- ins_pricing-0.1.6/ins_pricing v2/governance/approval.py +93 -0
- ins_pricing-0.1.6/ins_pricing v2/governance/audit.py +37 -0
- ins_pricing-0.1.6/ins_pricing v2/governance/registry.py +99 -0
- ins_pricing-0.1.6/ins_pricing v2/governance/release.py +159 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/Explain_Run.py +36 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/Pricing_Run.py +36 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/__init__.py +151 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/cli_common.py +141 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/config.py +249 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/config_preprocess.py +254 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/core.py +741 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/data_container.py +42 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/explain/__init__.py +55 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/explain/gradients.py +334 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/explain/metrics.py +176 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/explain/permutation.py +155 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/explain/shap_utils.py +146 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/features.py +215 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/model_manager.py +148 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/model_plotting.py +463 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/models.py +2203 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/notebook_utils.py +294 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/plotting/__init__.py +45 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/plotting/common.py +63 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/plotting/curves.py +572 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/plotting/diagnostics.py +139 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/plotting/geo.py +362 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/plotting/importance.py +121 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/run_logging.py +133 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/tests/conftest.py +8 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/tests/test_cross_val_generic.py +66 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/tests/test_distributed_utils.py +18 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/tests/test_explain.py +56 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/tests/test_geo_tokens_split.py +49 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/tests/test_graph_cache.py +33 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/tests/test_plotting.py +63 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/tests/test_plotting_library.py +150 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/tests/test_preprocessor.py +48 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/trainers.py +2447 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/utils.py +1020 -0
- ins_pricing-0.1.6/ins_pricing v2/modelling/watchdog_run.py +211 -0
- ins_pricing-0.1.6/ins_pricing v2/pricing/__init__.py +27 -0
- ins_pricing-0.1.6/ins_pricing v2/pricing/calibration.py +39 -0
- ins_pricing-0.1.6/ins_pricing v2/pricing/data_quality.py +117 -0
- ins_pricing-0.1.6/ins_pricing v2/pricing/exposure.py +85 -0
- ins_pricing-0.1.6/ins_pricing v2/pricing/factors.py +91 -0
- ins_pricing-0.1.6/ins_pricing v2/pricing/monitoring.py +99 -0
- ins_pricing-0.1.6/ins_pricing v2/pricing/rate_table.py +78 -0
- ins_pricing-0.1.6/ins_pricing v2/production/__init__.py +21 -0
- ins_pricing-0.1.6/ins_pricing v2/production/drift.py +30 -0
- ins_pricing-0.1.6/ins_pricing v2/production/monitoring.py +143 -0
- ins_pricing-0.1.6/ins_pricing v2/production/scoring.py +40 -0
- ins_pricing-0.1.6/ins_pricing v2/reporting/__init__.py +11 -0
- ins_pricing-0.1.6/ins_pricing v2/reporting/report_builder.py +72 -0
- ins_pricing-0.1.6/ins_pricing v2/reporting/scheduler.py +45 -0
- ins_pricing-0.1.6/ins_pricing v2/scripts/BayesOpt_incremental.py +722 -0
- ins_pricing-0.1.6/ins_pricing v2/scripts/Explain_entry.py +545 -0
- ins_pricing-0.1.6/ins_pricing v2/scripts/__init__.py +1 -0
- ins_pricing-0.1.6/ins_pricing v2/scripts/train.py +568 -0
- ins_pricing-0.1.6/ins_pricing v2/setup.py +55 -0
- ins_pricing-0.1.6/ins_pricing v2/smoke_test.py +28 -0
- ins_pricing-0.1.6/pyproject.toml +50 -0
- ins_pricing-0.1.6/setup.cfg +4 -0
- ins_pricing-0.1.6/user_packages/__init__.py +105 -0
- ins_pricing-0.1.6/user_packages legacy/BayesOpt.py +5659 -0
- ins_pricing-0.1.6/user_packages legacy/BayesOpt_entry.py +513 -0
- ins_pricing-0.1.6/user_packages legacy/BayesOpt_incremental.py +685 -0
- ins_pricing-0.1.6/user_packages legacy/Pricing_Run.py +36 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOpt Legacy251213.py +3719 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOpt Legacy251215.py +3758 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOpt lagecy251201.py +3506 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOpt lagecy251218.py +3992 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOpt legacy.py +3280 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOpt.py +838 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptAll.py +1569 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptAllPlatform.py +909 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptCPUGPU.py +1877 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptSearch.py +830 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptSearchOrigin.py +829 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptV1.py +1911 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptV10.py +2973 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptV11.py +3001 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptV12.py +3001 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptV2.py +2065 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptV3.py +2209 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptV4.py +2342 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptV5.py +2372 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptV6.py +2759 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptV7.py +2832 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptV8Codex.py +2731 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptV8Gemini.py +2614 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOptV9.py +2927 -0
- ins_pricing-0.1.6/user_packages legacy/Try/BayesOpt_entry legacy.py +313 -0
- ins_pricing-0.1.6/user_packages legacy/Try/ModelBayesOptSearch.py +359 -0
- ins_pricing-0.1.6/user_packages legacy/Try/ResNetBayesOptSearch.py +249 -0
- ins_pricing-0.1.6/user_packages legacy/Try/XgbBayesOptSearch.py +121 -0
- ins_pricing-0.1.6/user_packages legacy/Try/xgbbayesopt.py +523 -0
- ins_pricing-0.1.6/user_packages legacy/__init__.py +19 -0
- ins_pricing-0.1.6/user_packages legacy/cli_common.py +124 -0
- ins_pricing-0.1.6/user_packages legacy/notebook_utils.py +228 -0
- ins_pricing-0.1.6/user_packages legacy/watchdog_run.py +202 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ins_pricing
|
|
3
|
+
Version: 0.1.6
|
|
4
|
+
Summary: Reusable modelling, pricing, governance, and reporting utilities.
|
|
5
|
+
Author: meishi125478
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Keywords: pricing,insurance,bayesopt,ml
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: License :: Other/Proprietary License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: numpy>=1.20
|
|
17
|
+
Requires-Dist: pandas>=1.4
|
|
18
|
+
Requires-Dist: torch>=1.13
|
|
19
|
+
Requires-Dist: optuna>=3.0
|
|
20
|
+
Requires-Dist: xgboost>=1.6
|
|
21
|
+
Requires-Dist: scikit-learn>=1.1
|
|
22
|
+
Requires-Dist: statsmodels>=0.13
|
|
23
|
+
Requires-Dist: joblib>=1.2
|
|
24
|
+
Requires-Dist: matplotlib>=3.5
|
|
25
|
+
Requires-Dist: shap>=0.41
|
|
26
|
+
Requires-Dist: contextily>=1.3
|
|
27
|
+
Requires-Dist: pynndescent>=0.5
|
|
28
|
+
Requires-Dist: torch-geometric>=2.3
|
|
29
|
+
|
|
30
|
+
# Ins-Pricing Overview
|
|
31
|
+
|
|
32
|
+
This repository contains risk modeling and optimization notebooks, scripts, and a reusable training framework. The main module is `ins_pricing/modelling/bayesopt`.
|
|
33
|
+
|
|
34
|
+
## Top-level structure
|
|
35
|
+
|
|
36
|
+
- `Auto Info/`: vehicle info crawling, preprocessing, and embedding experiments
|
|
37
|
+
- `GLM and LGB/`: GLM/LightGBM modeling experiments
|
|
38
|
+
- `OpenAI/`: OpenAI notebook prototypes
|
|
39
|
+
- `Python Code/`: runnable scripts and utilities
|
|
40
|
+
- `others/`: temporary or miscellaneous notebooks
|
|
41
|
+
- `ins_pricing/`: reusable training framework and CLI tools (BayesOpt subpackage)
|
|
42
|
+
- `user_packages legacy/`: historical snapshot
|
|
43
|
+
|
|
44
|
+
Note: `ins_pricing/modelling/demo/` is kept in the repo only and is not shipped in the PyPI package.
|
|
45
|
+
|
|
46
|
+
## Quickstart
|
|
47
|
+
|
|
48
|
+
Run the following commands from the repo root:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python -m venv .venv
|
|
52
|
+
source .venv/bin/activate # Windows: .\\.venv\\Scripts\\activate
|
|
53
|
+
pip install pandas scikit-learn lightgbm seaborn matplotlib
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Start notebooks:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
jupyter lab
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## BayesOpt entry points
|
|
63
|
+
|
|
64
|
+
- CLI batch training: `python ins_pricing/modelling/BayesOpt_entry.py --config-json <path>`
|
|
65
|
+
- Incremental training: `python ins_pricing/modelling/BayesOpt_incremental.py --config-json <path>`
|
|
66
|
+
- Python API: `from ins_pricing.modelling import BayesOptModel`
|
|
67
|
+
|
|
68
|
+
## Tests
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pytest -q
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Data and outputs
|
|
75
|
+
|
|
76
|
+
- Put shared data under `data/` (create it if needed).
|
|
77
|
+
- Training outputs are written to `plot/`, `Results/`, and `model/` by default.
|
|
78
|
+
- Keep secrets and large files outside the repo and use environment variables or `.env`.
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
MANIFEST.in
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
Ins_Pricing.egg-info/PKG-INFO
|
|
5
|
+
Ins_Pricing.egg-info/SOURCES.txt
|
|
6
|
+
Ins_Pricing.egg-info/dependency_links.txt
|
|
7
|
+
Ins_Pricing.egg-info/requires.txt
|
|
8
|
+
Ins_Pricing.egg-info/top_level.txt
|
|
9
|
+
ins_pricing/README.md
|
|
10
|
+
ins_pricing/__init__.py
|
|
11
|
+
ins_pricing/setup.py
|
|
12
|
+
ins_pricing v2/__init__.py
|
|
13
|
+
ins_pricing v2/setup.py
|
|
14
|
+
ins_pricing v2/smoke_test.py
|
|
15
|
+
ins_pricing v2/governance/__init__.py
|
|
16
|
+
ins_pricing v2/governance/approval.py
|
|
17
|
+
ins_pricing v2/governance/audit.py
|
|
18
|
+
ins_pricing v2/governance/registry.py
|
|
19
|
+
ins_pricing v2/governance/release.py
|
|
20
|
+
ins_pricing v2/modelling/Explain_Run.py
|
|
21
|
+
ins_pricing v2/modelling/Pricing_Run.py
|
|
22
|
+
ins_pricing v2/modelling/__init__.py
|
|
23
|
+
ins_pricing v2/modelling/cli_common.py
|
|
24
|
+
ins_pricing v2/modelling/config.py
|
|
25
|
+
ins_pricing v2/modelling/config_preprocess.py
|
|
26
|
+
ins_pricing v2/modelling/core.py
|
|
27
|
+
ins_pricing v2/modelling/data_container.py
|
|
28
|
+
ins_pricing v2/modelling/features.py
|
|
29
|
+
ins_pricing v2/modelling/model_manager.py
|
|
30
|
+
ins_pricing v2/modelling/model_plotting.py
|
|
31
|
+
ins_pricing v2/modelling/models.py
|
|
32
|
+
ins_pricing v2/modelling/notebook_utils.py
|
|
33
|
+
ins_pricing v2/modelling/run_logging.py
|
|
34
|
+
ins_pricing v2/modelling/trainers.py
|
|
35
|
+
ins_pricing v2/modelling/utils.py
|
|
36
|
+
ins_pricing v2/modelling/watchdog_run.py
|
|
37
|
+
ins_pricing v2/modelling/explain/__init__.py
|
|
38
|
+
ins_pricing v2/modelling/explain/gradients.py
|
|
39
|
+
ins_pricing v2/modelling/explain/metrics.py
|
|
40
|
+
ins_pricing v2/modelling/explain/permutation.py
|
|
41
|
+
ins_pricing v2/modelling/explain/shap_utils.py
|
|
42
|
+
ins_pricing v2/modelling/plotting/__init__.py
|
|
43
|
+
ins_pricing v2/modelling/plotting/common.py
|
|
44
|
+
ins_pricing v2/modelling/plotting/curves.py
|
|
45
|
+
ins_pricing v2/modelling/plotting/diagnostics.py
|
|
46
|
+
ins_pricing v2/modelling/plotting/geo.py
|
|
47
|
+
ins_pricing v2/modelling/plotting/importance.py
|
|
48
|
+
ins_pricing v2/modelling/tests/conftest.py
|
|
49
|
+
ins_pricing v2/modelling/tests/test_cross_val_generic.py
|
|
50
|
+
ins_pricing v2/modelling/tests/test_distributed_utils.py
|
|
51
|
+
ins_pricing v2/modelling/tests/test_explain.py
|
|
52
|
+
ins_pricing v2/modelling/tests/test_geo_tokens_split.py
|
|
53
|
+
ins_pricing v2/modelling/tests/test_graph_cache.py
|
|
54
|
+
ins_pricing v2/modelling/tests/test_plotting.py
|
|
55
|
+
ins_pricing v2/modelling/tests/test_plotting_library.py
|
|
56
|
+
ins_pricing v2/modelling/tests/test_preprocessor.py
|
|
57
|
+
ins_pricing v2/pricing/__init__.py
|
|
58
|
+
ins_pricing v2/pricing/calibration.py
|
|
59
|
+
ins_pricing v2/pricing/data_quality.py
|
|
60
|
+
ins_pricing v2/pricing/exposure.py
|
|
61
|
+
ins_pricing v2/pricing/factors.py
|
|
62
|
+
ins_pricing v2/pricing/monitoring.py
|
|
63
|
+
ins_pricing v2/pricing/rate_table.py
|
|
64
|
+
ins_pricing v2/production/__init__.py
|
|
65
|
+
ins_pricing v2/production/drift.py
|
|
66
|
+
ins_pricing v2/production/monitoring.py
|
|
67
|
+
ins_pricing v2/production/scoring.py
|
|
68
|
+
ins_pricing v2/reporting/__init__.py
|
|
69
|
+
ins_pricing v2/reporting/report_builder.py
|
|
70
|
+
ins_pricing v2/reporting/scheduler.py
|
|
71
|
+
ins_pricing v2/scripts/BayesOpt_incremental.py
|
|
72
|
+
ins_pricing v2/scripts/Explain_entry.py
|
|
73
|
+
ins_pricing v2/scripts/__init__.py
|
|
74
|
+
ins_pricing v2/scripts/train.py
|
|
75
|
+
ins_pricing.egg-info/PKG-INFO
|
|
76
|
+
ins_pricing.egg-info/SOURCES.txt
|
|
77
|
+
ins_pricing.egg-info/dependency_links.txt
|
|
78
|
+
ins_pricing.egg-info/requires.txt
|
|
79
|
+
ins_pricing.egg-info/top_level.txt
|
|
80
|
+
ins_pricing/governance/README.md
|
|
81
|
+
ins_pricing/governance/__init__.py
|
|
82
|
+
ins_pricing/governance/approval.py
|
|
83
|
+
ins_pricing/governance/audit.py
|
|
84
|
+
ins_pricing/governance/registry.py
|
|
85
|
+
ins_pricing/governance/release.py
|
|
86
|
+
ins_pricing/modelling/BayesOpt.py
|
|
87
|
+
ins_pricing/modelling/BayesOpt_USAGE.md
|
|
88
|
+
ins_pricing/modelling/BayesOpt_entry.py
|
|
89
|
+
ins_pricing/modelling/BayesOpt_incremental.py
|
|
90
|
+
ins_pricing/modelling/Explain_Run.py
|
|
91
|
+
ins_pricing/modelling/Explain_entry.py
|
|
92
|
+
ins_pricing/modelling/Pricing_Run.py
|
|
93
|
+
ins_pricing/modelling/README.md
|
|
94
|
+
ins_pricing/modelling/__init__.py
|
|
95
|
+
ins_pricing/modelling/cli_common.py
|
|
96
|
+
ins_pricing/modelling/notebook_utils.py
|
|
97
|
+
ins_pricing/modelling/run_logging.py
|
|
98
|
+
ins_pricing/modelling/watchdog_run.py
|
|
99
|
+
ins_pricing/modelling/bayesopt/__init__.py
|
|
100
|
+
ins_pricing/modelling/bayesopt/config_preprocess.py
|
|
101
|
+
ins_pricing/modelling/bayesopt/core.py
|
|
102
|
+
ins_pricing/modelling/bayesopt/models.py
|
|
103
|
+
ins_pricing/modelling/bayesopt/trainers.py
|
|
104
|
+
ins_pricing/modelling/bayesopt/utils.py
|
|
105
|
+
ins_pricing/modelling/explain/__init__.py
|
|
106
|
+
ins_pricing/modelling/explain/gradients.py
|
|
107
|
+
ins_pricing/modelling/explain/metrics.py
|
|
108
|
+
ins_pricing/modelling/explain/permutation.py
|
|
109
|
+
ins_pricing/modelling/explain/shap_utils.py
|
|
110
|
+
ins_pricing/modelling/plotting/__init__.py
|
|
111
|
+
ins_pricing/modelling/plotting/common.py
|
|
112
|
+
ins_pricing/modelling/plotting/curves.py
|
|
113
|
+
ins_pricing/modelling/plotting/diagnostics.py
|
|
114
|
+
ins_pricing/modelling/plotting/geo.py
|
|
115
|
+
ins_pricing/modelling/plotting/importance.py
|
|
116
|
+
ins_pricing/modelling/tests/conftest.py
|
|
117
|
+
ins_pricing/modelling/tests/test_cross_val_generic.py
|
|
118
|
+
ins_pricing/modelling/tests/test_distributed_utils.py
|
|
119
|
+
ins_pricing/modelling/tests/test_explain.py
|
|
120
|
+
ins_pricing/modelling/tests/test_geo_tokens_split.py
|
|
121
|
+
ins_pricing/modelling/tests/test_graph_cache.py
|
|
122
|
+
ins_pricing/modelling/tests/test_plotting.py
|
|
123
|
+
ins_pricing/modelling/tests/test_plotting_library.py
|
|
124
|
+
ins_pricing/modelling/tests/test_preprocessor.py
|
|
125
|
+
ins_pricing/pricing/README.md
|
|
126
|
+
ins_pricing/pricing/__init__.py
|
|
127
|
+
ins_pricing/pricing/calibration.py
|
|
128
|
+
ins_pricing/pricing/data_quality.py
|
|
129
|
+
ins_pricing/pricing/exposure.py
|
|
130
|
+
ins_pricing/pricing/factors.py
|
|
131
|
+
ins_pricing/pricing/monitoring.py
|
|
132
|
+
ins_pricing/pricing/rate_table.py
|
|
133
|
+
ins_pricing/production/__init__.py
|
|
134
|
+
ins_pricing/production/drift.py
|
|
135
|
+
ins_pricing/production/monitoring.py
|
|
136
|
+
ins_pricing/production/scoring.py
|
|
137
|
+
ins_pricing/reporting/README.md
|
|
138
|
+
ins_pricing/reporting/__init__.py
|
|
139
|
+
ins_pricing/reporting/report_builder.py
|
|
140
|
+
ins_pricing/reporting/scheduler.py
|
|
141
|
+
user_packages/__init__.py
|
|
142
|
+
user_packages legacy/BayesOpt.py
|
|
143
|
+
user_packages legacy/BayesOpt_entry.py
|
|
144
|
+
user_packages legacy/BayesOpt_incremental.py
|
|
145
|
+
user_packages legacy/Pricing_Run.py
|
|
146
|
+
user_packages legacy/__init__.py
|
|
147
|
+
user_packages legacy/cli_common.py
|
|
148
|
+
user_packages legacy/notebook_utils.py
|
|
149
|
+
user_packages legacy/watchdog_run.py
|
|
150
|
+
user_packages legacy/Try/BayesOpt Legacy251213.py
|
|
151
|
+
user_packages legacy/Try/BayesOpt Legacy251215.py
|
|
152
|
+
user_packages legacy/Try/BayesOpt lagecy251201.py
|
|
153
|
+
user_packages legacy/Try/BayesOpt lagecy251218.py
|
|
154
|
+
user_packages legacy/Try/BayesOpt legacy.py
|
|
155
|
+
user_packages legacy/Try/BayesOpt.py
|
|
156
|
+
user_packages legacy/Try/BayesOptAll.py
|
|
157
|
+
user_packages legacy/Try/BayesOptAllPlatform.py
|
|
158
|
+
user_packages legacy/Try/BayesOptCPUGPU.py
|
|
159
|
+
user_packages legacy/Try/BayesOptSearch.py
|
|
160
|
+
user_packages legacy/Try/BayesOptSearchOrigin.py
|
|
161
|
+
user_packages legacy/Try/BayesOptV1.py
|
|
162
|
+
user_packages legacy/Try/BayesOptV10.py
|
|
163
|
+
user_packages legacy/Try/BayesOptV11.py
|
|
164
|
+
user_packages legacy/Try/BayesOptV12.py
|
|
165
|
+
user_packages legacy/Try/BayesOptV2.py
|
|
166
|
+
user_packages legacy/Try/BayesOptV3.py
|
|
167
|
+
user_packages legacy/Try/BayesOptV4.py
|
|
168
|
+
user_packages legacy/Try/BayesOptV5.py
|
|
169
|
+
user_packages legacy/Try/BayesOptV6.py
|
|
170
|
+
user_packages legacy/Try/BayesOptV7.py
|
|
171
|
+
user_packages legacy/Try/BayesOptV8Codex.py
|
|
172
|
+
user_packages legacy/Try/BayesOptV8Gemini.py
|
|
173
|
+
user_packages legacy/Try/BayesOptV9.py
|
|
174
|
+
user_packages legacy/Try/BayesOpt_entry legacy.py
|
|
175
|
+
user_packages legacy/Try/ModelBayesOptSearch.py
|
|
176
|
+
user_packages legacy/Try/ResNetBayesOptSearch.py
|
|
177
|
+
user_packages legacy/Try/XgbBayesOptSearch.py
|
|
178
|
+
user_packages legacy/Try/xgbbayesopt.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ins_pricing
|
|
3
|
+
Version: 0.1.6
|
|
4
|
+
Summary: Reusable modelling, pricing, governance, and reporting utilities.
|
|
5
|
+
Author: meishi125478
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Keywords: pricing,insurance,bayesopt,ml
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: License :: Other/Proprietary License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: numpy>=1.20
|
|
17
|
+
Requires-Dist: pandas>=1.4
|
|
18
|
+
Requires-Dist: torch>=1.13
|
|
19
|
+
Requires-Dist: optuna>=3.0
|
|
20
|
+
Requires-Dist: xgboost>=1.6
|
|
21
|
+
Requires-Dist: scikit-learn>=1.1
|
|
22
|
+
Requires-Dist: statsmodels>=0.13
|
|
23
|
+
Requires-Dist: joblib>=1.2
|
|
24
|
+
Requires-Dist: matplotlib>=3.5
|
|
25
|
+
Requires-Dist: shap>=0.41
|
|
26
|
+
Requires-Dist: contextily>=1.3
|
|
27
|
+
Requires-Dist: pynndescent>=0.5
|
|
28
|
+
Requires-Dist: torch-geometric>=2.3
|
|
29
|
+
|
|
30
|
+
# Ins-Pricing Overview
|
|
31
|
+
|
|
32
|
+
This repository contains risk modeling and optimization notebooks, scripts, and a reusable training framework. The main module is `ins_pricing/modelling/bayesopt`.
|
|
33
|
+
|
|
34
|
+
## Top-level structure
|
|
35
|
+
|
|
36
|
+
- `Auto Info/`: vehicle info crawling, preprocessing, and embedding experiments
|
|
37
|
+
- `GLM and LGB/`: GLM/LightGBM modeling experiments
|
|
38
|
+
- `OpenAI/`: OpenAI notebook prototypes
|
|
39
|
+
- `Python Code/`: runnable scripts and utilities
|
|
40
|
+
- `others/`: temporary or miscellaneous notebooks
|
|
41
|
+
- `ins_pricing/`: reusable training framework and CLI tools (BayesOpt subpackage)
|
|
42
|
+
- `user_packages legacy/`: historical snapshot
|
|
43
|
+
|
|
44
|
+
Note: `ins_pricing/modelling/demo/` is kept in the repo only and is not shipped in the PyPI package.
|
|
45
|
+
|
|
46
|
+
## Quickstart
|
|
47
|
+
|
|
48
|
+
Run the following commands from the repo root:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python -m venv .venv
|
|
52
|
+
source .venv/bin/activate # Windows: .\\.venv\\Scripts\\activate
|
|
53
|
+
pip install pandas scikit-learn lightgbm seaborn matplotlib
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Start notebooks:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
jupyter lab
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## BayesOpt entry points
|
|
63
|
+
|
|
64
|
+
- CLI batch training: `python ins_pricing/modelling/BayesOpt_entry.py --config-json <path>`
|
|
65
|
+
- Incremental training: `python ins_pricing/modelling/BayesOpt_incremental.py --config-json <path>`
|
|
66
|
+
- Python API: `from ins_pricing.modelling import BayesOptModel`
|
|
67
|
+
|
|
68
|
+
## Tests
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pytest -q
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Data and outputs
|
|
75
|
+
|
|
76
|
+
- Put shared data under `data/` (create it if needed).
|
|
77
|
+
- Training outputs are written to `plot/`, `Results/`, and `model/` by default.
|
|
78
|
+
- Keep secrets and large files outside the repo and use environment variables or `.env`.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Ins-Pricing Overview
|
|
2
|
+
|
|
3
|
+
This repository contains risk modeling and optimization notebooks, scripts, and a reusable training framework. The main module is `ins_pricing/modelling/bayesopt`.
|
|
4
|
+
|
|
5
|
+
## Top-level structure
|
|
6
|
+
|
|
7
|
+
- `Auto Info/`: vehicle info crawling, preprocessing, and embedding experiments
|
|
8
|
+
- `GLM and LGB/`: GLM/LightGBM modeling experiments
|
|
9
|
+
- `OpenAI/`: OpenAI notebook prototypes
|
|
10
|
+
- `Python Code/`: runnable scripts and utilities
|
|
11
|
+
- `others/`: temporary or miscellaneous notebooks
|
|
12
|
+
- `ins_pricing/`: reusable training framework and CLI tools (BayesOpt subpackage)
|
|
13
|
+
- `user_packages legacy/`: historical snapshot
|
|
14
|
+
|
|
15
|
+
Note: `ins_pricing/modelling/demo/` is kept in the repo only and is not shipped in the PyPI package.
|
|
16
|
+
|
|
17
|
+
## Quickstart
|
|
18
|
+
|
|
19
|
+
Run the following commands from the repo root:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
python -m venv .venv
|
|
23
|
+
source .venv/bin/activate # Windows: .\\.venv\\Scripts\\activate
|
|
24
|
+
pip install pandas scikit-learn lightgbm seaborn matplotlib
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Start notebooks:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
jupyter lab
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## BayesOpt entry points
|
|
34
|
+
|
|
35
|
+
- CLI batch training: `python ins_pricing/modelling/BayesOpt_entry.py --config-json <path>`
|
|
36
|
+
- Incremental training: `python ins_pricing/modelling/BayesOpt_incremental.py --config-json <path>`
|
|
37
|
+
- Python API: `from ins_pricing.modelling import BayesOptModel`
|
|
38
|
+
|
|
39
|
+
## Tests
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pytest -q
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Data and outputs
|
|
46
|
+
|
|
47
|
+
- Put shared data under `data/` (create it if needed).
|
|
48
|
+
- Training outputs are written to `plot/`, `Results/`, and `model/` by default.
|
|
49
|
+
- Keep secrets and large files outside the repo and use environment variables or `.env`.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Ins-Pricing
|
|
2
|
+
|
|
3
|
+
Distribution name: Ins-Pricing (import package is `ins_pricing`, legacy alias `user_packages` still works).
|
|
4
|
+
|
|
5
|
+
Reusable modelling and pricing utilities organized as a small toolbox with clear boundaries
|
|
6
|
+
between modelling, production, governance, and reporting.
|
|
7
|
+
|
|
8
|
+
## Architecture
|
|
9
|
+
|
|
10
|
+
- `modelling/`
|
|
11
|
+
- `bayesopt/`: BayesOpt training core (GLM / XGB / ResNet / FT / GNN).
|
|
12
|
+
- `plotting/`: model-agnostic curves and geo visualizations.
|
|
13
|
+
- `explain/`: permutation, gradients, and SHAP helpers.
|
|
14
|
+
- `BayesOpt_entry.py`: CLI runner for batch training.
|
|
15
|
+
- `BayesOpt_incremental.py`: CLI for incremental runs.
|
|
16
|
+
- `Pricing_Run.py`: lightweight pricing orchestration.
|
|
17
|
+
- `pricing/`: factor tables, calibration, exposure, monitoring.
|
|
18
|
+
- `production/`: scoring, metrics, drift/PSI.
|
|
19
|
+
- `governance/`: registry, release, audit, approval workflow.
|
|
20
|
+
- `reporting/`: report builder + scheduler.
|
|
21
|
+
|
|
22
|
+
## Call flow (typical)
|
|
23
|
+
|
|
24
|
+
1. Model training
|
|
25
|
+
- Python API: `from ins_pricing.modelling import BayesOptModel`
|
|
26
|
+
- CLI: `python ins_pricing/modelling/BayesOpt_entry.py --config-json ...`
|
|
27
|
+
2. Evaluation & visualization
|
|
28
|
+
- Curves: `from ins_pricing.plotting import curves`
|
|
29
|
+
- Importance: `from ins_pricing.plotting import importance`
|
|
30
|
+
- Geo: `from ins_pricing.plotting import geo`
|
|
31
|
+
3. Explainability
|
|
32
|
+
- `from ins_pricing.explain import permutation_importance, integrated_gradients_torch`
|
|
33
|
+
4. Pricing loop
|
|
34
|
+
- `from ins_pricing.pricing import build_factor_table, rate_premium`
|
|
35
|
+
5. Production & governance
|
|
36
|
+
- `from ins_pricing.production import batch_score, psi_report`
|
|
37
|
+
- `from ins_pricing.governance import ModelRegistry, ReleaseManager`
|
|
38
|
+
6. Reporting
|
|
39
|
+
- `from ins_pricing.reporting import build_report, write_report, schedule_daily`
|
|
40
|
+
|
|
41
|
+
## Import notes
|
|
42
|
+
|
|
43
|
+
- `ins_pricing` exposes lightweight lazy imports so that `pricing/production/governance`
|
|
44
|
+
can be used without installing heavy ML dependencies.
|
|
45
|
+
- Demo notebooks/configs live in the repo under `ins_pricing/modelling/demo/` and are not shipped in the PyPI package.
|
|
46
|
+
- Heavy dependencies are only required when you import or use the related modules:
|
|
47
|
+
- BayesOpt: `torch`, `optuna`, `xgboost`, etc.
|
|
48
|
+
- Explain: `torch` (gradients), `shap` (SHAP).
|
|
49
|
+
- Geo plotting on basemap: `contextily`.
|
|
50
|
+
- Plotting: `matplotlib`.
|
|
51
|
+
|
|
52
|
+
## Backward-compatible imports
|
|
53
|
+
|
|
54
|
+
Legacy import paths continue to work:
|
|
55
|
+
|
|
56
|
+
- `import user_packages`
|
|
57
|
+
- `import user_packages.bayesopt`
|
|
58
|
+
- `import user_packages.plotting`
|
|
59
|
+
- `import user_packages.explain`
|
|
60
|
+
- `import user_packages.BayesOpt`
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from importlib import import_module
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
import sys
|
|
6
|
+
import types
|
|
7
|
+
|
|
8
|
+
_ROOT_SUBPACKAGES = {
|
|
9
|
+
"modelling": "ins_pricing.modelling",
|
|
10
|
+
"pricing": "ins_pricing.pricing",
|
|
11
|
+
"production": "ins_pricing.production",
|
|
12
|
+
"governance": "ins_pricing.governance",
|
|
13
|
+
"reporting": "ins_pricing.reporting",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
_MODELLING_EXPORTS = {
|
|
17
|
+
"BayesOptConfig",
|
|
18
|
+
"BayesOptModel",
|
|
19
|
+
"IOUtils",
|
|
20
|
+
"TrainingUtils",
|
|
21
|
+
"free_cuda",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_LAZY_SUBMODULES = {
|
|
25
|
+
"bayesopt": "ins_pricing.modelling.bayesopt",
|
|
26
|
+
"plotting": "ins_pricing.modelling.plotting",
|
|
27
|
+
"explain": "ins_pricing.modelling.explain",
|
|
28
|
+
"BayesOpt": "ins_pricing.modelling.BayesOpt",
|
|
29
|
+
"BayesOpt_entry": "ins_pricing.modelling.BayesOpt_entry",
|
|
30
|
+
"BayesOpt_incremental": "ins_pricing.modelling.BayesOpt_incremental",
|
|
31
|
+
"Explain_entry": "ins_pricing.modelling.Explain_entry",
|
|
32
|
+
"Explain_Run": "ins_pricing.modelling.Explain_Run",
|
|
33
|
+
"Pricing_Run": "ins_pricing.modelling.Pricing_Run",
|
|
34
|
+
"cli_common": "ins_pricing.modelling.cli_common",
|
|
35
|
+
"notebook_utils": "ins_pricing.modelling.notebook_utils",
|
|
36
|
+
"watchdog_run": "ins_pricing.modelling.watchdog_run",
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_PACKAGE_PATHS = {
|
|
40
|
+
"bayesopt": Path(__file__).resolve().parent / "modelling" / "bayesopt",
|
|
41
|
+
"plotting": Path(__file__).resolve().parent / "modelling" / "plotting",
|
|
42
|
+
"explain": Path(__file__).resolve().parent / "modelling" / "explain",
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
__all__ = sorted(
|
|
46
|
+
set(_ROOT_SUBPACKAGES)
|
|
47
|
+
| set(_MODELLING_EXPORTS)
|
|
48
|
+
| set(_LAZY_SUBMODULES)
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _lazy_module(name: str, target: str, package_path: Path | None = None) -> types.ModuleType:
|
|
53
|
+
proxy = types.ModuleType(name)
|
|
54
|
+
if package_path is not None:
|
|
55
|
+
proxy.__path__ = [str(package_path)]
|
|
56
|
+
|
|
57
|
+
def _load():
|
|
58
|
+
module = import_module(target)
|
|
59
|
+
sys.modules[name] = module
|
|
60
|
+
return module
|
|
61
|
+
|
|
62
|
+
def __getattr__(attr: str):
|
|
63
|
+
module = _load()
|
|
64
|
+
return getattr(module, attr)
|
|
65
|
+
|
|
66
|
+
def __dir__() -> list[str]:
|
|
67
|
+
module = _load()
|
|
68
|
+
return sorted(set(dir(module)))
|
|
69
|
+
|
|
70
|
+
proxy.__getattr__ = __getattr__ # type: ignore[attr-defined]
|
|
71
|
+
proxy.__dir__ = __dir__ # type: ignore[attr-defined]
|
|
72
|
+
return proxy
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _install_proxy(alias: str, target: str) -> None:
|
|
76
|
+
module_name = f"{__name__}.{alias}"
|
|
77
|
+
if module_name in sys.modules:
|
|
78
|
+
return
|
|
79
|
+
proxy = _lazy_module(module_name, target, _PACKAGE_PATHS.get(alias))
|
|
80
|
+
sys.modules[module_name] = proxy
|
|
81
|
+
globals()[alias] = proxy
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
for _alias, _target in _LAZY_SUBMODULES.items():
|
|
85
|
+
_install_proxy(_alias, _target)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def __getattr__(name: str):
|
|
89
|
+
if name in _ROOT_SUBPACKAGES:
|
|
90
|
+
module = import_module(_ROOT_SUBPACKAGES[name])
|
|
91
|
+
globals()[name] = module
|
|
92
|
+
return module
|
|
93
|
+
if name in _MODELLING_EXPORTS:
|
|
94
|
+
module = import_module("ins_pricing.modelling")
|
|
95
|
+
value = getattr(module, name)
|
|
96
|
+
globals()[name] = value
|
|
97
|
+
return value
|
|
98
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def __dir__() -> list[str]:
|
|
102
|
+
return sorted(set(__all__) | set(globals().keys()))
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# governance
|
|
2
|
+
|
|
3
|
+
Lightweight model registry, approval, audit log, and release management.
|
|
4
|
+
|
|
5
|
+
Example (deploy + rollback):
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from ins_pricing.governance import ModelRegistry, ReleaseManager
|
|
9
|
+
|
|
10
|
+
registry = ModelRegistry("Registry/models.json")
|
|
11
|
+
release = ReleaseManager("Registry/deployments", registry=registry)
|
|
12
|
+
|
|
13
|
+
registry.register("pricing_ft", "v1", metrics={"rmse": 0.12})
|
|
14
|
+
release.deploy("prod", "pricing_ft", "v1", actor="ops")
|
|
15
|
+
|
|
16
|
+
# rollback to previous active version
|
|
17
|
+
release.rollback("prod", actor="ops")
|
|
18
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from .approval import ApprovalAction, ApprovalRequest, ApprovalStore
|
|
4
|
+
from .audit import AuditEvent, AuditLogger
|
|
5
|
+
from .registry import ModelArtifact, ModelRegistry, ModelVersion
|
|
6
|
+
from .release import DeploymentState, ModelRef, ReleaseManager
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"ApprovalAction",
|
|
10
|
+
"ApprovalRequest",
|
|
11
|
+
"ApprovalStore",
|
|
12
|
+
"AuditEvent",
|
|
13
|
+
"AuditLogger",
|
|
14
|
+
"ModelArtifact",
|
|
15
|
+
"ModelRegistry",
|
|
16
|
+
"ModelVersion",
|
|
17
|
+
"DeploymentState",
|
|
18
|
+
"ModelRef",
|
|
19
|
+
"ReleaseManager",
|
|
20
|
+
]
|