To skorecard pipeline
Transform a scikit-learn Pipeline to a SkorecardPipeline.
A SkorecardPipeline is a normal scikit-learn pipeline with some extra methods and attributes.
Example:
from skorecard.pipeline.pipeline import SkorecardPipeline, to_skorecard_pipeline
from skorecard.bucketers import DecisionTreeBucketer, OrdinalCategoricalBucketer
from skorecard import datasets
from sklearn.pipeline import make_pipeline
pipe = make_pipeline(
DecisionTreeBucketer(variables = ["LIMIT_BAL", "BILL_AMT1"],max_n_bins=5),
OrdinalCategoricalBucketer(variables = ["EDUCATION", "MARRIAGE"], tol =0.05)
)
sk_pipe = to_skorecard_pipeline(pipe)
df = datasets.load_uci_credit_card(as_frame=True)
features = ["LIMIT_BAL", "BILL_AMT1", "EDUCATION", "MARRIAGE"]
X = df[features]
y = df["default"].values
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline |
Pipeline
|
|
required |
Returns:
Name | Type | Description |
---|---|---|
pipeline |
SkorecardPipeline
|
modified pipeline instance. |
Source code in skorecard/pipeline/pipeline.py
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
|