Skip to main content

MARS

MARS

MODELING ANALYSIS RISK SCORE

面向信贷风控分析与建模的 Polars-first Python 工具库

PyPI Docs Python Downloads CI License

MARS 接受 Pandas 或 Polars 宽表,提供数据画像、分箱评估、特征筛选、建模、监控、结构化 report、 Excel/HTML 导出和评分卡能力。

安装

MARS 0.0.23 支持 Python 3.10、3.11 和 3.12。

pip install mars-risk==0.0.23

建模与调参需要可选依赖:

pip install "mars-risk[ml,tuning]==0.0.23"

0.0.23 正式发布前,请从源码安装进行文档预览验收。

最小风险评估

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

mars_risk-0.0.23.tar.gz (431.9 kB view details)

Uploaded Source

Built Distribution

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

mars_risk-0.0.23-py3-none-any.whl (444.7 kB view details)

Uploaded Python 3

File details

Details for the file mars_risk-0.0.23.tar.gz.

File metadata

  • Download URL: mars_risk-0.0.23.tar.gz
  • Upload date:
  • Size: 431.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mars_risk-0.0.23.tar.gz
Algorithm Hash digest
SHA256 7af23a66d1e209283a3c90f1e0af887b6ff245d3b27e1bade78ca7c603695d92
MD5 f09c45953fef63908eb49f434c874dd0
BLAKE2b-256 593c0a2c9abcc381fcee6885c204007042862bde843e1b71ae38f3c9998aa4fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for mars_risk-0.0.23.tar.gz:

Publisher: publish.yml on leeesq/mars-risk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mars_risk-0.0.23-py3-none-any.whl.

File metadata

  • Download URL: mars_risk-0.0.23-py3-none-any.whl
  • Upload date:
  • Size: 444.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mars_risk-0.0.23-py3-none-any.whl
Algorithm Hash digest
SHA256 bb576a6458157ef6f8f525cf52c3384d3cbcf6823545743b387b1198407d28ef
MD5 5ef14192011ccd0b1b10b3db878c451f
BLAKE2b-256 0cb9eee2ab1d49a00fc273fc62c92e5b156cb4f254f7bd5b51ac46d87b369d02

See more details on using hashes here.

Provenance

The following attestation bundles were made for mars_risk-0.0.23-py3-none-any.whl:

Publisher: publish.yml on leeesq/mars-risk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.0.27

2 files

0.0.26

2 files

0.0.25

2 files

0.0.24

2 files

This release

0.0.23 This release

2 files

0.0.21

2 files

0.0.20

2 files

0.0.19

2 files

0.0.18

2 files

0.0.17

2 files

0.0.16

2 files

0.0.15

2 files

0.0.14

2 files

0.0.13

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

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