The n_bins argument is defined in the _psi stat test function signature but is not utilized in the function's logic. This issue creates confusion for developers expecting the n_bins parameter to influence the calculation of PSI (Population Stability Index).
The get_binned_data function is called within _psi, and while it presumably requires the number of bins for binning the data, the n_bins argument is not used by it (check here)
Suggested change in get_binned_data :
- Pass the n argument directly to
np.histogram_bin_edges as the number of bins:
So line 30 changes to:
bins = np.histogram_bin_edges(pd.concat([reference_data, current_data], axis=0).values, bins=n)
The
n_binsargument is defined in the_psistat test function signature but is not utilized in the function's logic. This issue creates confusion for developers expecting the n_bins parameter to influence the calculation of PSI (Population Stability Index).The
get_binned_datafunction is called within _psi, and while it presumably requires the number of bins for binning the data, then_binsargument is not used by it (check here)Suggested change in
get_binned_data:np.histogram_bin_edgesas the number of bins:So line 30 changes to:
bins = np.histogram_bin_edges(pd.concat([reference_data, current_data], axis=0).values, bins=n)