Skill: tangweigang-jpg/credit-scorecard (version 0.3.3)

--- name: credit-scorecard description: |- 基于监督学习、决策树或聚类等多种算法，自动为评分卡变量生成最优分箱边界，同时支持单调性约束和缺失值处理。 license: Proprietary. See LICENSE.txt in project root. compatibility: Designed for Doramagic-host ecosystem (Claude Code / openclaw / Cursor). Requires Python 3.12+ with uv package manager. metadata: version: "v6.1" blueprint_id: "finance-bp-050" compiled_at: "2026-04-22T13:00:17.518473+00:00" capability_markets: "global" capability_activities: "credit-risk" sop_version: "crystal-compilation-v6.1" --- # 信用评分卡 (credit-scorecard) > 基于监督学习、决策树或聚类等多种算法，自动为评分卡变量生成最优分箱边界，同时支持单调性约束和缺失值处理。 ## Pipeline `data_collection -> data_storage -> factor_computation -> target_selection -> trading_execution -> visualization` ## Top Use Cases (43 total) ### Optimal Supervised Bucketing (`UC-1`) Automatically find optimal bucket boundaries that maximize predictive power while respecting monotonicity constraints **Triggers**: optimal, supervised, monotonic ### Decision Tree Supervised Bucketing (`UC-2`) Use supervised learning to find bucket boundaries based on target variable correlation **Triggers**: decision tree, supervised, pre-bin ### Equal Width Unsupervised Bucketing (`UC-3`) Divide numerical features into N equally spaced intervals regardless of data distribution **Triggers**: equal width, unsupervised, histogram For all **43** use cases, see [references/USE_CASES.md](references/USE_CASES.md). **Execute trigger**: `When user intent matches intent_router.uc_entries[].positive_terms AND user uses action verb (run/execute/跑/执行/backtest/fetch/collect)` ## What I'll Ask You - Target market: A-share (default), HK, or crypto? (US stocks in ZVT are half-baked — stockus_nasdaq_AAPL exists but coverage is thin) - Data source / provider: eastmoney (free, no account), joinquant (account+paid), baostock (free, good history), akshare, or qmt (broker)? - Strategy type: MACD golden-cross, MA crossover, volume breakout, fundamental screen, or custom factor? - Time range: start_timestamp and end_timestamp for backtest period - Target entity IDs: specific stocks (stock_sh_600000) or index components (SZ1000)? ## Semantic Locks (Fatal) | ID | Rule | On Violation | |---|---|---| | `SL-01` | Execute sell orders before buy orders in every trading cycle | halt | | `SL-02` | Trading signals MUST use next-bar execution (no look-ahead) | halt | | `SL-03` | Entity IDs MUST follow format entity_type_exchange_code | halt | | `SL-04` | DataFrame index MUST be MultiIndex (entity_id, timestamp) | halt | | `SL-05` | TradingSignal MUST have EXACTLY ONE of: position_pct, order_money, order_amount | halt | | `SL-06` | filter_result column semantics: True=BUY, False=SELL, None/NaN=NO ACTION | halt | | `SL-07` | Transformer MUST run BEFORE Accumulator in factor pipeline | halt | | `SL-08` | MACD parameters locked: fast=12, slow=26, signal=9 | halt | Full lock definitions: [references/LOCKS.md](references/LOCKS.md) ## Top Anti-Patterns (14 total) - **`AP-CREDIT-RISK-001`**: Empty DataFrame passed to bucketing pipeline - **`AP-CREDIT-RISK-002`**: Multi-dimensional target array causing WoE shape mismatch - **`AP-CREDIT-RISK-003`**: OptimalBucketer receiving high-cardinality numerical features All 14 anti-patterns: [references/ANTI_PATTERNS.md](references/ANTI_PATTERNS.md) ## Evidence Quality Notice > [QUALITY NOTICE] This crystal was compiled from blueprint finance-bp-050. Evidence verify ratio = 78.6% and audit fail total = 24. Generated results may have uncaptured requirement gaps. Verify critical decisions against source files (LATEST.yaml / LATEST.jsonl). ## Reference Files | File | Contents | When to Load | |---|---|---| | [references/seed.yaml](references/seed.yaml) | V6+ 全量权威 (source-of-truth) | 有行为/决策争议时必读 | | [references/ANTI_PATTERNS.md](references/ANTI_PATTERNS.md) | 14 条跨项目反模式 | 开始实现前 | | [references/WISDOM.md](references/WISDOM.md) | 跨项目精华借鉴 | 架构决策时 | | [references/CONSTRAINTS.md](references/CONSTRAINTS.md) | domain + fatal 约束 | 规则冲突时 | | [references/USE_CASES.md](references/USE_CASES.md) | 全量 KUC-* 业务场景 | 需要完整示例时 | | [references/LOCKS.md](references/LOCKS.md) | SL-* + preconditions + hints | 生成回测/交易代码前 | | [references/COMPONENTS.md](references/COMPONENTS.md) | AST 组件地图（按 module 拆分）| 查 API 时 | --- *Compiled by Doramagic crystal-compilation-v6.1 from `finance-bp-050` blueprint at 2026-04-22T13:00:17.518473+00:00.* *See [human_summary.md](human_summary.md) for non-technical overview.*

