SuperModelingFactory 0.2.0__py3-none-any.whl
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.
- ExcelMaster/ExcelFormatTool.py +487 -0
- ExcelMaster/ExcelMaster.py +917 -0
- ExcelMaster/Template.py +525 -0
- ExcelMaster/Utility.py +233 -0
- ExcelMaster/__init__.py +3 -0
- Modeling_Tool/Core/Binning_Tool.py +1608 -0
- Modeling_Tool/Core/Binning_Tool.pyi +48 -0
- Modeling_Tool/Core/Check_DuckDB_Compatibility.py +835 -0
- Modeling_Tool/Core/Json_Data_Converter.py +621 -0
- Modeling_Tool/Core/Model_Registry_Tool.py +199 -0
- Modeling_Tool/Core/ODPS_Tool.py +284 -0
- Modeling_Tool/Core/Slope_Tool.py +356 -0
- Modeling_Tool/Core/Slope_Tool.pyi +31 -0
- Modeling_Tool/Core/XOR_Encryptor.py +207 -0
- Modeling_Tool/Core/XOR_Encryptor.pyi +26 -0
- Modeling_Tool/Core/__init__.py +99 -0
- Modeling_Tool/Core/kDataFrame.py +228 -0
- Modeling_Tool/Core/kDataFrame.pyi +43 -0
- Modeling_Tool/Core/sample_weight_utils.py +77 -0
- Modeling_Tool/Core/utils.py +2672 -0
- Modeling_Tool/Eval/Evaluation_Tool.py +1452 -0
- Modeling_Tool/Eval/Evaluation_Tool.pyi +47 -0
- Modeling_Tool/Eval/Model_Eval_Tool.py +2548 -0
- Modeling_Tool/Eval/Model_Eval_Tool.pyi +37 -0
- Modeling_Tool/Eval/__init__.py +54 -0
- Modeling_Tool/Eval/evaluate_model.py +2008 -0
- Modeling_Tool/Eval/evaluate_model.pyi +50 -0
- Modeling_Tool/Eval/weighted_eval_utils.py +326 -0
- Modeling_Tool/Explainability/Coalition_Structure.py +305 -0
- Modeling_Tool/Explainability/Model_Explainer.py +743 -0
- Modeling_Tool/Explainability/__init__.py +24 -0
- Modeling_Tool/Feature/Distribution_Tool.py +509 -0
- Modeling_Tool/Feature/Distribution_Tool.pyi +42 -0
- Modeling_Tool/Feature/Feature_Insights.py +762 -0
- Modeling_Tool/Feature/Feature_Insights.pyi +33 -0
- Modeling_Tool/Feature/PSI_Tool.py +1195 -0
- Modeling_Tool/Feature/PSI_Tool.pyi +29 -0
- Modeling_Tool/Feature/WOE_Engine_Feature_Patch.py +355 -0
- Modeling_Tool/Feature/__init__.py +40 -0
- Modeling_Tool/Model/Backward_Tool.py +778 -0
- Modeling_Tool/Model/Backward_Tool.pyi +45 -0
- Modeling_Tool/Model/GBM_Search_Tool.py +251 -0
- Modeling_Tool/Model/GBM_Tool.py +1610 -0
- Modeling_Tool/Model/GBM_Tool.pyi +90 -0
- Modeling_Tool/Model/LRM_Tool.py +1198 -0
- Modeling_Tool/Model/LRM_Tool.pyi +47 -0
- Modeling_Tool/Model/__init__.py +61 -0
- Modeling_Tool/Sample/Distribution_Adaptation.py +131 -0
- Modeling_Tool/Sample/Distribution_Adaptation.pyi +30 -0
- Modeling_Tool/Sample/Reject_Infer.py +413 -0
- Modeling_Tool/Sample/Reject_Infer.pyi +43 -0
- Modeling_Tool/Sample/Sample_Split.py +520 -0
- Modeling_Tool/Sample/Sample_Split.pyi +43 -0
- Modeling_Tool/Sample/__init__.py +31 -0
- Modeling_Tool/UAT/UAT_Consistency_Checker.py +1180 -0
- Modeling_Tool/UAT/__init__.py +19 -0
- Modeling_Tool/WOE/WOE_Adapter.py +204 -0
- Modeling_Tool/WOE/WOE_Adapter.pyi +21 -0
- Modeling_Tool/WOE/WOE_Master.py +491 -0
- Modeling_Tool/WOE/WOE_Master.pyi +40 -0
- Modeling_Tool/WOE/WOE_Monotone_Binner.py +3324 -0
- Modeling_Tool/WOE/WOE_Monotone_Binner.pyi +71 -0
- Modeling_Tool/WOE/WOE_Plot_Tool.py +919 -0
- Modeling_Tool/WOE/WOE_Plot_Tool.pyi +46 -0
- Modeling_Tool/WOE/WOE_Report_Builder.py +214 -0
- Modeling_Tool/WOE/WOE_Report_Builder.pyi +24 -0
- Modeling_Tool/WOE/WOE_Tool.py +1094 -0
- Modeling_Tool/WOE/WOE_Tool.pyi +41 -0
- Modeling_Tool/WOE/__init__.py +86 -0
- Modeling_Tool/WOE/plot_woe_tool.py +290 -0
- Modeling_Tool/WOE/plot_woe_tool.pyi +25 -0
- Modeling_Tool/__init__.py +176 -0
- Report/Report_Tool.py +380 -0
- Report/__init__.py +3 -0
- supermodelingfactory-0.2.0.dist-info/METADATA +268 -0
- supermodelingfactory-0.2.0.dist-info/RECORD +79 -0
- supermodelingfactory-0.2.0.dist-info/WHEEL +5 -0
- supermodelingfactory-0.2.0.dist-info/licenses/LICENSE +102 -0
- supermodelingfactory-0.2.0.dist-info/top_level.txt +3 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# Modeling_Tool.WOE.WOE_Monotone_Binner
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Copyright (c) 2026 Kyle Sun <github.com/Kyle-J-Sun>. All rights reserved.
|
|
5
|
+
# SuperModelingFactory — Licensed under the Business Source License 1.1.
|
|
6
|
+
#
|
|
7
|
+
# This stub describes the public API of a closed-source module compiled to a
|
|
8
|
+
# native extension (.so / .pyd). The original source is not distributed.
|
|
9
|
+
# Production / commercial use requires a separate commercial license.
|
|
10
|
+
#
|
|
11
|
+
# FINGERPRINT: SMF-WOEMONOTONEB-b02e5879
|
|
12
|
+
# (Unique trace marker. Do not remove or alter — used for plagiarism
|
|
13
|
+
# detection across the public internet.)
|
|
14
|
+
# =============================================================================
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import logging
|
|
18
|
+
import io
|
|
19
|
+
import os
|
|
20
|
+
import math
|
|
21
|
+
import warnings
|
|
22
|
+
import textwrap
|
|
23
|
+
import tempfile
|
|
24
|
+
from typing import List, Optional, Dict, Any, Union
|
|
25
|
+
import copy
|
|
26
|
+
from concurrent.futures import ProcessPoolExecutor, as_completed
|
|
27
|
+
import numpy as np
|
|
28
|
+
import pandas as pd
|
|
29
|
+
import matplotlib
|
|
30
|
+
import matplotlib.pyplot as plt
|
|
31
|
+
import matplotlib.ticker as mticker
|
|
32
|
+
_SPECIAL_BIN_PREFIX: object
|
|
33
|
+
_CATE_GROUP_SEP: object
|
|
34
|
+
|
|
35
|
+
class MonotoneWOEBinner:
|
|
36
|
+
def __init__(self, feature_cols: List[str], target_col: str, n_init_bins: int = 20, min_bin_size: float = 0.03, min_n_bins: int = 2, eps: float = 1e-06, missing_woe: float = 0.0, special_values: Optional[List] = None, cate_feats: Optional[List[str]] = None, bin_label_decimals: Optional[int] = None): ...
|
|
37
|
+
def _split_special(self, df: pd.DataFrame, feat: str): ...
|
|
38
|
+
def _cat_to_bin_map(vr: Dict) -> Dict: ...
|
|
39
|
+
def _split_special_for_plot(self, df: pd.DataFrame, feat: str, vr: Dict): ...
|
|
40
|
+
def _assign_normal_bins(self, sub: pd.DataFrame, feat: str, vr: Dict, fitted_edges: list) -> pd.Series: ...
|
|
41
|
+
def _compute_woe_single_bin(self, sub: pd.DataFrame, total_bad: float, total_good: float) -> Dict[str, float]: ...
|
|
42
|
+
def _compute_woe_table(self, df: pd.DataFrame, feat: str, edges: list) -> tuple: ...
|
|
43
|
+
def _compute_sv_table(self, sv_groups: Dict, total_bad: float, total_good: float) -> pd.DataFrame: ...
|
|
44
|
+
def _is_monotone(woe_values: np.ndarray) -> bool: ...
|
|
45
|
+
def _chi2_merge_one(self, df_normal: pd.DataFrame, feat: str, edges: list, chi2_p: float, chi2_init_size: int) -> list: ...
|
|
46
|
+
def _greedy_fit_one(self, df: pd.DataFrame, feat: str, chi2_binning: bool = False, chi2_p: float = 0.99, chi2_init_size: int = 1000) -> Dict[str, Any]: ...
|
|
47
|
+
def _sort_categories(cats: list) -> list: ...
|
|
48
|
+
def _categorical_fit_one(self, df: pd.DataFrame, feat: str) -> Dict[str, Any]: ...
|
|
49
|
+
def fit(self, df: pd.DataFrame, chi2_binning: bool = False, chi2_p: float = 0.99, chi2_init_size: int = 1000, n_jobs: int = 1) -> 'MonotoneWOEBinner': ...
|
|
50
|
+
def _check_fitted(self): ...
|
|
51
|
+
def refine_chi2(self, df: pd.DataFrame, features: Optional[List[str]] = None, chi2_p: float = 0.99, chi2_init_size: int = 1000, n_jobs: int = 1) -> 'MonotoneWOEBinner': ...
|
|
52
|
+
def _dtree_edges(df_normal: pd.DataFrame, feat: str, target_col: str, max_bins: int, min_samples_leaf) -> list: ...
|
|
53
|
+
def _monotone_merge_edges(df_normal: pd.DataFrame, feat: str, target_col: str, edges: list, eps: float) -> list: ...
|
|
54
|
+
def refine_dtree(self, df: pd.DataFrame, features: Optional[List[str]] = None, max_bins: int = 6, min_samples_leaf: float = 0.05, monotone: bool = True, n_jobs: int = 1) -> 'MonotoneWOEBinner': ...
|
|
55
|
+
def _cluster_cate_one(self, vr: Dict, max_bins: int, min_bin_size: float, badrate_tol: Optional[float]) -> Optional[Dict[str, Any]]: ...
|
|
56
|
+
def refine_cate(self, features: Optional[List[str]] = None, max_bins: int = 5, min_bin_size: float = 0.0, badrate_tol: Optional[float] = None) -> 'MonotoneWOEBinner': ...
|
|
57
|
+
def _bin_label(edges: list, bin_idx: int, n_bins: int, decimals: Optional[int] = None) -> str: ...
|
|
58
|
+
def get_final_bins(self) -> Dict[str, pd.DataFrame]: ...
|
|
59
|
+
def get_bin_edges(self) -> Dict[str, List[float]]: ...
|
|
60
|
+
def load_woe_bins(self, bins_dict: dict) -> 'MonotoneWOEBinner': ...
|
|
61
|
+
def _make_bin_labels(edges: List[float], n_bins: int, decimals: Optional[int] = None) -> List[str]: ...
|
|
62
|
+
def _reconstruct_edges(bin_labels: List[str]) -> List[float]: ...
|
|
63
|
+
def _looks_like_interval(label: str) -> bool: ...
|
|
64
|
+
def _infer_cat_value(label): ...
|
|
65
|
+
def apply_woe(self, data: pd.DataFrame, suffix: str = '_woe', inplace: bool = False) -> pd.DataFrame: ...
|
|
66
|
+
def export_woe_report(self, report_path: str) -> None: ...
|
|
67
|
+
def _render_woe_chart(self, feat: str, normal_df: pd.DataFrame, sv_df: pd.DataFrame, vr: Dict, dpi: int = 120, figsize: tuple = (9, 4.5)) -> io.BytesIO: ...
|
|
68
|
+
def plot_woe_graph(self, graph_path: str, group_name: Optional[str] = None, _df_for_group: Optional[pd.DataFrame] = None, dpi: int = 150, figsize: tuple = (9, 6), bar_mode: str = 'clustered') -> None: ...
|
|
69
|
+
def _plot_feat_small_multiples(self, feat, normal_df, sv_df, n_normal, n_sv, n_total, x_normal, x_sv, x_all, group_name, _df_for_group, graph_path, dpi, figsize, GOOD_COLOR, BAD_COLOR, SV_GOOD, SV_BAD, SV_WOE): ...
|
|
70
|
+
def iv_summary(self) -> pd.DataFrame: ...
|
|
71
|
+
def __repr__(self) -> str: ...
|