ISSUE 01:
Apply the Mono_Bin Binning Function for Continuous Variables: Y = Target, X = Variable, n = max_bin
FIRST Variable: x1
Y = SF_Train5['y']
X = SF_Train5['x1']
max_bin = 10
force_bin = 3
WOE_01 , IV_01 = Mono_Bin(Y , X , n = max_bin)
WOE_01
The program works and produces the Output:
SECOND Variable: x4
Y = SF_Train5['y']
X = SF_Train5['x4']
max_bin = 10
force_bin = 3
WOE_04 , IV_04 = Mono_Bin(Y , X , n = max_bin)
WOE_04
The program does NOT work and produces the ValueError:
ValueError: percentiles should all be in the interval [0, 1].
if len(d2) == 1:
35 n = force_bin
---> 37 bins = df1.quantile(notmiss.X, np.linspace(0, 1, n))
I have compared the range of values within the two variables which had previously been transformed
using the Min_Max Scaler to be between 0 and 100 as well as the separation of their percentile values.
No Apparent Reason why the code should work with all my data variables except this one??
ISSUE 02:
The output table from your example produces the actual name of the column ( VAR_NAME) in the input dataframe
for which the WOE is being computed. However when I run the code on my data my table ( VAR_NAME) does not
have the actual name in the table but simply VAR for each and every variable on each run through my dataframe columns...
I would appreciate some help with fixing the above two problems.