MARS
MARS 接受 Pandas 或 Polars 宽表,提供数据画像、分箱评估、特征筛选、建模、监控、结构化 report、 Excel/HTML 导出和评分卡能力。
安装
MARS 0.0.26 支持 Python 3.8–3.12。Python 3.8 使用冻结兼容依赖栈;可选的建模、
调参、Notebook 和文档工具要求 Python 3.10+。
pip install mars-risk==0.0.26
从 GitHub 源码安装当前 main 分支:
pip install "git+https://github.com/leeesq/mars-risk.git"
也可以先克隆仓库,再从本地源码安装:
git clone https://github.com/leeesq/mars-risk.git
cd mars-risk
pip install .
建模与调参需要可选依赖:
pip install "mars-risk[ml,tuning]==0.0.26"
0.0.26 正式发布前,请从源码安装进行文档预览验收。Python 3.8 已停止官方安全维护;
MARS 的运行兼容不代表解释器仍有安全支持。
最小风险评估
import polars as pl
from mars.analysis import profile_risk
df = pl.DataFrame(
{
"income": [3200, 3600, 5200, 6100, 3400, 4300, 5800, 6800],
"utilization": [0.72, 0.61, 0.29, 0.18, 0.66, 0.48, 0.24, 0.12],
"target": [1, 1, 0, 0, 1, 1, 0, 0],
}
)
risk_profile = profile_risk(
df,
target="target",
features=["income", "utilization"],
method="quantile",
n_bins=4,
)
summary = risk_profile.report.summary_table
binner = risk_profile.binner
完整的日期、分组、趋势和报告示例见 10 分钟 Quickstart。
从任务开始
| 目标 | 文档 |
|---|---|
| 检查缺失、分布和 PSI | 数据画像 |
| 使用基准规则评估当前数据 | 分箱与风险评估 |
| 统计、线性或重要性筛选 | 特征筛选 |
| 切分、调参、replay 与 Pipeline | Modeling / Pipeline |
| 分布、模型分和表现覆盖率监控 | 特征与模型监控 |
| Excel、HTML、评分卡与 SQL | 报告与评分卡 |
| 精确签名、默认值和异常 | API Reference |
稳定性
Analysis、Feature、Reporting 是当前 Stable 模块。Monitoring、Modeling、Pipeline、Scoring 为 Experimental;受控生产流程应固定精确版本,并为 report 字段、报警结果、评分映射、生成 SQL、 step 契约、replay 和 artifact 路径增加契约回归。
开发检查
python -m ruff check src tests scripts docs/snippets
python -m mypy src/mars
pydoclint src/mars
python scripts/check_private_docstrings.py src/mars
python -m pytest -q
python -m mkdocs build --strict
贡献要求见 CONTRIBUTING.md,许可证见 LICENSE。
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mars_risk-0.0.26.tar.gz.
File metadata
- Download URL: mars_risk-0.0.26.tar.gz
- Upload date:
- Size: 460.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24445cfc691fb767fb38358c6fadf7774c6b39fd37dfb0f72ad56566742e7b7c
|
|
| MD5 |
fbe11557cda800430c1481cd4c8b5d7c
|
|
| BLAKE2b-256 |
1392b43ee18146a3661d9bf745bd8f7ccc0dc09c6439efa446d6b3ccca88805b
|
Provenance
The following attestation bundles were made for mars_risk-0.0.26.tar.gz:
Publisher:
publish.yml on leeesq/mars-risk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mars_risk-0.0.26.tar.gz -
Subject digest:
24445cfc691fb767fb38358c6fadf7774c6b39fd37dfb0f72ad56566742e7b7c - Sigstore transparency entry: 2323986912
- Sigstore integration time:
-
Permalink:
leeesq/mars-risk@e86df7586904027dcf85d5ff78594b5d9c0cee1b -
Branch / Tag:
refs/tags/0.0.26 - Owner: https://github.com/leeesq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e86df7586904027dcf85d5ff78594b5d9c0cee1b -
Trigger Event:
release
-
Statement type:
File details
Details for the file mars_risk-0.0.26-py3-none-any.whl.
File metadata
- Download URL: mars_risk-0.0.26-py3-none-any.whl
- Upload date:
- Size: 464.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa8217f649c9ae023eea81a6930a6d3a82cc31d8a2819107d7be171201c0f55a
|
|
| MD5 |
feb1e2d1d420d313288560bfac0e6cbf
|
|
| BLAKE2b-256 |
5ec3af1dca360a58b96daf3bb13fcfbad3a91080d4bce2c91a0207484980afed
|
Provenance
The following attestation bundles were made for mars_risk-0.0.26-py3-none-any.whl:
Publisher:
publish.yml on leeesq/mars-risk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mars_risk-0.0.26-py3-none-any.whl -
Subject digest:
aa8217f649c9ae023eea81a6930a6d3a82cc31d8a2819107d7be171201c0f55a - Sigstore transparency entry: 2323987040
- Sigstore integration time:
-
Permalink:
leeesq/mars-risk@e86df7586904027dcf85d5ff78594b5d9c0cee1b -
Branch / Tag:
refs/tags/0.0.26 - Owner: https://github.com/leeesq
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e86df7586904027dcf85d5ff78594b5d9c0cee1b -
Trigger Event:
release
-
Statement type: