text_html_output_1.png
from sklearn.pipeline import make_pipeline

from skorecard.bucketers import DecisionTreeBucketer, OptimalBucketer

from skorecard.pipeline import BucketingProcess

from skorecard.preprocessing import WoeEncoder

import pandas as pd

data = pd.read_csv('/kaggle/input/dataset-for-practicing-classification/exercises-logistic-regression-exercise-1/nba_logreg.csv')

data.describe().T

data.columns.to_list()

cols_pred = []
col_target = 'TARGET_5Yrs'
for col in data.columns.to_list():
    if col not in ['Name', 'TARGET_5Yrs']:
        cols_pred.append(col)

from skorecard.bucketers import DecisionTreeBucketer, OptimalBucketer
from skorecard.preprocessing import WoeEncoder
from skorecard.pipeline import BucketingProcess
from sklearn.pipeline import make_pipeline
bucketing_process = BucketingProcess(prebucketing_pipeline=make_pipeline(DecisionTreeBucketer(variables=cols_pred, max_n_bins=100, min_bin_size=0.05)), bucketing_pipeline=make_pipeline(OptimalBucketer(variables=cols_pred, max_n_bins=10, min_bin_size=0.05)))
woe_pipe = make_pipeline(bucketing_process, WoeEncoder())
x_train_woe = woe_pipe.fit_transform(x_train, y_train)
x_test_woe = woe_pipe.transform(x_test)

bucketing_process.summary()