path: human_summary.md
content: # Human Summary

> I help you build quant strategies on A-share with ZVT — from data fetch to backtest, one flow. Just tell me what you want; I'll write the code, you don't have to dig docs. (Heads up: ZVT natively supports A-share, HK, and crypto. US stocks — stockus_nasdaq_AAPL — are half-baked; don't bother for serious work.)

## What I Can Do

- **tagline**: I help you build quant strategies on A-share with ZVT — from data fetch to backtest, one flow. Just tell me what you want; I'll write the code, you don't have to dig docs. (Heads up: ZVT natively supports A-share, HK, and crypto. US stocks — stockus_nasdaq_AAPL — are half-baked; don't bother for serious work.)
- **use_cases**: ['Equal Width Unsupervised Bucketing', 'Decision Tree Supervised Bucketing', 'Optimal Supervised Bucketing', 'A-share MACD daily golden-cross backtest with hfq price adjustment from eastmoney', 'End-to-end ZVT pipeline: FinanceRecorder + GoodCompanyFactor + StockTrader', 'Multi-factor strategy with TargetSelector (AND mode) combining MACD + volume breakout', 'Index composition data collection (SZ1000, SZ2000) with EM recorder']

## What I Ask You

- Target market: A-share (default), HK, or crypto? (US stocks in ZVT are half-baked — stockus_nasdaq_AAPL exists but coverage is thin)
- Data source / provider: eastmoney (free, no account), joinquant (account+paid), baostock (free, good history), akshare, or qmt (broker)?
- Strategy type: MACD golden-cross, MA crossover, volume breakout, fundamental screen, or custom factor?
- Time range: start_timestamp and end_timestamp for backtest period
- Target entity IDs: specific stocks (stock_sh_600000) or index components (SZ1000)?


path: references/ANTI_PATTERNS.md
content: # Anti-Patterns (Cross-Project)

Total: **14**

## finance-bp-050--skorecard (5)

### `AP-CREDIT-RISK-001` — Empty DataFrame passed to bucketing pipeline <sub>(high)</sub>

When preparing input data for bucketing, passing an empty DataFrame with zero rows or zero columns causes immediate ValueError at validation stage. This prevents any downstream processing and blocks the entire credit risk scoring pipeline from executing. The root cause is missing defensive validation before data enters the bucketing workflow.

### `AP-CREDIT-RISK-002` — Multi-dimensional target array causing WoE shape mismatch <sub>(high)</sub>

When providing target variable y to bucketers without normalizing to 1D numpy array through _check_y validation, downstream Weight of Evidence calculations fail with shape mismatches. The consequence is corrupted bucket tables with incorrect credit risk scores that misrepresent default probability estimates.

### `AP-CREDIT-RISK-003` — OptimalBucketer receiving high-cardinality numerical features <sub>(high)</sub>

When implementing prebucketing for OptimalBucketer on numerical features without reducing to at most 100 unique values, the system raises NotPreBucketedError and blocks the entire bucketing pipeline. Similarly, AsIsNumericalBucketer fails with the same error for columns exceeding 100 unique values, preventing feature transformation in production scoring.

### `AP-CREDIT-RISK-004` — Special values distorting optimal bin boundaries <sub>(high)</sub>

When implementing fit() for bucketers without filtering special values from X before computing bin boundaries using _filter_specials_for_fit(), outlier special values distort optimal bin boundaries. This causes incorrect weight-of-evidence calculations and unreliable credit risk scores that misrepresent borrower default probabilities.

### `AP-CREDIT-RISK-005` — Two-phase bucketing ordering violation causing special value loss <sub>(high)</sub>

When fitting a BucketingProcess with two-phase bucketing without fitting prebucketing_pipeline before bucketing_pipeline, special value remapping fails because pre-bucket labels are unavailable. Additionally, not using _find_remapped_specials() after prebucketing causes special values to lose their correct bucket mappings, resulting in runtime errors.

## finance-bp-072--lending (3)

### `AP-CREDIT-RISK-006` — Loan amount exceeding product and collateral limits <sub>(high)</sub>

When validating loan amount for loan applications without enforcing loan_amount does not exceed maximum_loan_amount from loan product or proposed securities, disbursing amounts exceeding product or collateral limits exposes the lender to uncollateralized risk. This violates lending policy and creates direct financial loss exposure through unauthorized lending.

### `AP-CREDIT-RISK-007` — Disbursement validation failures creating unauthorized exposure <sub>(high)</sub>

When implementing loan disbursement validation without checking disbursed amount against loan limit, assigned security value, available limit amount, and limit applicability dates, unauthorized disbursements occur. For Line of Credit loans, disbursement outside approved periods or exceeding available limits creates unauthorized lending exposure and regulatory compliance violations.

### `AP-CREDIT-RISK-008` — Interest accrual on written-off loans inflating income <sub>(high)</sub>

When processing interest accrual for Written Off loans without verifying posting_date is on or after the loan write-off date, interest is artificially inflated on non-performing assets. This misrepresents loan portfolio value, violates provisioning requirements, and creates false income reporting that misleads stakeholders about actual financial performance.

## finance-bp-112--openLGD (2)

### `AP-CREDIT-RISK-009` — Loop index errors in federated parameter averaging <sub>(high)</sub>

When implementing federated parameter averaging logic, using the final index n instead of the loop variable k causes only the last server's weight to be applied repeatedly. Additionally, skipping the first server by starting loop index at 1 excludes valid parameters from averaging, breaking federated convergence and producing incorrect LGD estimates across all nodes.

### `AP-CREDIT-RISK-010` — API response format inconsistency breaking federated coordination <sub>(high)</sub>

When implementing GET /start and POST /update endpoints for LGD estimation without consistent 'intercept' and 'coefficient' keys in JSON responses, the federated coordinator fails to parse responses causing KeyError. Different return key names (e.g., 'coef' instead of 'coefficient') break both standalone and federated execution paths.

## finance-bp-119--transitionMatrix (4)

### `AP-CREDIT-RISK-011` — Invalid transition probabilities corrupting Markov matrices <sub>(high)</sub>

When generating synthetic Markov chain data or estimating transition matrices with probabilities outside [0, 1] or row sums not equal to 1.0, the resulting matrices violate the fundamental mathematical definition of a stochastic transition matrix. This corrupts all downstream Markov chain modeling and credit curve generation, producing unreliable credit risk estimates.

### `AP-CREDIT-RISK-012` — Unsorted event data causing incorrect transition matrix estimates <sub>(high)</sub>

When feeding generated data to cohort or duration estimators without sorting by entity ID first, then by ascending time, incorrect timepoint assignment occurs in estimators, leading to wrong transition counts. Unsorted data also causes the Aalen-Johansen algorithm to process events out of temporal order, producing incorrect transition matrices that violate the Markov property.

### `AP-CREDIT-RISK-013` — Zero-count division causing NaN in transition matrices <sub>(high)</sub>

When normalizing counts to produce transition probabilities without checking source state population count is greater than zero before division, division by zero occurs and causes NaN values in the transition matrix. These NaN values corrupt all downstream matrix operations including generator matrix computation and credit curve generation.

### `AP-CREDIT-RISK-014` — Wrong matrix logarithm method producing invalid generator matrices <sub>(medium)</sub>

When implementing generator() method without using scipy.linalg.logm for matrix logarithm computation, using numpy.log or other approximation methods produces invalid generator matrices with row sums not equal to zero. This violates the mathematical definition of an infinitesimal generator, causing incorrect continuous-time Markov chain modeling.


path: references/COMPONENTS.md
content: # Component Capability Map

**Project**: finance-bp-050--skorecard
**Scan date**: 2026-04-22
**Stats**: {'total_files': 9, 'total_classes': 18, 'total_functions': 0, 'total_stages': 9}

## Modules (9)

- [data_preparation](components/data_preparation.md): 2 classes
- [feature_pre-bucketing_(optional)](components/feature_pre-bucketing_-optional.md): 2 classes
- [feature_bucketing_/_binning](components/feature_bucketing_-_binning.md): 2 classes
- [weight_of_evidence_(woe)_encoding](components/weight_of_evidence_-woe-_encoding.md): 2 classes
- [feature_selection](components/feature_selection.md): 2 classes
- [logistic_regression_model_training](components/logistic_regression_model_training.md): 2 classes
- [scorecard_rescaling](components/scorecard_rescaling.md): 2 classes
- [validation_and_reporting](components/validation_and_reporting.md): 2 classes
- [model_deployment](components/model_deployment.md): 2 classes


path: references/CONSTRAINTS.md
content: # Constraints

## preservation_manifest

```yaml
required_objects:
  business_decisions_count: 124
  fatal_constraints_count: 64
  non_fatal_constraints_count: 194
  use_cases_count: 43
  semantic_locks_count: 12
  preconditions_count: 4
  evidence_quality_rules_count: 2
  traceback_scenarios_count: 5

```


path: references/LOCKS.md
content: # Semantic Locks + Preconditions

## Semantic Locks (12)

### `SL-01` <sub>(on_violation: fatal)</sub>
Execute sell orders before buy orders in every trading cycle

### `SL-02` <sub>(on_violation: fatal)</sub>
Trading signals MUST use next-bar execution (no look-ahead)

### `SL-03` <sub>(on_violation: fatal)</sub>
Entity IDs MUST follow format entity_type_exchange_code

### `SL-04` <sub>(on_violation: fatal)</sub>
DataFrame index MUST be MultiIndex (entity_id, timestamp)

### `SL-05` <sub>(on_violation: fatal)</sub>
TradingSignal MUST have EXACTLY ONE of: position_pct, order_money, order_amount

### `SL-06` <sub>(on_violation: fatal)</sub>
filter_result column semantics: True=BUY, False=SELL, None/NaN=NO ACTION

### `SL-07` <sub>(on_violation: fatal)</sub>
Transformer MUST run BEFORE Accumulator in factor pipeline

### `SL-08` <sub>(on_violation: fatal)</sub>
MACD parameters locked: fast=12, slow=26, signal=9

### `SL-09` <sub>(on_violation: warning)</sub>
Default transaction costs: buy_cost=0.001, sell_cost=0.001, slippage=0.001

### `SL-10` <sub>(on_violation: fatal)</sub>
A-share equity trading is T+1 (no same-day close of buy positions)

### `SL-11` <sub>(on_violation: fatal)</sub>
Recorder subclass MUST define provider AND data_schema class attributes

### `SL-12` <sub>(on_violation: fatal)</sub>
Factor result_df MUST contain either 'filter_result' OR 'score_result' column

## Preconditions (4)

- **`PC-01`**: `python3 -c 'import zvt; print(zvt.__version__)'` → on_fail: Run: python3 -m pip install zvt then re-run: python3 -m zvt.init_dirs to initialize data directories
- **`PC-02`**: `python3 -c "from zvt.api.kdata import get_kdata; df = get_kdata(entity_ids=['stock_sh_600000'], limit=1); assert df is not None and len(df) > 0, 'No kdata found'"` → on_fail: Run recorder first: python3 -m zvt.recorders.em.em_stock_kdata_recorder --entity_ids stock_sh_600000 (replace with your target entity IDs)
- **`PC-03`**: `python3 -c "import os; from pathlib import Path; zvt_home = Path(os.environ.get('ZVT_HOME', Path.home() / '.zvt')); assert zvt_home.exists(), f'ZVT home not found: {zvt_home}'"` → on_fail: Run: python3 -m zvt.init_dirs
- **`PC-04`**: `python3 -c "import os, tempfile; from pathlib import Path; zvt_home = Path(os.environ.get('ZVT_HOME', Path.home() / '.zvt')); test_f = zvt_home / '.write_test'; test_f.touch(); test_f.unlink()"` → on_fail: Check directory permissions: chmod u+w ~/.zvt or set ZVT_HOME environment variable to a writable location


path: references/USE_CASES.md
content: # Known Use Cases (KUC)

Total: **43**

## `KUC-1`
**Source**: `skorecard/bucketers/bucketers.py`

Automatically find optimal bucket boundaries that maximize predictive power while respecting monotonicity constraints

## `KUC-2`
**Source**: `skorecard/bucketers/bucketers.py`

Use supervised learning to find bucket boundaries based on target variable correlation

## `KUC-3`
**Source**: `skorecard/bucketers/bucketers.py`

Divide numerical features into N equally spaced intervals regardless of data distribution

## `KUC-4`
**Source**: `skorecard/bucketers/bucketers.py`

Divide numerical features into N buckets with equal number of observations (quantiles)

## `KUC-5`
**Source**: `skorecard/bucketers/bucketers.py`

Use agglomerative clustering to find natural groupings in numerical data

## `KUC-6`
**Source**: `skorecard/bucketers/bucketers.py`

Convert categorical variables into ordered ordinal numbers based on target rate or frequency

## `KUC-7`
**Source**: `skorecard/bucketers/bucketers.py`

Treat existing unique categories as pre-defined buckets without transformation

## `KUC-8`
**Source**: `skorecard/bucketers/bucketers.py`

Treat existing unique numerical values as bucket boundaries (for pre-bucketed data)

## `KUC-9`
**Source**: `skorecard/bucketers/bucketers.py`

Apply manually defined bucket boundaries from YAML or dictionary to new data

## `KUC-10`
**Source**: `skorecard/pipeline/bucketing_process.py`

First pre-bucket high-cardinality features, then apply final bucketing strategy

## `KUC-11`
**Source**: `skorecard/bucketers/base_bucketer.py`

Handle missing values by assigning them to specific buckets or treating separately

## `KUC-12`
**Source**: `skorecard/bucketers/base_bucketer.py`

Assign specific outlier or important values to their own dedicated buckets

## `KUC-13`
**Source**: `skorecard/bucketers/base_bucketer.py`

Visually explore and manually adjust bucket boundaries using Dash web app

## `KUC-14`
**Source**: `skorecard/preprocessing/_WoEEncoder.py`

Transform bucket IDs into Weight of Evidence values for logistic regression

## `KUC-15`
**Source**: `skorecard/metrics/metrics.py`

Measure the predictive power of individual features for credit risk

## `KUC-16`
**Source**: `skorecard/reporting/report.py`

Monitor distribution drift between training and production data

## `KUC-17`
**Source**: `skorecard/linear_model/linear_model.py`

Build logistic regression model with statistical significance for credit scoring

## `KUC-18`
**Source**: `skorecard/skorecard.py`

Build complete credit scoring scorecard in one step

## `KUC-19`
**Source**: `skorecard/rescale/rescale.py`

Convert model probabilities to traditional scorecard scale (e.g., 300-850)

## `KUC-20`
**Source**: `skorecard/reporting/report.py`

Generate detailed bucket tables with event rate, WoE, IV for documentation

## `KUC-21`
**Source**: `skorecard/reporting/plotting.py`

Visualize bucket distributions with event rate or WoE trends

## `KUC-22`
**Source**: `skorecard/bucket_mapping.py`

Export bucket mappings to YAML for production deployment

## `KUC-23`
**Source**: `skorecard/pipeline/pipeline.py`

Integrate skorecard bucketers into existing scikit-learn ML pipelines

## `KUC-24`
**Source**: `docs/tutorials/2_feature_selection.ipynb`

Select most predictive and stable features using IV and PSI metrics

## `KUC-25`
**Source**: `skorecard/utils/validation.py`

Detect suppressor effects and multicollinearity between features

## `KUC-26`
**Source**: `docs/tutorials/categoricals.ipynb`

Handle categorical variables with many categories in credit scoring

## `KUC-27`
**Source**: `docs/discussion/benchmark_with_EBM.ipynb`

Compare skorecard performance against Explainable Boosting Machines

## `KUC-101`
**Source**: `docs/discussion/benchmark_stats_feature.ipynb`

Compare performance of different machine learning classifiers on credit card default prediction using AUC metrics.

## `KUC-103`
**Source**: `docs/discussion/benchmarks.ipynb`

Run comprehensive benchmarks comparing multiple classifiers on credit card data with timing analysis.

## `KUC-104`
**Source**: `docs/howto/Optimizations.ipynb`

Find optimal bucketing parameters (max_n_bins, min_bin_size) using grid search with Information Value scoring.

## `KUC-105`
**Source**: `docs/howto/mix_with_other_packages.ipynb`

Combine skorecard bucketing with external packages like category_encoders and sklearn transformers in a pipeline.

## `KUC-106`
**Source**: `docs/howto/psi_and_iv.ipynb`

Calculate Population Stability Index (PSI) and Information Value (IV) to validate feature stability and predictive power.

## `KUC-107`
**Source**: `docs/howto/save_buckets_to_file.ipynb`

Persist bucketer configurations to YAML files for reuse and deployment across environments.

## `KUC-108`
**Source**: `docs/howto/using_manually_defined_buckets.ipynb`

Define custom bucket boundaries manually for specific business requirements without automatic binning.

## `KUC-109`
**Source**: `docs/tutorials/1_bucketing.ipynb`

Learn fundamental bucketing concepts for credit card data including categorical and numerical feature handling.

## `KUC-111`
**Source**: `docs/tutorials/3_skorecard_model.ipynb`

Build an end-to-end scorecard model combining bucketing with logistic regression for credit scoring.

## `KUC-113`
**Source**: `docs/tutorials/interactive_bucketing.ipynb`

Learn interactive bucketing approach for manual adjustment of bin boundaries in a pipeline.

## `KUC-114`
**Source**: `docs/tutorials/methods.ipynb`

Explore bucketer methods including summary statistics, bucket tables, plots, and YAML export.

## `KUC-115`
**Source**: `docs/tutorials/missing_values.ipynb`

Handle missing values in bucketing with various treatment strategies like neutral, similar, least_risky.

## `KUC-116`
**Source**: `docs/tutorials/reporting.ipynb`

Generate reports and visualizations for scorecard models including bucket tables and weight plots.

## `KUC-117`
**Source**: `docs/tutorials/specials.ipynb`

Define special values and ranges in bucketing that require separate treatment from regular bins.

## `KUC-118`
**Source**: `docs/tutorials/the_basics.ipynb`

Introduction to basic bucketing operations including DecisionTree and EqualWidth bucketers.

## `KUC-119`
**Source**: `docs/tutorials/using-bucketing-process.ipynb`

Learn the BucketingProcess workflow with pre-bucketing and bucketing stages for complex credit scoring.


path: references/WISDOM.md
content: # Cross-Project Wisdom

Total: **8**

## `CW-CREDIT-RISK-001` — Strict input DataFrame schema validation
**From**: finance-bp-050--skorecard, finance-bp-112--openLGD · **Applicable to**: credit-risk

Both skorecard and openLGD require strict validation that input DataFrames contain exactly the expected columns (X/Y for openLGD, specified variable names for skorecard). This pattern is critical when data flows through multiple transformation stages where downstream modules access columns by name without defensive checking. Always validate column existence before pipeline execution.

## `CW-CREDIT-RISK-002` — Explicit random_state for ML model reproducibility
**From**: finance-bp-112--openLGD · **Applicable to**: credit-risk

In federated learning scenarios with SGDRegressor, omitting random_state causes non-deterministic results due to random data shuffling and weight initialization. This breaks federated learning convergence guarantees. Always set random_state explicitly when reproducibility across nodes or runs is required for regulatory auditability.

## `CW-CREDIT-RISK-003` — Mandatory data sorting before multi-stage estimation
**From**: finance-bp-050--skorecard, finance-bp-119--transitionMatrix · **Applicable to**: credit-risk

Both skorecard's two-phase bucketing and transitionMatrix's Aalen-Johansen estimator require data to be in a specific order before processing. Skorecard requires prebucketing before bucketing; transitionMatrix requires sorting by entity ID then time. Violating this ordering produces incorrect results or runtime errors. Always establish and enforce processing order in multi-stage pipelines.

## `CW-CREDIT-RISK-004` — Consistent API response key naming across all endpoints
**From**: finance-bp-112--openLGD · **Applicable to**: credit-risk

In federated systems with multiple API endpoints (/start, /update), all responses must use identical key names for parameters (intercept, coefficient). Inconsistency causes coordination loop failures in downstream consumers. Define a schema contract upfront and enforce key naming consistency across all response types.

## `CW-CREDIT-RISK-005` — Cardinality bounds checking before array operations
**From**: finance-bp-050--skorecard, finance-bp-119--transitionMatrix · **Applicable to**: credit-risk

Both skorecard's bucketers (max 100 unique values) and transitionMatrix's matrix operations (state cardinality matching matrix dimensions) require strict cardinality validation before creating numpy arrays or performing computations. Violations cause NotPreBucketedError or index out-of-bounds errors. Always validate cardinality constraints before array initialization.

## `CW-CREDIT-RISK-006` — Financial validation gates before transaction execution
**From**: finance-bp-072--lending · **Applicable to**: credit-risk

Lending systems require validation that disbursement amounts do not exceed limits, collateral values, or authorized periods before any transaction executes. These are financial loss prevention controls, not optional business logic. Missing these validations creates unauthorized exposure and regulatory compliance violations that cannot be remedied retroactively.

## `CW-CREDIT-RISK-007` — Mathematical constraint validation for probability outputs
**From**: finance-bp-050--skorecard, finance-bp-119--transitionMatrix · **Applicable to**: credit-risk

Credit risk models must validate mathematical constraints on outputs: skorecard's WoE requires valid bin assignments, transitionMatrix's transition matrices require row sums equals 1.0 and generator matrices require row sums equals 0.0. Invalid mathematical properties corrupt downstream risk calculations. Validate constraints before returning results.

## `CW-CREDIT-RISK-008` — Port-to-ID mapping consistency in distributed model serving
**From**: finance-bp-112--openLGD · **Applicable to**: credit-risk

When deploying distributed model servers, port numbers must map deterministically to server IDs (e.g., port 5001 maps to server ID 1). Computation of ID from port must be consistent across all components. Inconsistencies cause incorrect data directory selection and model parameter mismatches. Document and validate port-ID mappings during deployment.


path: references/components/data_preparation.md
content: # data_preparation (2 classes)

## `ensure_dataframe`
`data_preparation/ensure-dataframe.py:0`

## `slot`
`data_preparation/slot.py:0`


path: references/components/feature_bucketing_-_binning.md
content: # feature_bucketing_/_binning (2 classes)

## `BaseBucketer.fit`
`feature_bucketing_/_binning/basebucketer-fit.py:0`

## `slot`
`feature_bucketing_/_binning/slot.py:0`


path: references/components/feature_pre-bucketing_-optional.md
content: # feature_pre-bucketing_(optional) (2 classes)

## `BaseBucketer.fit`
`feature_pre-bucketing_(optional)/basebucketer-fit.py:0`

## `slot`
`feature_pre-bucketing_(optional)/slot.py:0`


path: references/components/feature_selection.md
content: # feature_selection (2 classes)

## `iv`
`feature_selection/iv.py:0`

## `slot`
`feature_selection/slot.py:0`


path: references/components/logistic_regression_model_training.md
content: # logistic_regression_model_training (2 classes)

## `LogisticRegression.fit`
`logistic_regression_model_training/logisticregression-fit.py:0`

## `slot`
`logistic_regression_model_training/slot.py:0`


path: references/components/model_deployment.md
content: # model_deployment (2 classes)

## `FeaturesBucketMapping.save_yml`
`model_deployment/featuresbucketmapping-save-yml.py:0`

## `slot`
`model_deployment/slot.py:0`


path: references/components/scorecard_rescaling.md
content: # scorecard_rescaling (2 classes)

## `ScoreCardPoints.fit`
`scorecard_rescaling/scorecardpoints-fit.py:0`

## `slot`
`scorecard_rescaling/slot.py:0`


path: references/components/validation_and_reporting.md
content: # validation_and_reporting (2 classes)

## `SkorecardPipeline.bucket_table`
`validation_and_reporting/skorecardpipeline-bucket-table.py:0`

## `slot`
`validation_and_reporting/slot.py:0`


path: references/components/weight_of_evidence_-woe-_encoding.md
content: # weight_of_evidence_(woe)_encoding (2 classes)

## `WoeEncoder.fit`
`weight_of_evidence_(woe)_encoding/woeencoder-fit.py:0`

## `slot`
`weight_of_evidence_(woe)_encoding/slot.py:0`


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)