How to bin continuous variable based on label frequency? I have a continuous variable called salary, age etc and output variable as loan_status
Instead of me choosing the cut off points (which I did) for salary and age bins , I would like to compute the bins based on loan_status.
Is there any automated solution or python package to do this (and return the actual bin values which we can interpret (instead of returning some probabilities or something)? If probabilities, I may not know which probability value corresponds to which bin/salary value.
I ask this because I don't have business user inputs. I just wish to compare the model performance (based on my judgement of binning data) against the model performance (based on automated binning).
Please note that I want binning method which takes into account the loan_status. Meaning, if loan_status = 1 for people mostly with salary from 10000 to 50000, then I would like that to be bin 1, 2 (based on n_bins) and rest of the values should be assigned to bin 3. I am aware of quantile binning, k-means binning etc. But I guess they don't consider the outcome label distribution. I know we have similar solutions for categorical encoding based on target label (count, frequency etc). Is there anything for continuous variable encoding based on outcome label?
Again, if it is just a min and max of the bin based on the loan_status, it would just be 2 bins (and there is no intelligence here). Is there any automated package that can suggest us the no of bins for each label or if we configure n_bins=3, can it provide 3 bins for each label?
I would like to arrive at a bin value based on the outcome label distribution
Can guide me on this?

If I understood correctly you want to bin 2 variables (salary, and age) according your target variable (loan_status), which I understand is binary.
If my assumption is correct, I recommend to use optbinning, this python package is well documented.
Good luck.
